3 #ifndef _COMPOSITE_BOTH_NODE_CPP 4 #define _COMPOSITE_BOTH_NODE_CPP 6 #ifndef _MADARA_NO_KARL_ 39 for (ComponentNodes::iterator i =
nodes_.begin ();
40 i !=
nodes_.end (); ++i, ++j)
42 bool value_changes =
false;
44 value = (*i)->prune (value_changes);
45 if (!value_changes && dynamic_cast <LeafNode *> (*i) == 0)
51 if (j == 0 || value > return_value)
54 can_change = can_change || value_changes;
70 for (ComponentNodes::iterator i =
nodes_.begin ();
71 i !=
nodes_.end (); ++i, ++j)
75 if (j == 0 || value > return_value)
86 visitor.
visit (*
this);
89 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
CompositeBothNode(logger::Logger &logger, const ComponentNodes &nodes)
Constructor.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
madara::knowledge::KnowledgeRecord KnowledgeRecord
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the composite node.
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
logger::Logger * logger_
handle the context
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the printable character of the node.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
Provides knowledge logging services to files and terminals.
A multi-threaded logger for logging to one or more destinations.
Abstract base class for all visitors to all classes that derive from ComponentNode.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
Copyright (c) 2015 Carnegie Mellon University.