MADARA  3.1.8
madara::expression::CompositeLessThanEqualNode Class Reference

A composite node that compares left and right children for less than or equal to. More...

#include <CompositeLessThanEqualNode.h>

Inheritance diagram for madara::expression::CompositeLessThanEqualNode:
Collaboration diagram for madara::expression::CompositeLessThanEqualNode:

Public Member Functions

 CompositeLessThanEqualNode (logger::Logger &logger, ComponentNode *left, ComponentNode *right)
 Constructor. More...
 
virtual void accept (Visitor &visitor) const
 Accepts a visitor subclassed from the Visitor class. More...
 
virtual madara::knowledge::KnowledgeRecord evaluate (const madara::knowledge::KnowledgeUpdateSettings &settings)
 Evaluates the expression tree. More...
 
virtual madara::knowledge::KnowledgeRecord item (void) const
 Returns the printable character of the node. More...
 
virtual ComponentNodeleft (void) const
 Returns the left expression. More...
 
virtual madara::knowledge::KnowledgeRecord prune (bool &can_change)
 Prunes the expression tree of unnecessary nodes. More...
 
virtual ComponentNoderight (void) const
 Returns the right expression. More...
 
void set_logger (logger::Logger &logger)
 Sets the logger for printing errors and debugging info. More...
 

Protected Attributes

ComponentNodeleft_
 left expression More...
 
logger::Loggerlogger_
 handle the context More...
 
ComponentNoderight_
 Right expression. More...
 

Detailed Description

A composite node that compares left and right children for less than or equal to.

Definition at line 23 of file CompositeLessThanEqualNode.h.

Constructor & Destructor Documentation

madara::expression::CompositeLessThanEqualNode::CompositeLessThanEqualNode ( logger::Logger logger,
ComponentNode left,
ComponentNode right 
)

Constructor.

Parameters
loggerthe logger to use for printing
leftleft expression
rightright expression

Definition at line 19 of file CompositeLessThanEqualNode.cpp.

Member Function Documentation

void madara::expression::CompositeLessThanEqualNode::accept ( Visitor visitor) const
virtual

Accepts a visitor subclassed from the Visitor class.

Parameters
visitorvisitor instance to use

Reimplemented from madara::expression::ComponentNode.

Definition at line 97 of file CompositeLessThanEqualNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::CompositeLessThanEqualNode::evaluate ( const madara::knowledge::KnowledgeUpdateSettings settings)
virtual

Evaluates the expression tree.

Evaluates the node and its children.

Parameters
settingssettings for evaluating the node
Returns
0 if left expression greater than right expression and 1 otherwise

This does not prune any of the expression tree, and is much faster than the prune function

Implements madara::expression::ComponentNode.

Definition at line 87 of file CompositeLessThanEqualNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::CompositeLessThanEqualNode::item ( void  ) const
virtual

Returns the printable character of the node.

Returns
value of the node

Reimplemented from madara::expression::ComponentNode.

Definition at line 26 of file CompositeLessThanEqualNode.cpp.

madara::expression::ComponentNode * madara::expression::CompositeBinaryNode::left ( void  ) const
virtualinherited

Returns the left expression.

Returns
a pointer to the left expression

Reimplemented from madara::expression::ComponentNode.

Definition at line 27 of file CompositeBinaryNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::CompositeLessThanEqualNode::prune ( bool &  can_change)
virtual

Prunes the expression tree of unnecessary nodes.

Prune the tree of unnecessary nodes.

Parameters
can_changeset to true if variable nodes are contained
Returns
0 if left expression greater than right expression and 1 otherwise

Returns evaluation of the node and sets can_change appropriately. if this node can be changed, that means it shouldn't be pruned.

Implements madara::expression::ComponentNode.

Definition at line 38 of file CompositeLessThanEqualNode.cpp.

madara::expression::ComponentNode * madara::expression::CompositeUnaryNode::right ( void  ) const
virtualinherited

Returns the right expression.

Returns
a pointer to the right expression

Reimplemented from madara::expression::ComponentNode.

Definition at line 24 of file CompositeUnaryNode.cpp.

void madara::expression::ComponentNode::set_logger ( logger::Logger logger)
inherited

Sets the logger for printing errors and debugging info.

Parameters
loggerthe logger to use

Definition at line 53 of file ComponentNode.cpp.

Member Data Documentation

ComponentNode* madara::expression::CompositeBinaryNode::left_
protectedinherited

left expression

Definition at line 47 of file CompositeBinaryNode.h.

logger::Logger* madara::expression::ComponentNode::logger_
protectedinherited

handle the context

Definition at line 96 of file ComponentNode.h.

ComponentNode* madara::expression::CompositeUnaryNode::right_
protectedinherited

Right expression.

Definition at line 43 of file CompositeUnaryNode.h.


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