ProjectionDFAState Class Reference

Represents a single state of the ProjectionDFA. More...

#include <projectiondfastate.h>

Collaboration diagram for ProjectionDFAState:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProjectionDFAState (ProjectionTree *_pt, PassiveProjectionTree *_ppt)
 Constructor.
 ProjectionDFAState (ProjectionDFAState *_parent, PassiveProjectionTreeConfiguration *_pconf)
 Constructor.
 ProjectionDFAState (ProjectionDFAState *_parent, TokenConfiguration *_config, PassiveProjectionTreeConfiguration *_pconfig)
 Constructor.
virtual ~ProjectionDFAState ()
void update ()
 Brings several member variables of this class up to date.
void print (OutputStream &dos)
 Debug prints the projection DFA state.
TokenConfigurationgetTokenConfiguration ()
 Returns the token configuration associated with this state.
PassiveProjectionTreeConfigurationgetPassiveProjectionTreeConfiguration ()
 Returns the passive token configuration associated with this state.
vector< unsigned > * getCumulativeRoles ()
 Returns the cumulative roles associated with this state.
vector< unsigned > * getNonCumulativeRoles ()
 Returns the non-cumulative roles associated with this state.
bool isOutput ()
 Returns true if the state forces to keep the subtree of matching input document nodes.
bool isRoot ()
 Checks for this state being the root state.
ProjectionDFAStatetraceBack ()
 Returns the predecessor state of the current state.
ProjectionDFAStatetakeTransition (TAG t, short &t_type)
 Returns the state reached through the transition defined for tag t.
ProjectionDFAStatetakeTextTransition ()
 Returns the state reached through the text transition.
bool keepNode ()
 Checks for the state to force keeping matching input document nodes.
bool keepSubtree ()
 Returns true if the state forces to keep the subtree of matching input document nodes and there will (for sure) no roles be assigned to descendant nodes.
bool skipSubtree ()
 Checks if the state allows to discard the subtree of matching input document nodes.
void print (OutputStream &dos, unsigned indents, bool is_text=false)
 Help method for method print().

Private Member Functions

void computeTransition (TAG t)
 Sets up the transition for tag t.

Private Attributes

ProjectionDFAStateparent
 Pointer to the parent (=predecessor) state.
TokenConfigurationconfig
 The TokenConfiguration associated with this state.
PassiveProjectionTreeConfigurationpconfig
 The configuration of the passive projection tree.
ProjectionDFATransitions transitions
 Stores the set of (currently computed) transitions into follow-up states.
bool keep_node
 True if the state forces to keep matching input document nodes.
bool keep_subtree
 True if the state forces to keep the subtree of matching input document nodes.
bool is_output
 True if the state describes an output state.
bool skip_subtree
 Returns true if the state forces to skip the subtree of matching input document nodes.
vector< Role * > roles
 Contains roles associated with matching document nodes.
vector< unsigned > role_counts
 Contains role counts for the roles specified in member roles.
vector< unsigned > cumulative_roles
 The cumulative roles associated with this state.
vector< unsigned > non_cumulative_roles
 The non-cumulative roles associated with this state.


Detailed Description

Represents a single state of the ProjectionDFA.

A ProjectionDFAState basically stores role information and a set of transitions into other states. It is matched by the StreamTracker against the input stream, in order to decide whether incoming tokens are appended to the buffer (including the associated roles) or projected away.

Note:
Note that this DFA is tree-shaped, i.e. there is always a parent state (which is NULL for the root, of course).
Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 59 of file projectiondfastate.h.


Constructor & Destructor Documentation

ProjectionDFAState::ProjectionDFAState ( ProjectionTree _pt,
PassiveProjectionTree _ppt 
)

Constructor.

Constructor for the root node.

Constructor - creating object for a ProjectionDFAState object associated to the root node of the input ProjectionDFAState object.

Parameters:
[in] _pt The Projection tree. It forms the basis for the construction of new ProjectionDFAState objects.
[in] _ppt Pointer to the PassiveProjectionTree object.

Definition at line 38 of file projectiondfastate.cpp.

References update().

ProjectionDFAState::ProjectionDFAState ( ProjectionDFAState _parent,
PassiveProjectionTreeConfiguration _pconf 
)

