ProjectionDFATransitions Class Reference

Represents a set of transition out of a projection DFA state. More...

#include <projectiondfatransitions.h>

Collaboration diagram for ProjectionDFATransitions:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProjectionDFATransitions (ProjectionDFAState *_parent)
 Constructor.
virtual ~ProjectionDFATransitions ()
void print (OutputStream &dos, unsigned indents)
 Prints the object to the given output stream.
ProjectionDFAStatetakeTransition (TAG t, short &t_type)
 Returns the state reached through the transition for tag t.
ProjectionDFAStatetakeTextTransition (bool is_root)
 Returns the projection DFA state reached through the text transition.
void computeTransition (ProjectionDFAState *parent, TAG t)
 Computes the transition under tag t.

Private Member Functions

virtual void computeTextTransition (bool is_root)
 Computes the text transition.

Private Attributes

ProjectionDFAStateparent
 Pointer to thei associated ProjectionDFAState object.
hash_map< TAG,
ProjectionDFAState * > 
transitions
 Hash map storing the transitions for different tags.
bool text_transition_computed
 Stores if the text_transition has already been computed, false otherwise.
ProjectionDFAStatetext_transition
 The ProjectionDFAState reached through the text transition.


Detailed Description

Represents a set of transition out of a projection DFA state.

Besides the transition itself, the class contains methods for computing transitions and transition lookup.

Note:
the class is initially empty; the caller must assert that computeTransitions is called if a call to takeTransitions is not successful (i.e. return TRANSITION_UNKNWON)
Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 92 of file projectiondfatransitions.h.


Constructor & Destructor Documentation

ProjectionDFATransitions::ProjectionDFATransitions ( ProjectionDFAState _parent  ) 

Constructor.

Consructor - creating object for a ProjectionDFATransitions object associated with the passed ProjectionDFAState object.

Parameters:
[in] _parent The ProjectionDFAState the transition is linked to.

Definition at line 38 of file projectiondfatransitions.cpp.

ProjectionDFATransitions::~ProjectionDFATransitions (  )  [virtual]

Destructor.

Definition at line 42 of file projectiondfatransitions.cpp.

References text_transition, and transitions.


Member Function Documentation

void ProjectionDFATransitions::computeTextTransition ( bool  is_root  )  [private, virtual]

Computes the text transition.

The text transition is stored in the text_transition variable. It may become NULL if no text transition exists.

Parameters:
[in] is_root True if the state for which transition is computed is the root state.
Return values:
void 

Definition at line 119 of file projectiondfatransitions.cpp.

References TokenConfiguration::applyText(), ProjectionDFAState::getPassiveProjectionTreeConfiguration(), ProjectionDFAState::getTokenConfiguration(), ProjectionDFAState::isOutput(), parent, text_transition, and text_transition_computed.

Referenced by takeTextTransition().

void ProjectionDFATransitions::computeTransition ( ProjectionDFAState parent,
TAG  t 
)

Computes the transition under tag t.

Computes the transition out of ProjectionDFAState* parent under tag t.

Parameters:
[in] parent The associated ProjectionDFAState* object.
[in] t The tag for which the transition is to be computed.
Return values:
void 

Definition at line 103 of file projectiondfatransitions.cpp.

References TokenConfiguration::applyTag(), ProjectionDFAState::getPassiveProjectionTreeConfiguration(), ProjectionDFAState::getTokenConfiguration(), and transitions.

Referenced by ProjectionDFAState::computeTransition().

void ProjectionDFATransitions::print ( OutputStream dos,
unsigned  indents 
)

Prints the object to the given output stream.

This is a pretty print method that outputs all defined transitions (in particular those that have been computed so far).

Parameters:
[in] dos Reference to the (debug) OutputStream.
[in] indents Defines whitespace to be printed (pretty printing).
Return values:
void 

Definition at line 54 of file projectiondfatransitions.cpp.

References TagMap::getInstance(), TagMap::getTag(), incrementIndents(), NEWLINE, ProjectionDFAState::print(), resetIndents(), text_transition, transitions, and writeIndents().

Referenced by ProjectionDFAState::print().

ProjectionDFAState * ProjectionDFATransitions::takeTextTransition ( bool  is_root  ) 

Returns the projection DFA state reached through the text transition.

The text transition is the transition that is taken when PCDATA is encountered in the ProjectionDFAState associated to this transition (i.e. the parent member variable)

Parameters:
[in] is_root True if the state for which transition is computed is the root state.
Return values:
ProjectionDFAState* State reached through the text transition.

Definition at line 96 of file projectiondfatransitions.cpp.

References computeTextTransition(), text_transition, and text_transition_computed.

Referenced by ProjectionDFAState::takeTextTransition().

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

Returns the state reached through the transition 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 under tag t.

Definition at line 82 of file projectiondfatransitions.cpp.

References TRANSITION_REGULAR, TRANSITION_UNKNOWN, and transitions.

Referenced by ProjectionDFAState::takeTransition().


Member Data Documentation

Pointer to thei associated ProjectionDFAState object.

Pointer to thei associated ProjectionDFAState object for which this object stores the transitions.

Definition at line 168 of file projectiondfatransitions.h.

Referenced by computeTextTransition().

The ProjectionDFAState reached through the text transition.

May be NULL if no text transition exists.

Definition at line 188 of file projectiondfatransitions.h.

Referenced by computeTextTransition(), print(), takeTextTransition(), and ~ProjectionDFATransitions().

Stores if the text_transition has already been computed, false otherwise.

Used to avoid unnecessary (re)computation of this information.

Definition at line 182 of file projectiondfatransitions.h.

Referenced by computeTextTransition(), and takeTextTransition().

Hash map storing the transitions for different tags.

The map is computed on demand, i.e. its shape depend on the structure of the input document and the current state in input document processing.

Definition at line 176 of file projectiondfatransitions.h.

Referenced by computeTransition(), print(), takeTransition(), and ~ProjectionDFATransitions().


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