This class is used to keep track of the states of an NWA. More...
Public Types | |
typedef ClientInfo | Client |
typedef StateSet::const_iterator | const_iterator |
typedef StateSet::iterator | iterator |
typedef ref_ptr< Client > | ClientInfoRefPtr |
Public Member Functions | |
StateStorage () | |
StateStorage (StateStorage const &other) | |
StateStorage & | operator= (const StateStorage &other) |
ClientInfoRefPtr | getClientInfo (State state) const |
access the client information associated with the given state | |
void | setClientInfo (State state, const ClientInfoRefPtr c) |
Q: If the state doesn't exit should we add the state(and assign it the given info)? | |
void | clearStates () |
removes all states | |
void | clearInitialStates () |
removes all initial states | |
void | clearFinalStates () |
removes all final states | |
bool | isState (State state) const |
tests whether the given state is a member of this collection | |
bool | isInitialState (State initialState) const |
tests whether the given state is an initial state of this collection | |
bool | isFinalState (State finalState) const |
tests whether the given state is a final state of this collection | |
bool | addState (State state) |
add the given state | |
bool | addInitialState (State initialState) |
add the given initial state | |
bool | addFinalState (State finalState) |
add the given final state | |
void | addAll (const StateStorage &stateSet) |
add all states in the given collection to this collection of states | |
void | addAllStates (const StateStorage &stateSet) |
add all the states in the given StateStorage | |
void | addAllInitialStates (const StateStorage &stateSet) |
add all the initial states in the given StateStorage | |
void | addAllFinalStates (const StateStorage &stateSet) |
add all the final states in the given StateStorage | |
bool | removeState (State state) |
remove the given state | |
bool | removeInitialState (State initialState) |
remove the given initial state | |
bool | removeFinalState (State finalState) |
remove the given final state | |
std::ostream & | print (std::ostream &o) const |
print the collection of states | |
bool | operator== (const StateStorage &other) const |
tests whether this collection of states is equivalent to the collection of states 'other' | |
const_iterator | beginStates () const |
provides access to the states in the collection | |
const_iterator | beginInitialStates () const |
provides access to the initial states in the collection | |
const_iterator | beginFinalStates () const |
provides access to the final states in the collection | |
const_iterator | endStates () const |
provides access to the states in the collection | |
const_iterator | endInitialStates () const |
provides access to the initial states in the collection | |
const_iterator | endFinalStates () const |
provides access to the final states in the collection | |
const StateSet & | getStates () const |
provides access to all states in the collection | |
const StateSet & | getInitialStates () const |
provides access to the names of all the initial states in the collection | |
const StateSet & | getFinalStates () const |
provides access to the names of all final states in the collection | |
size_t | sizeStates () const |
returns the number of states in this collection | |
size_t | largestState () const |
size_t | sizeInitialStates () const |
returns the number of initial states in this collection | |
size_t | sizeFinalStates () const |
returns the number of final states in this collection | |
void | dupState (State orig, State dup) |
gives 'dup' all the state properties of 'orig' | |
Protected Attributes | |
StateSet | states |
StateSet | initialStates |
StateSet | finalStates |
std::map< State, ClientInfoRefPtr > | stateInfos |
This class is used to keep track of the states of an NWA.
typedef StateSet::const_iterator opennwa::details::StateStorage::const_iterator |
typedef StateSet::iterator opennwa::details::StateStorage::iterator |
opennwa::details::StateStorage::StateStorage | ( | ) |
opennwa::details::StateStorage::StateStorage | ( | StateStorage const & | other | ) |
References wali::ref_ptr< T >::is_valid(), and stateInfos.
StateStorage & opennwa::details::StateStorage::operator= | ( | const StateStorage & | other | ) |
References clearStates(), finalStates, initialStates, stateInfos, and states.
StateStorage::ClientInfoRefPtr opennwa::details::StateStorage::getClientInfo | ( | State | state | ) | const |
access the client information associated with the given state
This method provides access to the client information associated with this state.
- | state: the state whose client information to retrieve |
- | state: the state whose client information to retrieve |
References stateInfos.
Referenced by addAllStates(), and opennwa::Nwa::getClientInfo().
void opennwa::details::StateStorage::setClientInfo | ( | State | state, | |
const ClientInfoRefPtr | c | |||
) |
Q: If the state doesn't exit should we add the state(and assign it the given info)?
set the client information associated with the given state
set the client information associated with the given state This method sets the client information associated with the given state to the client information provided. Note: If there is already some client information associated with the given state it is lost.
- | state: the state whose client information to set | |
- | c: the desired client information for this state | |
- | state: the state whose client information to set | |
- | c: the desired client information for this state |
References addState(), isState(), and stateInfos.
Referenced by opennwa::Nwa::_private_determinize_(), opennwa::Nwa::_private_intersect_(), opennwa::Nwa::_private_star_(), addAllStates(), and opennwa::Nwa::setClientInfo().
void opennwa::details::StateStorage::clearStates | ( | ) |
removes all states
This method removes all states from this collection. It also removes all initial states and final states.
References clearFinalStates(), clearInitialStates(), stateInfos, and states.
Referenced by opennwa::Nwa::clearStates(), and operator=().
void opennwa::details::StateStorage::clearInitialStates | ( | ) |
removes all initial states
This method removes all states from the initial state set, but does not remove any states from the state set.
References initialStates.
Referenced by opennwa::Nwa::clearInitialStates(), and clearStates().
void opennwa::details::StateStorage::clearFinalStates | ( | ) |
removes all final states
This method removes all states from the final state set, but does not remove any states from the state set.
References finalStates.
Referenced by opennwa::Nwa::clearFinalStates(), and clearStates().
bool opennwa::details::StateStorage::isState | ( | State | state | ) | const |
tests whether the given state is a member of this collection
This method determines whether the given state is a member of this collection. It returns true if the state is a member and false otherwise.
- | state: the state to test |
- | state: the state to test |
References states.
Referenced by opennwa::Nwa::isState(), and setClientInfo().
bool opennwa::details::StateStorage::isInitialState | ( | State | initialState | ) | const |
tests whether the given state is an initial state of this collection
This method determines whether the given state is an initial state of this collection. It returns true if the state is an initial state and false otherwise.
- | initialState: the state to test |
- | initialState: the state to test |
References initialStates.
Referenced by dupState(), and opennwa::Nwa::isInitialState().
bool opennwa::details::StateStorage::isFinalState | ( | State | finalState | ) | const |
tests whether the given state is a final state of this collection
This method determines whether the given state is a final state of this collection. It returns true if the state is a final state and false otherwise.
- | finalState: the state to test |
- | finalState: the state to test |
References finalStates.
Referenced by dupState(), and opennwa::Nwa::isFinalState().
bool opennwa::details::StateStorage::addState | ( | State | state | ) |
add the given state
This method adds the given state. If the state already exists, false is returned. Otherwise, true is returned.
- | state: the state to add |
- | state: the state to add |
References states.
Referenced by opennwa::Nwa::_private_star_(), addAllStates(), addFinalState(), addInitialState(), opennwa::Nwa::addState(), opennwa::Nwa::duplicateState(), opennwa::Nwa::duplicateStateOutgoing(), and setClientInfo().
bool opennwa::details::StateStorage::addInitialState | ( | State | initialState | ) |
add the given initial state
This method adds the given state to this collection of states(if it does not already exist). The given initial state is then added to the initial states. If the state is already an initial state, false is returned. Otherwise, true is returned.
- | initialState: the initial state to add |
- | initialState: the initial state to add |
References addState(), and initialStates.
Referenced by addAllInitialStates(), opennwa::Nwa::addInitialState(), and dupState().
bool opennwa::details::StateStorage::addFinalState | ( | State | finalState | ) |
add the given final state
This method adds the given state to this collection of states(if it does not already exist). The given final state is then added to the final states. If the state is already a final state, false is returned. Otherwise, true is returned.
- | finalState: the final state to add |
- | finalState: the final state to add |
References addState(), and finalStates.
Referenced by addAllFinalStates(), opennwa::Nwa::addFinalState(), and dupState().
void opennwa::details::StateStorage::addAll | ( | const StateStorage & | stateSet | ) |
add all states in the given collection to this collection of states
This method adds all of the states in the given collection of states to this collection of states.
- | stateSet: the collection of states to add to this collection of states | |
- | stateSet: the collection of states to add to this collection of states |
References addAllFinalStates(), addAllInitialStates(), and addAllStates().
Referenced by opennwa::Nwa::_private_star_(), and opennwa::Nwa::combineWith().
void opennwa::details::StateStorage::addAllStates | ( | const StateStorage & | stateSet | ) |
add all the states in the given StateStorage
This method adds all of the given states to the state set.
- | stateSet: the StateStorage that contains the states to add | |
- | stateSet: the StateStorage that contains the states to add |
References addState(), beginStates(), endStates(), getClientInfo(), and setClientInfo().
Referenced by addAll(), and opennwa::Nwa::addAllStates().
void opennwa::details::StateStorage::addAllInitialStates | ( | const StateStorage & | stateSet | ) |
add all the initial states in the given StateStorage
This method adds all of the given initial states to the initial state set (and thus to the state set if they are not already elements of the state set).
- | stateSet: the StateStorage that contains the states to add | |
- | stateSet: the StateStorage that contains the states to add |
References addInitialState(), beginInitialStates(), and endInitialStates().
Referenced by addAll(), and opennwa::Nwa::addAllInitialStates().
void opennwa::details::StateStorage::addAllFinalStates | ( | const StateStorage & | stateSet | ) |
add all the final states in the given StateStorage
This method adds all of the given final states to the final state set (and thus to the state set if they are not already elements of the state set).
- | stateSet: the StateStorage that contains the states to add | |
- | stateSet: the StateStorage that contains the states to add |
References addFinalState(), beginFinalStates(), and endFinalStates().
Referenced by addAll(), and opennwa::Nwa::addAllFinalStates().
bool opennwa::details::StateStorage::removeState | ( | State | state | ) |
remove the given state
This method removes the given state. If the state does not exist, false is returned. Otherwise, true is returned. Note: If the given state is an initial state or a final state, it is also removed from that set.
- | state: the state to remove |
- | state: the state to remove |
References removeFinalState(), removeInitialState(), and states.
Referenced by opennwa::Nwa::removeState().
bool opennwa::details::StateStorage::removeInitialState | ( | State | initialState | ) |
remove the given initial state
This method removes the given initial state. If the state is not an initial state, false is returned. Otherwise, true is returned. Note: The state is not removed from the state set.
- | initialState: the initial state to remove |
- | initialState: the initial state to remove |
References initialStates.
Referenced by opennwa::Nwa::removeInitialState(), and removeState().
bool opennwa::details::StateStorage::removeFinalState | ( | State | finalState | ) |
remove the given final state
This method removes the given final state. If the state is not a final state, false is returned. Otherwise, true is returned. Note: The state is not removed from the state set.
- | finalState: the final state to remove false if this state is not a final state, true otherwise | |
- | finalState: the final state to remove false if this state is not a final state, true otherwise |
References finalStates.
Referenced by opennwa::Nwa::removeFinalState(), and removeState().
std::ostream & opennwa::details::StateStorage::print | ( | std::ostream & | o | ) | const [virtual] |
print the collection of states
This method prints out the keys associated with the state set to the output stream provided.
- | o: the output stream to print to |
- | o: the output stream to print to |
Implements wali::Printable.
References beginFinalStates(), beginInitialStates(), beginStates(), endFinalStates(), endInitialStates(), endStates(), and wali::printKey().
Referenced by opennwa::Nwa::print().
bool opennwa::details::StateStorage::operator== | ( | const StateStorage & | other | ) | const |
tests whether this collection of states is equivalent to the collection of states 'other'
This method tests the equivalence of this set of states and the set of states 'other'.
- | other: the StateStorage to compare this StateStorage to |
- | other: the StateStorage to compare this StateStorage to |
References finalStates, initialStates, and states.
StateStorage::const_iterator opennwa::details::StateStorage::beginStates | ( | ) | const |
provides access to the states in the collection
This method provides access to the states in this collection through an iterator.
References states.
Referenced by addAllStates(), opennwa::Nwa::beginStates(), and print().
StateStorage::const_iterator opennwa::details::StateStorage::beginInitialStates | ( | ) | const |
provides access to the initial states in the collection
This method provides access to the initial states in this collection through an iterator.
References initialStates.
Referenced by addAllInitialStates(), opennwa::Nwa::beginInitialStates(), and print().
StateStorage::const_iterator opennwa::details::StateStorage::beginFinalStates | ( | ) | const |
provides access to the final states in the collection
This method provides access to the final states in this collection through an iterator.
References finalStates.
Referenced by addAllFinalStates(), opennwa::Nwa::beginFinalStates(), and print().
StateStorage::const_iterator opennwa::details::StateStorage::endStates | ( | ) | const |
provides access to the states in the collection
This method provides access to the states in the collection through an iterator.
References states.
Referenced by addAllStates(), opennwa::Nwa::endStates(), and print().
StateStorage::const_iterator opennwa::details::StateStorage::endInitialStates | ( | ) | const |
provides access to the initial states in the collection
This method provides access to the initial states in the collection through an iterator.
References initialStates.
Referenced by addAllInitialStates(), opennwa::Nwa::endInitialStates(), and print().
StateStorage::const_iterator opennwa::details::StateStorage::endFinalStates | ( | ) | const |
provides access to the final states in the collection
This method provides access to the final states in the collection through an iterator.
References finalStates.
Referenced by addAllFinalStates(), opennwa::Nwa::endFinalStates(), and print().
const StateSet & opennwa::details::StateStorage::getStates | ( | ) | const |
provides access to all states in the collection
This method provides access to all states in this collection in the form of a set of states.
References states.
Referenced by opennwa::Nwa::getStates().
const StateSet & opennwa::details::StateStorage::getInitialStates | ( | ) | const |
provides access to the names of all the initial states in the collection
This method provides access to the names of all the initial states in the collection in the form of a set of state names.
References initialStates.
Referenced by opennwa::Nwa::getInitialStates().
const StateSet & opennwa::details::StateStorage::getFinalStates | ( | ) | const |
provides access to the names of all final states in the collection
This method provides access to the names of all the final states in the collection in the form of a set of state names.
References finalStates.
Referenced by opennwa::Nwa::getFinalStates().
size_t opennwa::details::StateStorage::sizeStates | ( | ) | const |
returns the number of states in this collection
This method returns the number of states in this collection. Note: This will always be at least 1 as the stuck state is always a legitimate state.
References states.
Referenced by opennwa::Nwa::sizeStates().
size_t opennwa::details::StateStorage::largestState | ( | ) | const |
References states.
Referenced by opennwa::Nwa::largestState().
size_t opennwa::details::StateStorage::sizeInitialStates | ( | ) | const |
returns the number of initial states in this collection
This method returns the number of initial states in this collection.
References initialStates.
Referenced by opennwa::Nwa::sizeInitialStates().
size_t opennwa::details::StateStorage::sizeFinalStates | ( | ) | const |
returns the number of final states in this collection
This method returns the number of final states in this collection.
References finalStates.
Referenced by opennwa::Nwa::sizeFinalStates().
gives 'dup' all the state properties of 'orig'
This method checks all the state properties (initial/final) of 'orig' and assigns the same properties to 'dup'.
- | orig: the state whose properties to duplicate | |
- | dup: the state whose properties are being set |
FIXME: suppose dup is final, orig is not; this won't remove finality of dup
- | orig: the state whose properties to duplicate | |
- | dup: the state whose properties are being set |
References addFinalState(), addInitialState(), isFinalState(), and isInitialState().
Referenced by opennwa::Nwa::duplicateState(), and opennwa::Nwa::duplicateStateOutgoing().
StateSet opennwa::details::StateStorage::states [protected] |
Referenced by addState(), beginStates(), clearStates(), endStates(), getStates(), isState(), largestState(), operator=(), operator==(), removeState(), and sizeStates().
StateSet opennwa::details::StateStorage::finalStates [protected] |
std::map<State,ClientInfoRefPtr> opennwa::details::StateStorage::stateInfos [protected] |
Referenced by clearStates(), getClientInfo(), operator=(), setClientInfo(), and StateStorage().