Constructor.

Constructor - creating object for a ProjectionDFAState. This constructor is typically used for TEXT-states without roles (i.e. such induced by output nodes), which have no further outgoing transitions.

Parameters:
[in] _parent Pointer to the parent ProjectionDFAState.
[in] _pconf Pointer to the PassiveProjectionTreeConfiguration object.

Definition at line 48 of file projectiondfastate.cpp.

ProjectionDFAState::ProjectionDFAState ( ProjectionDFAState _parent,
TokenConfiguration _config,
PassiveProjectionTreeConfiguration _pconfig 
)

Constructor.

constructor for non-root nodes

Constructor - creating object for a ProjectionDFAState associated with the passed token configuration.

Parameters:
[in] _parent Pointer to the parent state.
[in] _config The configuration of the new state (must be calculated).
[in] _pconfig Pointer to the passive projection tree configuration.

Definition at line 53 of file projectiondfastate.cpp.

References update().

ProjectionDFAState::~ProjectionDFAState (  )  [virtual]

Destructor.

Definition at line 58 of file projectiondfastate.cpp.

References config, and pconfig.


Member Function Documentation

void ProjectionDFAState::computeTransition ( TAG  t  )  [private]

Sets up the transition for tag t.

The transition is stored in transitions member variable.

Parameters:
[in] t The tag for which the transition is to be calculated.
Return values:
void 

Definition at line 155 of file projectiondfastate.cpp.

References ProjectionDFATransitions::computeTransition(), and transitions.

Referenced by takeTransition().

vector< unsigned > * ProjectionDFAState::getCumulativeRoles (  )  [inline]

Returns the cumulative roles associated with this state.

The associated member is computed through the update() method.

Return values:
vector<unsigned>* Pointer to the cumulative role vector.

Definition at line 137 of file projectiondfastate.h.

References cumulative_roles.

Referenced by Buffer::Buffer(), StreamTracker::processBachelorTag(), StreamTracker::processOpeningTag(), and StreamTracker::processPCData().

vector< unsigned > * ProjectionDFAState::getNonCumulativeRoles (  )  [inline]

Returns the non-cumulative roles associated with this state.

The associated member is computed through the update() method.

Return values:
vector<unsigned>* Pointer to the non-cumulative role vector.

Definition at line 146 of file projectiondfastate.h.

References non_cumulative_roles.

Referenced by Buffer::Buffer(), StreamTracker::processBachelorTag(), StreamTracker::processOpeningTag(), and StreamTracker::processPCData().

PassiveProjectionTreeConfiguration * ProjectionDFAState::getPassiveProjectionTreeConfiguration (  )  [inline]

Returns the passive token configuration associated with this state.

The PassiveProjectionTreeConfiguration is used to capture .

Return values:
PassiveProjectionTreeConfiguration* Pointer to the PassiveProjectionTreeConfiguration object associated with this object.

Definition at line 128 of file projectiondfastate.h.

References pconfig.

Referenced by ProjectionDFATransitions::computeTextTransition(), and ProjectionDFATransitions::computeTransition().

TokenConfiguration * ProjectionDFAState::getTokenConfiguration (  )  [inline]

Returns the token configuration associated with this state.

The TokenConfiguration specifies states in the ProjectionTree that are "matched" by this projection DFA state.

Return values:
TokenConfiguration* The associated token configuration.

Definition at line 119 of file projectiondfastate.h.

References config.

Referenced by ProjectionDFATransitions::computeTextTransition(), ProjectionDFATransitions::computeTransition(), and update().

bool ProjectionDFAState::isOutput (  )  [inline]

Returns true if the state forces to keep the subtree of matching input document nodes.

The associated member is computed through the update() method.

Return values:
bool True if the state forces to keep the subtree of matching input document nodes, false otherwise.

Definition at line 157 of file projectiondfastate.h.

References is_output.

Referenced by ProjectionDFATransitions::computeTextTransition(), and update().

bool ProjectionDFAState::isRoot (  )  [inline]

Checks for this state being the root state.

The root state of the ProjectionDFAState corresponds to the virtual document root of the XML document.

Return values:
bool True if the object represents the root state, false otherwise.

Definition at line 167 of file projectiondfastate.h.

References parent.

