Class StateStructure


  • public class StateStructure
    extends java.lang.Object
    the StateStructure is responsible for handling a
    structure of StateData and Frames
    • Constructor Summary

      Constructors 
      Constructor Description
      StateStructure()
      constructs a frame tree with a default root frame
      with the name "WORLD".
      StateStructure​(long cPtr, boolean cMemoryOwn)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDAF​(FramePtr frame, FramePtr parent)
      adds a DAF to the frame tree and dynamicly associates
      the frame with a parent frame.

      Note: the parent frame must exist in the frame tree and cannot be
      NULL.
      void addData​(StateData data)
      adds a statedata to the frame tree and allocates memory
      for its states.
      void addData​(StateDataPtr data)
      adds a statedata to the frame tree and allocates memory
      for its states.
      void addFrame​(FramePtr frame)
      adds a frame to the frame tree and statically associates
      the frame with the parent frame.
      void addFrame​(FramePtr frame, FramePtr parent)
      adds a frame to the frame tree and statically associates
      the frame with the parent frame.
      void cleanup()
      destructs all frames and statedata that is not used any more.
      void cleanup​(int ID)
      destructs all frames and statedata that is not used any more.
      void delete()  
      StateDataPtr findData​(java.lang.String name)
      Find data from name.
      Frame findFrame​(java.lang.String name)
      Returns frame with the specified name.

      If multiple frames has the same name, the first frame encountered
      will be returned.
      static long getCPtr​(StateStructure obj)  
      FrameVector getDAFs()
      All DAFs of the tree.

      State getDefaultState()
      get the default state of the frame tree
      FrameVector getFrames()
      All frames of the tree.
      int getMaxID()
      gets the max ID of any StateData/Frame currently in the tree.

      All frame/data IDs (see StateData::getID()) for the data of the tree are
      lower than this number (and greater than or equal to zero).
      Frame getRoot()
      get root of state structure
      VectorStateDataPtr getStateData()
      All state data in the tree.
      boolean has​(StateDataCPtr data)
      tests if StateData data exist in this StateStructure

      void remove​(StateDataPtr data)
      removes a StateData object from the tree.
      void setDefaultState​(State state)
      set the default state of the dynamic frame tree
      if the given state is an older state then states valid in both
      new and old version will be copied to the default state.
      State upgradeState​(State oldState)
      upgrades the state to the default state, but without
      clearing the values of the state.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StateStructure

        public StateStructure​(long cPtr,
                              boolean cMemoryOwn)
      • StateStructure

        public StateStructure()
        constructs a frame tree with a default root frame
        with the name "WORLD".
    • Method Detail

      • delete

        public void delete()
      • has

        public boolean has​(StateDataCPtr data)
        tests if StateData data exist in this StateStructure

        Returns:
        true if the data was found, false otherwise

        Note: the search includes the union of StateData in all
        StateSetup's that belong to the StateStructure
      • getMaxID

        public int getMaxID()
        gets the max ID of any StateData/Frame currently in the tree.

        All frame/data IDs (see StateData::getID()) for the data of the tree are
        lower than this number (and greater than or equal to zero).
      • addData

        public void addData​(StateData data)
        adds a statedata to the frame tree and allocates memory
        for its states. This method updates the default
        state.

        Note: Ownership is taken, the data object may not have been added to
        any StateStructure before.
      • addData

        public void addData​(StateDataPtr data)
        adds a statedata to the frame tree and allocates memory
        for its states. This method updates the default
        state.

        Note: Ownership is not taken, the data object may not have been added to
        any StateStructure before.
      • addFrame

        public void addFrame​(FramePtr frame,
                             FramePtr parent)
        adds a frame to the frame tree and statically associates
        the frame with the parent frame. This method updates the default
        state.

        If parent frame is null then the frame will be attached to the world
        frame.
      • addFrame

        public void addFrame​(FramePtr frame)
        adds a frame to the frame tree and statically associates
        the frame with the parent frame. This method updates the default
        state.

        If parent frame is null then the frame will be attached to the world
        frame.
      • addDAF

        public void addDAF​(FramePtr frame,
                           FramePtr parent)
        adds a DAF to the frame tree and dynamicly associates
        the frame with a parent frame.

        Note: the parent frame must exist in the frame tree and cannot be
        NULL.
      • remove

        public void remove​(StateDataPtr data)
        removes a StateData object from the tree. The actual
        deletion of the object will happen when no States depend on
        the StateData anymore.
        Parameters:
        data - [in] pointer to object that is to be removed

        Note: if the data object is a frame and it has staticly connected
        children then the remove operation is illigal.

        Note: if the data object is a frame and it has dynamicly attached
        children then all of these will change parent relation ship such that
        world will become their parent.
      • upgradeState

        public State upgradeState​(State oldState)
        upgrades the state to the default state, but without
        clearing the values of the state.
        Parameters:
        oldState - [in] the state that should be upgraded
        Returns:
        the upgraded state
      • getDefaultState

        public State getDefaultState()
        get the default state of the frame tree
        Returns:
        the default tree state
      • setDefaultState

        public void setDefaultState​(State state)
        set the default state of the dynamic frame tree
        if the given state is an older state then states valid in both
        new and old version will be copied to the default state.
      • getStateData

        public VectorStateDataPtr getStateData()
        All state data in the tree.
        Returns:
        All state data in the tree
      • getFrames

        public FrameVector getFrames()
        All frames of the tree. Notice that elements in
        this vector can be NULL

        Returns:
        All frames of the tree.
      • getDAFs

        public FrameVector getDAFs()
        All DAFs of the tree.

        Returns:
        All DAFs of the tree.
      • getRoot

        public Frame getRoot()
        get root of state structure
        Returns:
        the root frame of the StateStructure
      • cleanup

        public void cleanup​(int ID)
        destructs all frames and statedata that is not used any more.
        Parameters:
        ID - [in] used to include a specific StateData ID for destruction, defualt -1 to
        ignore this option.
      • cleanup

        public void cleanup()
        destructs all frames and statedata that is not used any more.
      • findFrame

        public Frame findFrame​(java.lang.String name)
        Returns frame with the specified name.

        If multiple frames has the same name, the first frame encountered
        will be returned. If no frame is found, the method returns NULL.

        Parameters:
        name - [in] name of Frame.

        Returns:
        The frame with name name or NULL if no such frame.
      • findData

        public StateDataPtr findData​(java.lang.String name)
        Find data from name.
        Parameters:
        name - [in] the name.
        Returns:
        the data if found.