Class TreeStructure


  • public class TreeStructure
    extends Object
    TODO #1 consider merging with MissionRepresentation
    • Method Detail

      • substructure

        public TreeStructure substructure​(Block block)
        Returns a new TreeStructure with the specified Block as root. It will not return a view of this structure but a completely new one.

        NOTE: The current implementation is not optimized for performance...

        Parameters:
        block - the block which shall be the root of the new tree structure
        Returns:
        a new tree structure, with the given block as root.
      • nextBlock

        public Optional<Block> nextBlock​(Block actualBlock)
        Optionally returns the next block in the tree structure of the specified parameter. Since this method does not know the history of the movements, it will not return as next block a children of the parameter. On the contrary, if the parameter is the last child of a sequence, it will automatically resolve the sibling of the parent as the next block. An empty Optional indicates that there is no next block and the tree navigation can be considered finished
        Parameters:
        actualBlock - the actual block for which to retrieve the next
        Returns:
        an optional containing the next block to navigate to or an empty optional, if there is no next block.
      • isParallel

        public boolean isParallel​(Block block)
      • maxConcurrency

        public int maxConcurrency​(Block block)
      • isLeaf

        public boolean isLeaf​(Block block)
      • rootBlock

        public Block rootBlock()
      • allBlocks

        public Set<Block> allBlocks()
      • parallelBlocks

        public Set<Block> parallelBlocks()
      • contains

        public boolean contains​(Block block)
      • isDescendantOf

        public boolean isDescendantOf​(Block target,
                                      Block source)
        Determines whether or not the target is a descendant of the source block in this structure.

        NOTE: The current implementation is not optimized for performance...

        Parameters:
        target - the target, for which to check if it is a descendant of the source
        source - the source for which to check if the target is a descendant of it
        Returns:
        true if the given target is a descendant of the given source, false otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object