Referenced by takeTextTransition().

bool ProjectionDFAState::keepNode (  )  [inline]

Checks for the state to force keeping matching input document nodes.

The associated member keep_node is computed through the update() method and cannot be used before having called this method.

Return values:
bool True if matching input document nodes must be kept, false if they can be safely discarded.

Definition at line 210 of file projectiondfastate.h.

References keep_node.

Referenced by StreamTracker::processBachelorTag(), StreamTracker::processClosingTag(), and StreamTracker::processOpeningTag().

bool ProjectionDFAState::keepSubtree (  )  [inline]

Returns true if the state forces to keep the subtree of matching input document nodes and there will (for sure) no roles be assigned to descendant nodes.

The associated member is computed through the update() method.

Return values:
bool True if the subtree is to be kept without any role information, false otherwise.

Definition at line 222 of file projectiondfastate.h.

References keep_subtree.

void ProjectionDFAState::print ( OutputStream dos,
unsigned  indents,
bool  is_text = false 
)

Help method for method print().

Help method for method print(), used for pretty printing.

Parameters:
[in] dos Reference to the (debug) OutputStream.
[in] indents The number of indents to be printed (pretty printing).
[in] is_text True if the current state is a text state.
Return values:
void 

Definition at line 124 of file projectiondfastate.cpp.

References config, keep_node, keep_subtree, NEWLINE, ProjectionDFATransitions::print(), TokenConfiguration::print(), role_counts, roles, skip_subtree, and transitions.

void ProjectionDFAState::print ( OutputStream dos  ) 

Debug prints the projection DFA state.

Used for debugging purpose only.

Parameters:
[in] dos Reference to the (debug) OutputStream.
Return values:
void 

Definition at line 93 of file projectiondfastate.cpp.

Referenced by ProjectionDFATransitions::print(), and ProjectionDFA::print().

bool ProjectionDFAState::skipSubtree (  )  [inline]

Checks if the state allows to discard the subtree of matching input document nodes.

The associated member is computed through the update() method.

Return values:
bool True if the state allows to discard the subtree of matching input document nodes, false otherwise.

Definition at line 233 of file projectiondfastate.h.

References skip_subtree.

ProjectionDFAState * ProjectionDFAState::takeTextTransition (  ) 

Returns the state reached through the text transition.

Returns NULL if there is no text transition defined.

Return values:
ProjectionDFAState* The state reached through the text transition.

Definition at line 120 of file projectiondfastate.cpp.

References isRoot(), ProjectionDFATransitions::takeTextTransition(), and transitions.

Referenced by StreamTracker::processPCData().

ProjectionDFAState * ProjectionDFAState::takeTransition ( TAG  t,
short &  t_type 
)

Returns the state reached through the transition defined for tag t.

May return NULL is the transition is not defined. The second parameter t_type is also set by the method, see the parameter description for more information.

Parameters:
[in] t The tag for which the transition is searched for.
[in] t_type The transition argument must be provided and is set by this method. It will take one of the followin values: TRANSITION_KEEP_SUBTREE means that, for tag t, the whole subtree must be remembered; TRANSITION_SKIP_SUBTREE means that, for tag t, the whole substree must be skipped; TRANSITION_REGULAR means that, for tag t, there is a regular transition into the state that is passed as return value).
Return values:
ProjectionDFAState* The state reached through the transition defined for tag t.

Definition at line 97 of file projectiondfastate.cpp.

References computeTransition(), keep_subtree, skip_subtree, ProjectionDFATransitions::takeTransition(), TRANSITION_KEEP_SUBTREE, TRANSITION_SKIP_SUBTREE, TRANSITION_UNKNOWN, and transitions.

Referenced by StreamTracker::processBachelorTag(), and StreamTracker::processOpeningTag().

ProjectionDFAState * ProjectionDFAState::traceBack (  )  [inline]

Returns the predecessor state of the current state.

The ProjectionDFA is tree-shaped, so each state has exactly one predecessor, i.e. its parent. Note that the predecessor may also be NULL (for the inital state).

Return values:
ProjectionDFAState* Returns the predecessor state.

Definition at line 177 of file projectiondfastate.h.

References parent.

Referenced by StreamTracker::processBachelorTag(), and StreamTracker::processClosingTag().

void ProjectionDFAState::update (  ) 

Brings several member variables of this class up to date.

The following member variables are updated: keep_node, keep_subtree, skip_subtree, cumulative_roles, and non_cumulative roles.

Return values:
void 

Definition at line 63 of file projectiondfastate.cpp.

References config, TokenConfiguration::createRoleList(), cumulative_roles, TokenConfiguration::forceChildKeep(), getTokenConfiguration(), PassiveProjectionTreeConfiguration::hasActiveNodes(), TokenConfiguration::hasActiveToken(), is_output, TokenConfiguration::isOutput(), isOutput(), keep_node, keep_subtree, TokenConfiguration::keepSubtree(), non_cumulative_roles, parent, pconfig, role_counts, roles, skip_subtree, and TokenConfiguration::skipSubtree().

Referenced by ProjectionDFAState().


Member Data Documentation

The TokenConfiguration associated with this state.

The TokenConfiguration object stores the position of all tokens that are currently placed placed in the associated ProjectionTree. Intuitively, these tokens identify the states in the ProjectionTree that are associated with this projection DFA state.

Definition at line 268 of file projectiondfastate.h.

Referenced by getTokenConfiguration(), print(), update(), and ~ProjectionDFAState().

vector< unsigned > ProjectionDFAState::cumulative_roles [private]

The cumulative roles associated with this state.

The associated member is computed through the update() method. The same information is also stored in the members roles and role_counts. This guy is for fast access only.

Definition at line 339 of file projectiondfastate.h.

Referenced by getCumulativeRoles(), and update().

True if the state describes an output state.

The member is computed through the update() method. Output states are similar to keep_subtree states. The difference is that, in an output state, we might still be interested in matching descendants, as they get assigned roles. The keep_subtree flag is only set if descendant nodes will not be assigned any roles.

Definition at line 310 of file projectiondfastate.h.

Referenced by isOutput(), and update().

True if the state forces to keep matching input document nodes.

The member is computed through the update() method.

Definition at line 288 of file projectiondfastate.h.

Referenced by keepNode(), print(), and update().

True if the state forces to keep the subtree of matching input document nodes.

The member is computed through the update() method. Keep_subtree states are similar to is_output states. The difference is that, in an output state, we might still be interested in matching descendants, as they get assigned roles. The keep_subtree flag is only set if descendant nodes will not be assigned any roles.

Definition at line 299 of file projectiondfastate.h.

Referenced by keepSubtree(), print(), takeTransition(), and update().

vector< unsigned > ProjectionDFAState::non_cumulative_roles [private]

The non-cumulative roles associated with this state.

The associated member is computed through the update() method. The same information is also stored in the members roles and role_counts. This guy is for fast access only.

Definition at line 347 of file projectiondfastate.h.

Referenced by getNonCumulativeRoles(), and update().

The configuration of the passive projection tree.

This configuration captures hidden tokenvonfigurations from previously matched descendant-axis path steps.

Definition at line 275 of file projectiondfastate.h.

Referenced by getPassiveProjectionTreeConfiguration(), update(), and ~ProjectionDFAState().

vector< unsigned > ProjectionDFAState::role_counts [private]

Contains role counts for the roles specified in member roles.

The member is computed through the update() method. The associated roles are stored in member variable roles and are linked through the indices.

Definition at line 331 of file projectiondfastate.h.

Referenced by print(), and update().

vector< Role * > ProjectionDFAState::roles [private]

Contains roles associated with matching document nodes.

The member is computed through the update() method. The counts for these roles are stored in member variable role_counts (they are linked through the indices).

Definition at line 324 of file projectiondfastate.h.

Referenced by print(), and update().

Returns true if the state forces to skip the subtree of matching input document nodes.

The associated member is computed through the update() method.

Definition at line 316 of file projectiondfastate.h.

Referenced by print(), skipSubtree(), takeTransition(), and update().

Stores the set of (currently computed) transitions into follow-up states.

The ProjectionDFATransitions object also contains a lookup function that can be used to find transitions.

Definition at line 282 of file projectiondfastate.h.

Referenced by computeTransition(), print(), takeTextTransition(), and takeTransition().


Generated on Sun May 24 20:20:28 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9