Class TreeConstructor


  • public class TreeConstructor
    extends java.lang.Object
    Constructs an object tree primarily used for the list of turns in the game. The tree is formed in a recursive way by invoking getTree(Turn). New items and leafs can be implemented by writing new createItem() methods according to the scheme:
    
     public static TreeItem<String> createItem(Object object) {
          //choose a good root representation for the object
          TreeItem<String> root = [create_root_for_object];
    
          //if there are members
          foreach(Object member: object) {
              root.getChildren().add(createItem(member));
          }
    
          return root;
     }
     
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(Turn turn)
      Create the tree item for a turn.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryAngle angle)
      Creates a tree item for a geometry angle.
      static <T> javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryItem<T> geometryItem)
      Creates a tree item for a geometry item.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryStyle geometryStyle)
      Creates a tree item for a geometry style.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryType geometryType)
      Creates a tree item for a geometry type.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(Hint hint)
      Get the tree item for a hint.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(SearchPath path)
      Creates a tree item for a search path.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(java.lang.String format, java.lang.Object... args)
      Creates a leaf tree item for a format string.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.Coordinate coordinate)
      Creates a leaf tree item for a coordinate.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.Geometry geometry)
      Creates a tree item for a geometry.
      static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.LineSegment lineSegment)
      Creates a tree item for a line segment.
      static javafx.scene.control.TreeView<java.lang.String> getTree​(Turn turn)
      Create the tree root for a turn.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getTree

        public static javafx.scene.control.TreeView<java.lang.String> getTree​(Turn turn)
        Create the tree root for a turn. Its root is invisible and this roots only purpose is to hold the turns fields. It utilises createItem(Turn).
        Parameters:
        turn - the object trees root turn
        Returns:
        root tree view with the object tree of the turn
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(Turn turn)
        Create the tree item for a turn. Its children are the items for the turn's fields:
        Parameters:
        turn - turn to display
        Returns:
        root tree item for the turn object tree
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(Hint hint)
        Get the tree item for a hint. Here, we differentiate between AngleHint, CircleHint, etc. and use the corresponding methods.
        Parameters:
        hint - hint, which is printed in the tree item
        Returns:
        root tree item for a hint and its members
        See Also:
        createItem(GeometryAngle), createItem(Coordinate)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryAngle angle)
        Creates a tree item for a geometry angle. The children are tree items for the angles defining points: left, center & right using createItem(Coordinate).
        Parameters:
        angle - angle to print as a tree item
        Returns:
        root tree item for a geometry angle
        See Also:
        createItem(Coordinate)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.LineSegment lineSegment)
        Creates a tree item for a line segment. The name is derived by the Class.getSimpleName() method. The children are tree items for the two line segment points LineSegment.p0 and LineSegment.p1.
        Parameters:
        lineSegment - line segment to print as a tree item
        Returns:
        root tree item representing a line segment
        See Also:
        createItem(String, Object...)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.Geometry geometry)
        Creates a tree item for a geometry. The children are tree items for the geometry's coordinates.
        Parameters:
        geometry - geometry to print as a tree item
        Returns:
        root tree item representing a geometry
        See Also:
        createItem(Coordinate)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryStyle geometryStyle)
        Creates a tree item for a geometry style. The children are all the separate fields of the style.
        Parameters:
        geometryStyle - style to print as a tree item
        Returns:
        root tree item representing a geometry style
        See Also:
        createItem(String, Object...)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(GeometryType geometryType)
        Creates a tree item for a geometry type. The children are all the separate fields of the type.
        Parameters:
        geometryType - type to print as a tree item
        Returns:
        root tree item representing a geometry type
        See Also:
        createItem(String, Object...)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(org.locationtech.jts.geom.Coordinate coordinate)
        Creates a leaf tree item for a coordinate.
        Parameters:
        coordinate - coordinate to print as a tree item
        Returns:
        leaf tree item representing a coordinate
        See Also:
        print(Coordinate)
      • createItem

        public static javafx.scene.control.TreeItem<java.lang.String> createItem​(java.lang.String format,
                                                                                 java.lang.Object... args)
        Creates a leaf tree item for a format string.
        Parameters:
        format - a format string
        args - arguments for the format string
        Returns:
        leaf tree item representing the formatted string
        See Also:
        String.format(String, Object...)