MADARA  3.1.8
madara::expression::CompositeSequentialNode Class Reference

A composite node that evaluates both left and right expressions regardless of their evaluations. More...

#include <CompositeSequentialNode.h>

Inheritance diagram for madara::expression::CompositeSequentialNode:
Collaboration diagram for madara::expression::CompositeSequentialNode:

Public Member Functions

 CompositeSequentialNode (logger::Logger &logger, const ComponentNodes &nodes)
 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 node. 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

logger::Loggerlogger_
 handle the context More...
 
ComponentNodes nodes_
 

Detailed Description

A composite node that evaluates both left and right expressions regardless of their evaluations.

Definition at line 23 of file CompositeSequentialNode.h.

Constructor & Destructor Documentation

madara::expression::CompositeSequentialNode::CompositeSequentialNode ( logger::Logger logger,
const ComponentNodes nodes 
)

Constructor.

Parameters
loggerthe logger to use for printing
nodes2+ nodes to be executed in sequence

Definition at line 16 of file CompositeSequentialNode.cpp.

Member Function Documentation

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

Accepts a visitor subclassed from the Visitor class.

Parameters
visitorvisitor instance to use

Reimplemented from madara::expression::CompositeTernaryNode.

Definition at line 82 of file CompositeSequentialNode.cpp.

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

Evaluates the node.

Evaluates the node and its children.

Parameters
settingssettings for evaluating the node
Returns
the maximum of the value returned by the left and right expressions

This does not prune any of the expression tree, and is much faster than the prune function @ returns maximum value of the left and right evaluations

Implements madara::expression::CompositeTernaryNode.

Definition at line 62 of file CompositeSequentialNode.cpp.

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

Returns the printable character of the node.

Returns
value of the node

Reimplemented from madara::expression::CompositeTernaryNode.

Definition at line 23 of file CompositeSequentialNode.cpp.

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

Returns the left expression.

Returns
a pointer to the left expression

Reimplemented in madara::expression::CompositeBinaryNode.

Definition at line 34 of file ComponentNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::CompositeSequentialNode::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
the maximum of the value returned by the left and right expressions

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::CompositeTernaryNode.

Definition at line 32 of file CompositeSequentialNode.cpp.

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

Returns the right expression.

Returns
a pointer to the right expression

Reimplemented in madara::expression::CompositeUnaryNode.

Definition at line 41 of file ComponentNode.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

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

handle the context

Definition at line 96 of file ComponentNode.h.

ComponentNodes madara::expression::CompositeTernaryNode::nodes_
protectedinherited

Definition at line 76 of file CompositeTernaryNode.h.


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