Small fixes and additions
Gael: Bitte implementiere die fehlenden Funktionen und den Enumerator
This commit is contained in:
parent
cff4e58090
commit
6e27485b08
3 changed files with 22 additions and 23 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "stdafx.h"
|
||||
#include "PrimImplikant.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -18,7 +18,7 @@ void PrimImplikant::parser(string input) { // Analyser
|
|||
int implikant = 0;
|
||||
string text0 = "";
|
||||
string text1 = "";
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
for (unsigned int i = 0; i < input.size(); i++)
|
||||
{
|
||||
char c = input[i];
|
||||
if (c == 'x' || c == 'X')
|
||||
|
|
|
@ -5,40 +5,39 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
void PrimImplikantCollection::add(PrimImplikant &PI)
|
||||
void PrimImplikantCollection::add(PrimImplikant* &PI)
|
||||
{
|
||||
PIVector.push_back(PI);
|
||||
}
|
||||
void PrimImplikantCollection::add(string input)
|
||||
{
|
||||
PrimImplikant PI(input);
|
||||
PrimImplikant* PI = new PrimImplikant(input);
|
||||
PIVector.push_back(PI);
|
||||
}
|
||||
void PrimImplikantCollection::add(int input)
|
||||
{
|
||||
PrimImplikant PI(input);
|
||||
PrimImplikant* PI = new PrimImplikant(input);
|
||||
PIVector.push_back(PI);
|
||||
}
|
||||
|
||||
bool PrimImplikantCollection::valueAt(int position)
|
||||
{
|
||||
for (vector<PrimImplikant>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
|
||||
if (i->valueAt(position))
|
||||
for (vector<PrimImplikant*>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
|
||||
if ((*i)->valueAt(position))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
vector<PrimImplikant> PrimImplikantCollection::primImplikantenAt(int position)
|
||||
PrimImplikantCollection PrimImplikantCollection::primImplikantenAt(int position)
|
||||
{
|
||||
vector<PrimImplikant> pic;
|
||||
for (vector<PrimImplikant>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
|
||||
if (i->valueAt(position))
|
||||
pic.push_back(*i);
|
||||
PrimImplikantCollection pic;
|
||||
for (vector<PrimImplikant*>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
|
||||
if ((*i)->valueAt(position))
|
||||
pic.add(*i);
|
||||
return pic;
|
||||
}
|
||||
|
||||
PrimImplikant PrimImplikantCollection::solveNextHazard()
|
||||
unsigned int PrimImplikantCollection::size()
|
||||
{
|
||||
PrimImplikant PI(0);
|
||||
return PI;
|
||||
return this->PIVector.size();
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
#ifndef PRIMIMPLIKANTCOLLEC
|
||||
#define PRIMIMPLIKANTCOLLEC
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "PrimImplikant.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef PRIMIMPLIKANTCOLLEC
|
||||
#define PRIMIMPLIKANTCOLLEC
|
||||
|
||||
class PrimImplikantCollection{
|
||||
public:
|
||||
void add(PrimImplikant &PI);
|
||||
void add(PrimImplikant* &PI);
|
||||
void add(string input);
|
||||
void add(int input);
|
||||
|
||||
bool valueAt(int position);
|
||||
vector<PrimImplikant> primImplikantenAt(int position);
|
||||
|
||||
PrimImplikant solveNextHazard();
|
||||
PrimImplikantCollection primImplikantenAt(int position);
|
||||
unsigned int size();
|
||||
void deleteAll();
|
||||
|
||||
private:
|
||||
vector<PrimImplikant> PIVector;
|
||||
vector<PrimImplikant*> PIVector;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue