Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

ElementModeler Class Reference

Element modeling class. More...

#include <elementmodel.h>

List of all members.

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.


Detailed Description

Element modeling class.

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.


Constructor & Destructor Documentation

ElementModeler::ElementModeler (  XmlChar *    name ) 
 

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.

ElementModeler::~ElementModeler (  void    )  [virtual]
 

A destructor.

Does nothing.

Definition at line 237 of file elementmodel.cpp.


Member Function Documentation

void ElementModeler::computeAverageEntropy (  void    )  [virtual]
 

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.

ElementModel::NodeType ElementModeler::currentNodeType (  void    )  [virtual]
 

Get the type of the current node.

Returns the type of the current node in the element model.

Returns:
The type fo the node.

Definition at line 538 of file elementmodel.cpp.

References currentNode, and ElementModel::Node::type.

Referenced by XmlAdaptiveModel::receiveData.

ElementModel::NodeType ElementModeler::followEdge (  size_t    edgeId,
ElementModel::Node **    node,
SAXEmitter *    saxEmitter,
void *    userData
)  [virtual]
 

Follow the given edge.

Move forward along the given edge.

Parameters:
edgeId  The id of the edge.
node  Current node (output variable).
saxEmitter  Pointer to the sax emitter.
userData  Pointer to the user data structure.
Returns:
The type of the new current node.

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.

double ElementModeler::getAverageEntropy (  void    )  [virtual]
 

Get the average entropy of the model.

Returns 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.

ElementModel::Node * ElementModeler::getCurrentNode (  void    )  [virtual]
 

Get the node from the node stack.

Returns the pointer to the current node.

Returns:
The pointer to current node.

Definition at line 293 of file elementmodel.cpp.

References currentNode.

Referenced by XmlAdaptiveModel::receiveData.

XmlChar * ElementModeler::getElementName (  void    )  [virtual]
 

Get the name of the element.

Returns the name the element modeled.

Returns:
The name of the element.

Definition at line 620 of file elementmodel.cpp.

References elementName, and XmlChar.

Referenced by XmlAdaptiveModel::receiveData.

ElementModel::Node * ElementModeler::getEndNode (  void    )  [virtual]
 

Get the end node of the model.

Returns a pointer to the end node of the element model.

Returns:
The pointer to the end node.

Definition at line 608 of file elementmodel.cpp.

References endNode.

Referenced by ElementModelEntropyCalculator::calculate.

size_t ElementModeler::getRefCount (  void    )  [virtual]
 

Get the reference count.

Returns the actual reference count of the model.

Returns:
The reference count.

Definition at line 640 of file elementmodel.cpp.

References refCount.

Referenced by XmlAdaptiveModel::~XmlAdaptiveModel.

ElementModel::Node * ElementModeler::getStartNode (  void    )  [virtual]
 

Get the start node of the model.

Returns a pointer to the start node of the element model.

Returns:
The pointer to the start node.

Definition at line 596 of file elementmodel.cpp.

References startNode.

Referenced by ElementModelEntropyCalculator::calculate.

bool ElementModeler::hasAttributes (  void    )  [virtual]
 

Test for attributes.

Returns the supposed attribute state of the element.

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.

void ElementModeler::increaseRefCount (  void    )  [virtual]
 

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.

ElementModel::NodeType ElementModeler::moveForward (  ElementModel::Node **    node,
SAXEmitter *    saxEmitter,
void *    userData
)  [virtual]
 

Follow the deterministic edge.

Move forward along the most probable edge.

Parameters:
node  Current node (output variable).
saxEmitter  Pointer to the sax emitter.
userData  Pointer to the user data structure.
Returns:
The type of the new current node.

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.

ElementModel::TransitionState ElementModeler::moveToDesiredNode (  ElementModel::NodeType    desiredNodeType,
size_t *    edgeId,
size_t *    elementPushes,
ElementModeler *    elementModeler = 0
)  [virtual]
 

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.

Parameters:
desiredNodeType  The type of the desired node.
edgeId  The id if the edge that is not most probable (output variable).
elementPushes  The number of pushes onto the node stack performed.
elementModeler  The pointer to the modeler of desired element (used only if desiredNode is of ElementNode type).
Return values:
ElementModel::Definite  Most probable edge was used.
ElementModel::Indefinite  An edge that is not the most probable one was used.
ElementModel::NewNodeCreated  New graph node has been created.

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.

void ElementModeler::popCurrentNode (  void    )  [virtual]
 

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.

void ElementModeler::print (  void    )  [virtual]
 

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.

void ElementModeler::printNode (  ElementModel::Node *    node )  [virtual]
 

Display one node of the graph.

Displays a textual representation of the given element graph node.

Parameters:
node  Pointer to the 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.

void ElementModeler::resetCurrentNode (  void    )  [virtual]
 

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.

bool ElementModeler::setAttributes (  bool    attributes )  [virtual]
 

Set the attribute flag.

Updates the attribute prediction counts.

Parameters:
attributes  Indication if the element has attributes, or not.
Returns:
The supposed attribute state before the update.

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.


The documentation for this class was generated from the following files:
Generated on Wed Feb 5 10:43:04 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002