Class TreeStructure


  • public class TreeStructure
    extends java.lang.Object
    TODO #1 consider merging with MissionRepresentation
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeStructure​(io.molr.commons.domain.MissionRepresentation representation, java.util.Set<io.molr.commons.domain.Block> parallelBlocks)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<io.molr.commons.domain.Block> allBlocks()  
      java.util.List<io.molr.commons.domain.Block> childrenOf​(io.molr.commons.domain.Block block)  
      boolean contains​(io.molr.commons.domain.Block block)  
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean isDescendantOf​(io.molr.commons.domain.Block target, io.molr.commons.domain.Block source)
      Determines whether or not the target is a descendant of the source block in this structure.
      boolean isLeaf​(io.molr.commons.domain.Block block)  
      boolean isParallel​(io.molr.commons.domain.Block block)  
      io.molr.commons.domain.MissionRepresentation missionRepresentation()  
      java.util.Optional<io.molr.commons.domain.Block> nextBlock​(io.molr.commons.domain.Block actualBlock)
      Optionally returns the next block in the tree structure of the specified parameter.
      java.util.Set<io.molr.commons.domain.Block> parallelBlocks()  
      java.util.Optional<io.molr.commons.domain.Block> parentOf​(io.molr.commons.domain.Block block)  
      static java.lang.String print​(TreeStructure structure)  
      io.molr.commons.domain.Block rootBlock()  
      TreeStructure substructure​(io.molr.commons.domain.Block block)
      Returns a new TreeStructure with the specified Block as root.
      TreeStructure substructure​(io.molr.commons.domain.Block block, java.lang.String postfix)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TreeStructure

        public TreeStructure​(io.molr.commons.domain.MissionRepresentation representation,
                             java.util.Set<io.molr.commons.domain.Block> parallelBlocks)
    • Method Detail

      • substructure

        public TreeStructure substructure​(io.molr.commons.domain.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...

      • substructure

        public TreeStructure substructure​(io.molr.commons.domain.Block block,
                                          java.lang.String postfix)
      • nextBlock

        public java.util.Optional<io.molr.commons.domain.Block> nextBlock​(io.molr.commons.domain.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

        TODO ?? think if it makes sense to have a VisitorInstance that knows how to navigate from a block onwards..

      • childrenOf

        public java.util.List<io.molr.commons.domain.Block> childrenOf​(io.molr.commons.domain.Block block)
      • isParallel

        public boolean isParallel​(io.molr.commons.domain.Block block)
      • isLeaf

        public boolean isLeaf​(io.molr.commons.domain.Block block)
      • rootBlock

        public io.molr.commons.domain.Block rootBlock()
      • allBlocks

        public java.util.Set<io.molr.commons.domain.Block> allBlocks()
      • parallelBlocks

        public java.util.Set<io.molr.commons.domain.Block> parallelBlocks()
      • contains

        public boolean contains​(io.molr.commons.domain.Block block)
      • missionRepresentation

        public io.molr.commons.domain.MissionRepresentation missionRepresentation()
      • isDescendantOf

        public boolean isDescendantOf​(io.molr.commons.domain.Block target,
                                      io.molr.commons.domain.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...

      • parentOf

        public java.util.Optional<io.molr.commons.domain.Block> parentOf​(io.molr.commons.domain.Block block)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • print

        public static java.lang.String print​(TreeStructure structure)