ddc
Public Member Functions | Public Attributes | List of all members
CQSeq Class Reference

#include <Query.h>

Inheritance diagram for CQSeq:
Inheritance graph
[legend]
Collaboration diagram for CQSeq:
Collaboration graph
[legend]

Public Member Functions

 CQSeq (const vector< CQToken *> &items, const vector< BYTE > &dists, const vector< BYTE > &distops)
 literal constructor (unused) More...
 
 CQSeq (CQToken *item)
 constructor for atomic (1-token) sequences More...
 
virtual ~CQSeq ()
 destructor deletes all child nodes in m_Items More...
 
virtual BYTE GetMatchId () const
 get match-id: later nonzero matchid-items clobber earlier ones More...
 
virtual BYTE SetMatchId (BYTE matchId)
 Set match-id, returns new value; override propagates matchId to daughters. More...
 
virtual void ClearNode ()
 ClearNode() clears associated m_Node's pointer vector to avoid double-free. More...
 
virtual void Clear (bool deep=true)
 clear query contents. if deep is true, propagates operation to daughters More...
 
void Append (CQToken *nextItem, BYTE nextDist=0, BYTE nextDistOp='<')
 
virtual bool Compile (CQueryCompiler *compiler)
 Compile() method implicitly compiles daughter nodes. More...
 
virtual ddcObjectList Children () const
 
virtual void DisownChildren ()
 
virtual string toString ()
 DEBUG: return a canonical string form for this query (default just returns m_Label) More...
 
virtual string jsonClass ()
 
virtual string jsonData ()
 
- Public Member Functions inherited from CQAtomic
 CQAtomic (const string &label=string(""), bool negated=false)
 Default constructor. More...
 
virtual ~CQAtomic ()
 
- Public Member Functions inherited from CQNegatable
 CQNegatable (const string &label=string(""), bool negated=false)
 Default constructor. More...
 
 CQNegatable (bool negated)
 
virtual ~CQNegatable ()
 
virtual bool Negate (void)
 toggle negation flag; returns new value More...
 
virtual bool Negated ()
 override returns current value of m_Negated More...
 
virtual string NegString (const std::string &s)
 string creation utility More...
 
- Public Member Functions inherited from CQuery
 CQuery (const string &label=string(""))
 Default constructor. More...
 
virtual ~CQuery (void)
 
virtual bool CheckSatisfiable (CQueryCompiler *compiler)
 
virtual bool CompileOptions (CQueryCompiler *compiler=NULL)
 
virtual void Evaluate ()
 
virtual bool HasMatchId () const
 Returns true iff this query uses a nontrival match-id operator; default checks (this->GetMatchId() != 0) More...
 
virtual bool RootOK ()
 Is this query an admissible root of a compiled parse tree (default returns !this->Negated()) More...
 
virtual string optionsToString ()
 DEBUG: return canonical option string More...
 
virtual string optionsToJson ()
 return json format option string More...
 
virtual string toJson ()
 
void SetCompiler (CQueryCompiler *compiler)
 
virtual void ClearOptions ()
 deletes m_Options if non-NULL More...
 
virtual void SetOptions (CQueryOptions *opts)
 set global query options ; deletes any pre-existing m_Options More...
 
- Public Member Functions inherited from ddcObject
 ddcObject ()
 Default constructor. More...
 
virtual ~ddcObject ()
 virtual destructor does nothing More...
 
template<typename Visit >
ddcObjectTraverse (Visit &visit)
 
template<typename Visit >
ddcObjectTraverse (Visit &visit) const
 
template<typename Visit >
ddcObjectTraverseR (Visit &visit)
 
template<typename Visit >
ddcObjectTraverseR (Visit &visit) const
 
virtual ddcObjectList Descendants () const
 

Public Attributes

vector< CQToken * > m_Items
 items to be queried (must be token nodes) More...
 
vector< BYTEm_Dists
 distances between items More...
 
vector< BYTEm_DistOps
 distance constraint relations More...
 
- Public Attributes inherited from CQNegatable
bool m_Negated
 whether this query is negated More...
 
- Public Attributes inherited from CQuery
string m_Label
 arbitrary name for this query node (e.g. string from which it was parsed) More...
 
CQueryCompilerm_Compiler
 associated query compiler (only set on Compile()) More...
 
CQueryNodem_Node
 underlying CQueryNode (DDC-v1.x API) More...
 
