SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TPredicateNode Class Reference

Predicate node - represents a binary predicate operation on two predicate nodes. More...

#include <table.h>

Collaboration diagram for TPredicateNode:

Public Member Functions

 TPredicateNode ()
 Default constructor. More...
 
 TPredicateNode (const TAtomicPredicate &A)
 Constructor for atomic predicate node (leaf) More...
 
 TPredicateNode (TPredOp Opr)
 Constructor for logical operation predicate node (internal node) More...
 
 TPredicateNode (const TPredicateNode &P)
 Copy constructor. More...
 
void AddLeftChild (TPredicateNode *Child)
 Add left child to this node. More...
 
void AddRightChild (TPredicateNode *Child)
 Add right child to this node. More...
 
void GetVariables (TStrV &Variables)
 Get variables in the predicate tree rooted at this node. More...
 

Public Attributes

TPredOp Op
 Logical op represented by this node. More...
 
TBool Result
 Result of evaulating the predicate rooted at this node. More...
 
TAtomicPredicate Atom
 Atomic predicate at this node. More...
 
TPredicateNodeParent
 Parent node of this node. More...
 
TPredicateNodeLeft
 Left child of this node. More...
 
TPredicateNodeRight
 

Friends

class TPredicate
 

Detailed Description

Predicate node - represents a binary predicate operation on two predicate nodes.

Definition at line 51 of file table.h.

Constructor & Destructor Documentation

TPredicateNode::TPredicateNode ( )
inline

Default constructor.

Definition at line 60 of file table.h.

60  : Op(NOP), Result(false), Atom(), Parent(NULL), Left(NULL),
61  Right(NULL) {}
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TBool Result
Result of evaulating the predicate rooted at this node.
Definition: table.h:54
TPredicateNode * Right
Definition: table.h:58
TPredOp Op
Logical op represented by this node.
Definition: table.h:53
Definition: table.h:5
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
TAtomicPredicate Atom
Atomic predicate at this node.
Definition: table.h:55
TPredicateNode::TPredicateNode ( const TAtomicPredicate A)
inline

Constructor for atomic predicate node (leaf)

Definition at line 63 of file table.h.

63  : Op(NOP), Result(false), Atom(A),
64  Parent(NULL), Left(NULL), Right(NULL) {}
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TBool Result
Result of evaulating the predicate rooted at this node.
Definition: table.h:54
TPredicateNode * Right
Definition: table.h:58
TPredOp Op
Logical op represented by this node.
Definition: table.h:53
Definition: table.h:5
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
TAtomicPredicate Atom
Atomic predicate at this node.
Definition: table.h:55
TPredicateNode::TPredicateNode ( TPredOp  Opr)
inline

Constructor for logical operation predicate node (internal node)

Definition at line 66 of file table.h.

66  : Op(Opr), Result(false), Atom(), Parent(NULL),
67  Left(NULL), Right(NULL) {}
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TBool Result
Result of evaulating the predicate rooted at this node.
Definition: table.h:54
TPredicateNode * Right
Definition: table.h:58
TPredOp Op
Logical op represented by this node.
Definition: table.h:53
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
TAtomicPredicate Atom
Atomic predicate at this node.
Definition: table.h:55
TPredicateNode::TPredicateNode ( const TPredicateNode P)
inline

Copy constructor.

Definition at line 69 of file table.h.

69  : Op(P.Op), Result(P.Result), Atom(P.Atom),
70  Parent(P.Parent), Left(P.Left), Right(P.Right) {}
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TBool Result
Result of evaulating the predicate rooted at this node.
Definition: table.h:54
TPredicateNode * Right
Definition: table.h:58
TPredOp Op
Logical op represented by this node.
Definition: table.h:53
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
TAtomicPredicate Atom
Atomic predicate at this node.
Definition: table.h:55

Member Function Documentation

void TPredicateNode::AddLeftChild ( TPredicateNode Child)
inline

Add left child to this node.

Definition at line 72 of file table.h.

References Left, and Parent.

72 { Left = Child; Child->Parent = this; }
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
void TPredicateNode::AddRightChild ( TPredicateNode Child)
inline

Add right child to this node.

Definition at line 74 of file table.h.

References Parent, and Right.

74 { Right = Child; Child->Parent = this; }
TPredicateNode * Right
Definition: table.h:58
TPredicateNode * Parent
Parent node of this node.
Definition: table.h:56
void TPredicateNode::GetVariables ( TStrV Variables)

Get variables in the predicate tree rooted at this node.

Definition at line 1 of file table.cpp.

References TVec< TVal, TSizeTy >::Add(), Atom, GetVariables(), Left, TAtomicPredicate::Lvar, NOP, Op, Right, and TAtomicPredicate::Rvar.

Referenced by GetVariables(), and TPredicate::GetVariables().

1  {
2  if (Left != NULL) { Left->GetVariables(Variables); }
3  if (Right != NULL) { Right->GetVariables(Variables); }
4  if (Op == NOP) {
5  if (Atom.Lvar != "" ) { Variables.Add(Atom.Lvar); }
6  if (Atom.Rvar != "" ) { Variables.Add(Atom.Rvar); }
7  }
8 }
TStr Rvar
Right variable of the comparison op.
Definition: table.h:21
TPredicateNode * Left
Left child of this node.
Definition: table.h:57
TStr Lvar
Left variable of the comparison op.
Definition: table.h:20
TPredicateNode * Right
Definition: table.h:58
TPredOp Op
Logical op represented by this node.
Definition: table.h:53
void GetVariables(TStrV &Variables)
Get variables in the predicate tree rooted at this node.
Definition: table.cpp:1
Definition: table.h:5
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TAtomicPredicate Atom
Atomic predicate at this node.
Definition: table.h:55

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TPredicate
friend

Definition at line 77 of file table.h.

Member Data Documentation

TAtomicPredicate TPredicateNode::Atom

Atomic predicate at this node.

Definition at line 55 of file table.h.

Referenced by TPredicate::Eval(), and GetVariables().

TPredicateNode* TPredicateNode::Left

Left child of this node.

Definition at line 57 of file table.h.

Referenced by AddLeftChild(), TPredicate::Eval(), and GetVariables().

TPredOp TPredicateNode::Op

Logical op represented by this node.

Definition at line 53 of file table.h.

Referenced by TPredicate::Eval(), and GetVariables().

TPredicateNode* TPredicateNode::Parent

Parent node of this node.

Definition at line 56 of file table.h.

Referenced by AddLeftChild(), AddRightChild(), and TPredicate::Eval().

TBool TPredicateNode::Result

Result of evaulating the predicate rooted at this node.

Definition at line 54 of file table.h.

Referenced by TPredicate::Eval().

TPredicateNode* TPredicateNode::Right

Right child of this node

Definition at line 58 of file table.h.

Referenced by AddRightChild(), TPredicate::Eval(), and GetVariables().


The documentation for this class was generated from the following files: