Module dev.civl.gmc

Class SequentialNodeFactory<STATE,TRANSITION>

java.lang.Object
dev.civl.gmc.seq.SequentialNodeFactory<STATE,TRANSITION>
All Implemented Interfaces:
GetIdFunction<STATE>

public class SequentialNodeFactory<STATE,TRANSITION> extends Object implements 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 Details

  • Method Details

    • getNode

      public SequentialNode<STATE> getNode(TraceStepIF<STATE> traceStep)

      Implements the fly-weight pattern and normalize a state. Note that only normalized and canonical state will have id.

      Parameters:
      state -
      Returns:
      the existing SequentialNode mapped to the state, or a new SequentialNode mapped to the state if there was no entry in the map for the key state. Note that the SequentialNode will always store the normalized or simplified version of state.
    • getNode

      public SequentialNode<STATE> getNode(STATE state)
      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 - The SequentialNode that wraps the source state.
      transitions - This could be the ample set or ample set complement of the source state.
      full - Whether transitions is ample set complement or not.
      Returns:
      The newly constructed StackEntry.
    • numOfSearchNodeSaved

      public int numOfSearchNodeSaved()
      Returns:
      the number of search nodes saved.
    • getInitialNode

      public SequentialNode<STATE> getInitialNode(STATE initState)
      Get the SequentialNode associated with the initial state.
      Parameters:
      initState -
      Returns:
    • getId

      public int getId(STATE state)
      Specified by:
      getId in interface GetIdFunction<STATE>