#include <projectiondfatransitions.h>
Public Member Functions | |
ProjectionDFATransitions (ProjectionDFAState *_parent) | |
Constructor. | |
virtual | ~ProjectionDFATransitions () |
void | print (OutputStream &dos, unsigned indents) |
Prints the object to the given output stream. | |
ProjectionDFAState * | takeTransition (TAG t, short &t_type) |
Returns the state reached through the transition for tag t. | |
ProjectionDFAState * | takeTextTransition (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 | |
ProjectionDFAState * | parent |
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. | |
ProjectionDFAState * | text_transition |
The ProjectionDFAState reached through the text transition. |
Besides the transition itself, the class contains methods for computing transitions and transition lookup.
Definition at line 92 of file projectiondfatransitions.h.
ProjectionDFATransitions::ProjectionDFATransitions | ( | ProjectionDFAState * | _parent | ) |
Constructor.
Consructor - creating object for a ProjectionDFATransitions object associated with the passed ProjectionDFAState object.
[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.
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.
[in] | is_root | True if the state for which transition is computed is the root state. |
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.
[in] | parent | The associated ProjectionDFAState* object. |
[in] | t | The tag for which the transition is to be computed. |
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).
[in] | dos | Reference to the (debug) OutputStream. |
[in] | indents | Defines whitespace to be printed (pretty printing). |
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)
[in] | is_root | True if the state for which transition is computed is the root state. |
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.
[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). |
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().
ProjectionDFAState * ProjectionDFATransitions::parent [private] |
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().
bool ProjectionDFATransitions::text_transition_computed [private] |
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< TAG, ProjectionDFAState * > ProjectionDFATransitions::transitions [private] |
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().