CQueryOptionsm_Options
 root-level options (root queries only) More...
 
- Public Attributes inherited from ddcObject
void * m_User
 user data associated with this object (for use e.g. by perl wrappers) More...
 

Detailed Description

sequence query (e.g. "a #1 b #1 c") This class holds a sequence of nodes of type CQToken (slot m_Items). Distance constraints: between m_Items[i] and m_Items[i+1] must be

Constructor & Destructor Documentation

◆ CQSeq() [1/2]

CQSeq::CQSeq ( const vector< CQToken *> &  items,
const vector< BYTE > &  dists,
const vector< BYTE > &  distops 
)
inline

literal constructor (unused)

◆ CQSeq() [2/2]

CQSeq::CQSeq ( CQToken item)
inline

constructor for atomic (1-token) sequences

References CQuery::Children(), CQuery::Clear(), CQuery::ClearNode(), CQuery::Compile(), CQuery::DisownChildren(), CQuery::GetMatchId(), CQuery::SetMatchId(), and CQuery::toString().

Here is the call graph for this function:

◆ ~CQSeq()

CQSeq::~CQSeq ( )
virtual

destructor deletes all child nodes in m_Items

References CQuery::Clear().

Here is the call graph for this function:

Member Function Documentation

◆ GetMatchId()

BYTE CQSeq::GetMatchId ( ) const
virtual

get match-id: later nonzero matchid-items clobber earlier ones

Reimplemented from CQuery.

◆ SetMatchId()

BYTE CQSeq::SetMatchId ( BYTE  matchId)
virtual

Set match-id, returns new value; override propagates matchId to daughters.

Reimplemented from CQuery.

◆ ClearNode()

void CQSeq::ClearNode ( )
virtual

ClearNode() clears associated m_Node's pointer vector to avoid double-free.

Reimplemented from CQuery.

References CQuery::m_Node.

◆ Clear()

void CQSeq::Clear ( bool  deep = true)
virtual

clear query contents. if deep is true, propagates operation to daughters

Reimplemented from CQuery.

References CQuery::ClearNode(), and CQuery::ClearOptions().

Here is the call graph for this function:

◆ Append()

void CQSeq::Append ( CQToken nextItem,
BYTE  nextDist = 0,
BYTE  nextDistOp = '<' 
)

append another (item,distance) pair onto this sequence nextDist is ignored if this is the first item in the sequence

◆ Compile()

bool CQSeq::Compile ( CQueryCompiler compiler)
virtual

Compile() method implicitly compiles daughter nodes.

Reimplemented from CQNegatable.

References CQuery::Compile(), CQNegatable::Compile(), CQuerySequenceNode::Create(), errParseError, CQuery::m_Node, CQueryCompiler::m_pHolder, MaxDistanceForNear, CQuery::SetCompiler(), and CQuery::toString().

Here is the call graph for this function:

◆ Children()

ddcObjectList CQSeq::Children ( ) const
virtual

get a list of direct non-NULL CQuery direct daughters of this node

  • default just returns an empty list

Reimplemented from CQuery.

References CQuery::Children().

Here is the call graph for this function:

◆ DisownChildren()

void CQSeq::DisownChildren ( )
virtual

"disown" any direct child nodes, preventing their destruction if the current object is deleted

  • default implementation does nothing

Reimplemented from CQuery.

References CQuery::DisownChildren().

Here is the call graph for this function:

◆ toString()

string CQSeq::toString ( void  )
virtual

DEBUG: return a canonical string form for this query (default just returns m_Label)

Reimplemented from CQuery.

References Format().

Here is the call graph for this function:

◆ jsonClass()

virtual string CQSeq::jsonClass ( void  )
inlinevirtual

class-name for json strinfication

  • default implementation returns C++ class name

Reimplemented from CQAtomic.

References CQuery::jsonData().

Here is the call graph for this function:

◆ jsonData()

string CQSeq::jsonData ( void  )
virtual

instance data for json stringification

  • default implementation returns "NODATA":1, for strict syntax compliance

Reimplemented from CQNegatable.

References jsonArray(), and CQNegatable::jsonData().

Here is the call graph for this function:

Member Data Documentation

◆ m_Items

vector<CQToken*> CQSeq::m_Items

items to be queried (must be token nodes)

◆ m_Dists

vector<BYTE> CQSeq::m_Dists

distances between items

◆ m_DistOps

vector<BYTE> CQSeq::m_DistOps

distance constraint relations


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