Skip to content

Commit

Permalink
Having constructors in parent classes was not working. The right cons…
Browse files Browse the repository at this point in the history
…tructor was not being called
  • Loading branch information
lambdafunction committed Sep 28, 2010
1 parent 5a893c1 commit c2dfe25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
32 changes: 11 additions & 21 deletions regex.cpp
Expand Up @@ -129,14 +129,6 @@ regexNode::~regexNode(){


/*********************** Unary Regex-Node **************************/
unaryRegexNode::unaryRegexNode(){
this->leftChild = new leafNode(NULLSET);
}

unaryRegexNode::unaryRegexNode(regexNode *newleftChild){
this->leftChild = newleftChild;
}

bool unaryRegexNode::setLeftChild(regexNode* newLeftChild){
delete leftChild;
leftChild = newLeftChild;
Expand Down Expand Up @@ -173,17 +165,6 @@ unaryRegexNode::~unaryRegexNode(){


/*********************** Binary Regex-Node **************************/
binaryRegexNode::binaryRegexNode(){
//cout<<"I am in binaryRegexNode constructor"<<endl;
this->leftChild = new leafNode(NULLSET);
this->rightChild = new leafNode(NULLSET);
}

binaryRegexNode::binaryRegexNode( regexNode * leftChild, regexNode * rightChild){
cout<<"I am in binaryRegexNode constructor"<<endl;
this->leftChild = leftChild;
this->rightChild = rightChild;
}

bool binaryRegexNode::setRightChild(regexNode* newRightChild){
delete rightChild;
Expand Down Expand Up @@ -284,6 +265,7 @@ regexNode* leafNode::simplify(){ //leaf nodes cannot be simplified more.

/*********************** Star Node **************************/
starNode::starNode(){
this->leftChild = new leafNode(NULLSET);
}

starNode::starNode(regexNode *newleftChild){
Expand Down Expand Up @@ -325,11 +307,15 @@ regexNode* starNode::simplify(){

/*********************** Union Node **************************/
unionNode::unionNode(){
// cout<<"I am in unionRegexNode constructor"<<endl;
cout<<"I am in unionRegexNode first constructor"<<endl;
this->leftChild = new leafNode(NULLSET);
this->rightChild = new leafNode(NULLSET);
}

unionNode::unionNode( regexNode * leftChild, regexNode * rightChild){
//cout<<"I am in unionRegexNode constructor"<<endl;
cout<<"I am in unionRegexNode second constructor"<<endl;
this->leftChild = leftChild;
this->rightChild = rightChild;
}

bool unionNode::isUnion(){
Expand Down Expand Up @@ -396,9 +382,13 @@ regexNode* unionNode::simplify(){
/*********************** Concatination Node **************************/

concatNode::concatNode(){
this->leftChild = new leafNode(NULLSET);
this->rightChild = new leafNode(NULLSET);
}

concatNode::concatNode(regexNode * leftChild, regexNode * rightChild){
this->leftChild = leftChild;
this->rightChild = rightChild;
}

bool concatNode::isConcat(){
Expand Down
4 changes: 0 additions & 4 deletions regex.h
Expand Up @@ -61,8 +61,6 @@ class unaryRegexNode: public regexNode{
regexNode* leftChild;

public:
unaryRegexNode();
unaryRegexNode(regexNode *);

bool setLeftChild(regexNode *);
regexNode * getLeftChild();
Expand All @@ -83,8 +81,6 @@ class binaryRegexNode: public unaryRegexNode{
regexNode* rightChild;

public:
binaryRegexNode();
binaryRegexNode( regexNode *, regexNode * );
bool setRightChild(regexNode *) ;
regexNode * getRightChild();
bool setChildren(regexNode* , regexNode* );
Expand Down

0 comments on commit c2dfe25

Please sign in to comment.