SNAP Library 3.0, Developer Reference
2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Predicate - encapsulates comparison operations. More...
#include <table.h>
Public Member Functions | |
TPredicate () | |
Default constructor. More... | |
TPredicate (TPredicateNode *R) | |
Construct predicate with given root node R . More... | |
TPredicate (const TPredicate &Pred) | |
Copy constructor. More... | |
void | GetVariables (TStrV &Variables) |
Get variables in current predicate. More... | |
void | SetIntVal (TStr VarName, TInt VarVal) |
Set int variable value in the predicate or all the children that use it. More... | |
void | SetFltVal (TStr VarName, TFlt VarVal) |
Set flt variable value in the predicate or all the children that use it. More... | |
void | SetStrVal (TStr VarName, TStr VarVal) |
Set str variable value in the predicate or all the children that use it. More... | |
TBool | Eval () |
Return the result of evaluating current predicate. More... | |
TBool | EvalAtomicPredicate (const TAtomicPredicate &Atom) |
Evaluate the give atomic predicate. More... | |
Static Public Member Functions | |
template<class T > | |
static TBool | EvalAtom (T Val1, T Val2, TPredComp Cmp) |
Compare atomic values Val1 and Val2 using predicate Cmp. More... | |
static TBool | EvalStrAtom (const TStr &Val1, const TStr &Val2, TPredComp Cmp) |
Compare atomic string values Val1 and Val2 using predicate Cmp. More... | |
Protected Attributes | |
THash< TStr, TInt > | IntVars |
Int variables in the current predicate tree. More... | |
THash< TStr, TFlt > | FltVars |
Float variables in the current predicate tree. More... | |
THash< TStr, TStr > | StrVars |
String variables in the current predicate tree. More... | |
TPredicateNode * | Root |
Rood node of the current predicate tree. More... | |
|
inline |
Default constructor.
Definition at line 90 of file table.h.
|
inline |
Construct predicate with given root node R
.
Definition at line 92 of file table.h.
|
inline |
Copy constructor.
Definition at line 94 of file table.h.
TBool TPredicate::Eval | ( | ) |
Return the result of evaluating current predicate.
Definition at line 14 of file table.cpp.
References AND, Assert, TPredicateNode::Atom, EvalAtomicPredicate(), TPredicateNode::Left, NOP, NOT, TPredicateNode::Op, OR, TPredicateNode::Parent, TPredicateNode::Result, TPredicateNode::Right, and Root.
Referenced by TTable::Select().
Compare atomic values Val1 and Val2 using predicate Cmp.
Definition at line 110 of file table.h.
References EQ, GT, GTE, LT, LTE, and NEQ.
Referenced by TRowIterator::CompareAtomicConst(), TRowIteratorWithRemove::CompareAtomicConst(), and TTable::SelectAtomic().
TBool TPredicate::EvalAtomicPredicate | ( | const TAtomicPredicate & | Atom | ) |
Evaluate the give atomic predicate.
Definition at line 102 of file table.cpp.
References atFlt, atInt, atStr, TAtomicPredicate::Compare, TAtomicPredicate::FltConst, FltVars, THash< TKey, TDat, THashFunc >::GetDat(), TAtomicPredicate::IntConst, IntVars, TAtomicPredicate::IsConst, TAtomicPredicate::Lvar, TAtomicPredicate::Rvar, TAtomicPredicate::StrConst, StrVars, and TAtomicPredicate::Type.
Referenced by Eval().
|
inlinestatic |
Compare atomic string values Val1 and Val2 using predicate Cmp.
Definition at line 123 of file table.h.
References EQ, GT, GTE, TStr::IsStrIn(), LT, LTE, NEQ, SUBSTR, and SUPERSTR.
Referenced by TRowIterator::CompareAtomicConst(), TRowIteratorWithRemove::CompareAtomicConst(), TRowIterator::CompareAtomicConstTStr(), and TTable::SelectAtomic().
void TPredicate::GetVariables | ( | TStrV & | Variables | ) |
Get variables in current predicate.
Definition at line 10 of file table.cpp.
References TPredicateNode::GetVariables(), and Root.
Referenced by TTable::Select().
Set flt variable value in the predicate or all the children that use it.
Definition at line 100 of file table.h.
References THash< TKey, TDat, THashFunc >::AddDat(), and FltVars.
Referenced by TTable::Select().
Set int variable value in the predicate or all the children that use it.
Definition at line 98 of file table.h.
References THash< TKey, TDat, THashFunc >::AddDat(), and IntVars.
Referenced by TTable::Select().
Set str variable value in the predicate or all the children that use it.
Definition at line 102 of file table.h.
References THash< TKey, TDat, THashFunc >::AddDat(), and StrVars.
Referenced by TTable::Select().
Float variables in the current predicate tree.
Definition at line 85 of file table.h.
Referenced by EvalAtomicPredicate(), and SetFltVal().
Int variables in the current predicate tree.
Definition at line 84 of file table.h.
Referenced by EvalAtomicPredicate(), and SetIntVal().
|
protected |
Rood node of the current predicate tree.
Definition at line 87 of file table.h.
Referenced by Eval(), and GetVariables().
String variables in the current predicate tree.
Definition at line 86 of file table.h.
Referenced by EvalAtomicPredicate(), and SetStrVal().