#include <elementmodel.h>
Public Methods | |
ElementModeler (XmlChar *name) | |
A constructor. More... | |
virtual | ~ElementModeler (void) |
A destructor. More... | |
virtual void | resetCurrentNode (void) |
Set the position to the start node. More... | |
virtual void | popCurrentNode (void) |
Pop the node from the node stack. More... | |
virtual ElementModel::Node * | getCurrentNode (void) |
Get the node from the node stack. More... | |
virtual ElementModel::TransitionState | moveToDesiredNode (ElementModel::NodeType desiredNodeType, size_t *edgeId, size_t *elementPushes, ElementModeler *elementModeler=0) |
Move to desired node. More... | |
virtual ElementModel::NodeType | moveForward (ElementModel::Node **node, SAXEmitter *saxEmitter, void *userData) |
Follow the deterministic edge. More... | |
virtual ElementModel::NodeType | followEdge (size_t edgeId, ElementModel::Node **node, SAXEmitter *saxEmitter, void *userData) |
Follow the given edge. More... | |
virtual ElementModel::NodeType | currentNodeType (void) |
Get the type of the current node. More... | |
virtual bool | setAttributes (bool attributes) |
Set the attribute flag. More... | |
virtual bool | hasAttributes (void) |
Test for attributes. More... | |
virtual ElementModel::Node * | getStartNode (void) |
Get the start node of the model. More... | |
virtual ElementModel::Node * | getEndNode (void) |
Get the end node of the model. More... | |
virtual XmlChar * | getElementName (void) |
Get the name of the element. More... | |
virtual void | increaseRefCount (void) |
Increase the reference count. More... | |
virtual size_t | getRefCount (void) |
Get the reference count. More... | |
virtual void | computeAverageEntropy (void) |
Compute the average entropy of the model. More... | |
virtual double | getAverageEntropy (void) |
Get the average entropy of the model. More... | |
virtual void | print (void) |
Display the graph of the element. More... | |
virtual void | printNode (ElementModel::Node *node) |
Display one node of the graph. More... | |
Protected Attributes | |
XmlChar * | elementName |
The name of the element. | |
ElementModel::AttributeNode * | startNode |
Pointer to the start node. | |
ElementModel::Node * | endNode |
Pointer to the end node. | |
ElementModel::Node * | currentNode |
Pointer to the current node. | |
ElementModel::NodeStack | nodeStack |
The stack of nodes. | |
size_t | nodeCounter |
The counter of nodes. | |
size_t | refCount |
The reference count of the model. | |
double | averageEntropy |
The average entropy of the model. | |
List< ElementModel::Node > | nodeList |
List of the nodes of the model. |
This class models one element of the XML document. It maintains the element graph structure and performs the update operations, as well as the motion in the graph.
Definition at line 169 of file elementmodel.h.
|
A constructor. An initialization is performed. Definition at line 216 of file elementmodel.cpp. References averageEntropy, CREATE_GRAPH_NODE, elementName, endNode, nodeCounter, nodeList, refCount, resetCurrentNode, Collection< ElementModel::Node >::setAutoDelete, startNode, and XmlChar. |
|
A destructor. Does nothing. Definition at line 237 of file elementmodel.cpp. |
|
Compute the average entropy of the model. Computes the average entropy of the model. Definition at line 245 of file elementmodel.cpp. References averageEntropy, and ElementModelEntropyCalculator::calculate. Referenced by XmlAdaptiveModel::~XmlAdaptiveModel. |
|
Get the type of the current node. Returns the type of the current node in the element model.
Definition at line 538 of file elementmodel.cpp. References currentNode, and ElementModel::Node::type. Referenced by XmlAdaptiveModel::receiveData. |
|
Follow the given edge. Move forward along the given edge.
Definition at line 488 of file elementmodel.cpp. References currentNode, elementName, SAXEmitter::endElement, ElementModel::Transition::id, INC_TRANSITION_FREQUENCY, ElementModel::Transition::node, nodeStack, ElementModel::Node::successors, and ElementModel::Node::type. Referenced by XmlAdaptiveModel::receiveData. |
|
Get the average entropy of the model. Returns the average entropy of the model.
Definition at line 255 of file elementmodel.cpp. References averageEntropy. Referenced by XmlAdaptiveModel::~XmlAdaptiveModel. |
|
Get the node from the node stack. Returns the pointer to the current node.
Definition at line 293 of file elementmodel.cpp. References currentNode. Referenced by XmlAdaptiveModel::receiveData. |
|
Get the name of the element. Returns the name the element modeled.
Definition at line 620 of file elementmodel.cpp. References elementName, and XmlChar. Referenced by XmlAdaptiveModel::receiveData. |
|
Get the end node of the model. Returns a pointer to the end node of the element model.
Definition at line 608 of file elementmodel.cpp. References endNode. Referenced by ElementModelEntropyCalculator::calculate. |
|
Get the reference count. Returns the actual reference count of the model.
Definition at line 640 of file elementmodel.cpp. References refCount. Referenced by XmlAdaptiveModel::~XmlAdaptiveModel. |
|
Get the start node of the model. Returns a pointer to the start node of the element model.
Definition at line 596 of file elementmodel.cpp. References startNode. Referenced by ElementModelEntropyCalculator::calculate. |
|
Test for attributes. Returns the supposed attribute state of the element.
Definition at line 582 of file elementmodel.cpp. References DBG, ElementModel::AttributeNode::hasAttr, ElementModel::AttributeNode::noAttrCnt, startNode, and ElementModel::AttributeNode::yesAttrCnt. Referenced by XmlAdaptiveModel::receiveData, and setAttributes. |
|
Increase the reference count. Increases the reference count of the model. Definition at line 629 of file elementmodel.cpp. References refCount. Referenced by XmlAdaptiveModel::manageEvent, and XmlAdaptiveModel::receiveData. |
|
Follow the deterministic edge. Move forward along the most probable edge.
Definition at line 442 of file elementmodel.cpp. References currentNode, elementName, SAXEmitter::endElement, INC_TRANSITION_FREQUENCY, ElementModel::Node::mpt, nodeStack, and ElementModel::Node::type. Referenced by XmlAdaptiveModel::receiveData. |
|
Move to desired node. The modeler attemps to move to the desired node from the current node. If the desired node doesn't exist, a new node is created. If the desired node exists and the most probable edge leads to it, the modeler moves along this edge. If an edge that is not the most probable leads to the desired node, the id of the edge is returned.
Definition at line 312 of file elementmodel.cpp. References CREATE_GRAPH_NODE, CREATE_GRAPH_TRANSITION, currentNode, endNode, FIND_TRANSITION, ElementModel::Transition::id, ElementModel::Node::mpt, ElementModel::Transition::node, and nodeStack. Referenced by XmlAdaptiveModel::manageEvent, and XmlAdaptiveModel::receiveData. |
|
Pop the node from the node stack. Pops the node (if there is any) from the node stack and sets currentNode to it. Definition at line 274 of file elementmodel.cpp. References currentNode, DBG, nodeStack, and ElementModel::Node::type. Referenced by XmlAdaptiveModel::manageEvent, and XmlAdaptiveModel::receiveData. |
|
Display the graph of the element. Displays a textual representation of the element graph. Definition at line 650 of file elementmodel.cpp. References averageEntropy, elementName, endNode, ElementModel::AttributeNode::noAttrCnt, OUTPUTEENDLINE, OUTPUTENL, printNode, refCount, startNode, and ElementModel::AttributeNode::yesAttrCnt. Referenced by XmlAdaptiveModel::~XmlAdaptiveModel. |
|
Display one node of the graph. Displays a textual representation of the given element graph node.
Definition at line 677 of file elementmodel.cpp. References currentNode, elementName, ElementModel::Transition::frequency, ElementModel::Node::id, ElementModel::Node::modeler, ElementModel::Node::mpt, ElementModel::Transition::node, OUTPUTE, OUTPUTEENDLINE, STR_NODE_TYPE_CHARACTERS_NODE, STR_NODE_TYPE_ELEMENT_NODE, STR_NODE_TYPE_END_NODE, STR_NODE_TYPE_START_NODE, ElementModel::Node::successors, and ElementModel::Node::type. Referenced by print. |
|
Set the position to the start node. Sets currentNode to point to startNode. Definition at line 264 of file elementmodel.cpp. References currentNode, and startNode. Referenced by ElementModeler, XmlAdaptiveModel::manageEvent, and XmlAdaptiveModel::receiveData. |
|
Set the attribute flag. Updates the attribute prediction counts.
Definition at line 554 of file elementmodel.cpp. References ElementModel::AttributeNode::hasAttr, hasAttributes, ElementModel::AttributeNode::noAttrCnt, startNode, and ElementModel::AttributeNode::yesAttrCnt. Referenced by XmlAdaptiveModel::manageEvent, and XmlAdaptiveModel::receiveData. |