java.lang.Object
dev.civl.gmc.seq.SequentialNodeFactory<STATE,TRANSITION>
- All Implemented Interfaces:
GetIdFunction<STATE>
The factory to get a GMC search
SequentialNode, if the
SequentialNode has been seen before, the seen SequentialNode
will be returned, otherwise, a new SequentialNode will be created and
returned.-
Constructor Summary
ConstructorsConstructorDescriptionSequentialNodeFactory(StateManager<STATE, TRANSITION> stateManager, boolean saveStates) -
Method Summary
Modifier and TypeMethodDescriptionintgetInitialNode(STATE initState) Get theSequentialNodeassociated with the initial state.getNode(TraceStepIF<STATE> traceStep) Implements the fly-weight pattern and normalize a state.Get the node associated to the given state, null there is no such a node.newStackEntry(SequentialNode<STATE> node, Collection<TRANSITION> transitions, int offset) Construct a new stack entry which will be pushed onto the stack.int
-
Constructor Details
-
SequentialNodeFactory
-
-
Method Details
-
getNode
Implements the fly-weight pattern and normalize a state. Note that only normalized and canonical state will have id.
- Parameters:
state-- Returns:
- the existing
SequentialNodemapped to the state, or a newSequentialNodemapped to the state if there was no entry in the map for the key state. Note that theSequentialNodewill always store the normalized or simplified version ofstate.
-
getNode
Get the node associated to the given state, null there is no such a node.- Parameters:
state- The state whose associated node will be returned.- Returns:
- the node associated to the given state, null there is no such a node.
-
newStackEntry
public StackEntry<STATE,TRANSITION> newStackEntry(SequentialNode<STATE> node, Collection<TRANSITION> transitions, int offset) Construct a new stack entry which will be pushed onto the stack.- Parameters:
node- TheSequentialNodethat wraps the source state.transitions- This could be the ample set or ample set complement of the source state.full- Whethertransitionsis ample set complement or not.- Returns:
- The newly constructed
StackEntry.
-
numOfSearchNodeSaved
public int numOfSearchNodeSaved()- Returns:
- the number of search nodes saved.
-
getInitialNode
Get theSequentialNodeassociated with the initial state.- Parameters:
initState-- Returns:
-
getId
- Specified by:
getIdin interfaceGetIdFunction<STATE>
-