This class is used in NWA::NWAtoPDS and NWA::NWAtoBackwardsPDS. More...
Public Types | |
enum | Kind { INTRA, CALL_TO_ENTRY, EXIT_TO_RET, CALL_TO_RET } |
typedef ref_ptr< ClientInfo > | ClientInfoRefPtr |
Public Member Functions | |
WeightGen () | |
virtual | ~WeightGen () |
virtual sem_elem_t | getOne () const =0 |
access the One of the desired semiring | |
virtual sem_elem_t | getWeight (Key src, ClientInfoRefPtr srcInfo, Key sym, Kind kind, Key tgt, ClientInfoRefPtr tgtInfo) const |
computes the weight(in the desired semiring) for a rule of the WPDS from the given edge | |
virtual sem_elem_t | getExitWeight (Key src, ClientInfoRefPtr srcInfo) const |
computes the weight(in the desired semiring) for the return rule of the WPDS associated with the given exit | |
virtual sem_elem_t | getWildWeight (Key src, ClientInfoRefPtr srcInfo, Key tgt, ClientInfoRefPtr tgtInfo) const |
computes the weight(in the desired semiring) for a rule when the symbol labeling the corresponding edge in the NWA is the wild symbol |
This class is used in NWA::NWAtoPDS and NWA::NWAtoBackwardsPDS.
It is used to compute the weights for the rules added to the WPDS and must be extended to incorporate the desired semiring in order to use either of these methods.
opennwa::WeightGen::WeightGen | ( | ) |
virtual opennwa::WeightGen::~WeightGen | ( | ) | [virtual] |
virtual sem_elem_t opennwa::WeightGen::getOne | ( | ) | const [pure virtual] |
access the One of the desired semiring
This method returns the One of the desired semiring.
Implemented in opennwa::ReachGen, opennwa::ShortestPathGen, and opennwa::ShortestWordGen.
Referenced by opennwa::Nwa::_private_NwaToBackwardsPdsCalls_(), opennwa::Nwa::_private_NwaToBackwardsPdsReturns_(), opennwa::Nwa::_private_NwaToPdsCalls_(), opennwa::Nwa::_private_NwaToPdsReturns_(), getExitWeight(), opennwa::query::getSomeAcceptedWordInternal(), getWeight(), and getWildWeight().
virtual sem_elem_t opennwa::WeightGen::getWeight | ( | Key | src, | |
ClientInfoRefPtr | srcInfo, | |||
Key | sym, | |||
Kind | kind, | |||
Key | tgt, | |||
ClientInfoRefPtr | tgtInfo | |||
) | const [virtual] |
computes the weight(in the desired semiring) for a rule of the WPDS from the given edge
This method computes the weight(in the desired semiring) for a WPDS rule from the (kind) edge between 'src' and 'tgt' labeled with symbol 'sym'. Note: The kind will never be CALL_TO_RET, this case is never needed.
- | src: the source of the edge | |
- | srcInfo: the clientInfo associated with src | |
- | sym: the symbol labeling the edge | |
- | kind: the variety of edge | |
- | tgt: the target of the edge | |
- | tgtInfo: the clientInfo associated with tgt |
Reimplemented in opennwa::ShortestPathGen, and opennwa::ShortestWordGen.
References getOne().
Referenced by opennwa::Nwa::_private_NwaToBackwardsPdsCalls_(), opennwa::Nwa::_private_NwaToBackwardsPdsReturns_(), opennwa::Nwa::_private_NwaToPdsCalls_(), and opennwa::Nwa::_private_NwaToPdsReturns_().
virtual sem_elem_t opennwa::WeightGen::getExitWeight | ( | Key | src, | |
ClientInfoRefPtr | srcInfo | |||
) | const [virtual] |
computes the weight(in the desired semiring) for the return rule of the WPDS associated with the given exit
This method computes the weight(in the desired semiring) for the return rule of the WPDS corresponding to the exit 'src'. Note: This value is generally the same as getOne().
- | src: the source of the exit edge | |
- | srcInfo: the clientInfo associated with src |
Reimplemented in opennwa::ShortestPathGen, and opennwa::ShortestWordGen.
References getOne().
virtual sem_elem_t opennwa::WeightGen::getWildWeight | ( | Key | src, | |
ClientInfoRefPtr | srcInfo, | |||
Key | tgt, | |||
ClientInfoRefPtr | tgtInfo | |||
) | const [virtual] |
computes the weight(in the desired semiring) for a rule when the symbol labeling the corresponding edge in the NWA is the wild symbol
This method computes the weight(in the desired semiring) for a WPDS rule from the edge between 'src' and 'tgt' labeled with the wild symbol.
- | src: the source of the edge | |
- | srcInfo: the clientInfo associated with src | |
- | tgt: the target of the edge | |
- | tgtInfo: the clientInfo associated with tgt |
Reimplemented in opennwa::ShortestPathGen, and opennwa::ShortestWordGen.
References getOne().
Referenced by opennwa::Nwa::_private_NwaToBackwardsPdsCalls_(), opennwa::Nwa::_private_NwaToBackwardsPdsReturns_(), opennwa::Nwa::_private_NwaToPdsCalls_(), and opennwa::Nwa::_private_NwaToPdsReturns_().