Class TreeBuilder


  • public class TreeBuilder
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BUILDINGS
      Buildings are interesting.
      static int COMMENTS
      Comments are interesting.
      static int CREATE_ISLANDS
      Islands should be displayed.
      static int SHIPS
      Ships are interesting.
      static int SHOW_HOMELESS
      Comments are interesting.
      static int UNITS
      Units are interesting.
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeBuilder​(java.util.Properties settings, NodeWrapperFactory nodeWrapperFactory)
      Creates a new treebuilder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildTree​(javax.swing.tree.DefaultMutableTreeNode rootNode, java.util.Collection<Region> regionCollection, java.util.Collection<Unit> units, java.util.Collection<Unit> oldUnits, java.util.Map<ID,​javax.swing.tree.TreeNode> regionNodes, java.util.Map<ID,​javax.swing.tree.TreeNode> unitNodes, java.util.Map<ID,​javax.swing.tree.TreeNode> buildingNodes, java.util.Map<ID,​javax.swing.tree.TreeNode> shipNodes, java.util.Comparator<? super Unit> unitSorting, java.util.Map<EntityID,​Alliance> activeAlliances, int[] treeStructure, GameData data)
      DOCUMENT-ME
      void buildTree​(javax.swing.tree.DefaultMutableTreeNode rootNode, GameData data)
      constructs a region tree from scratch
      int getDisplayMode()
      Return the display mode, which controls what elements to display.
      void setActiveAlliances​(java.util.Map<EntityID,​Alliance> alliances)
      DOCUMENT-ME
      void setBuildingNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> buildings)
      DOCUMENT-ME
      void setDisplayMode​(int mode)
      Sets the display mode, which controls what elements to display.
      void setRegionNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> regions)
      DOCUMENT-ME
      void setShipNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> ships)
      DOCUMENT-ME
      void setSortShipUnderUnitParent​(boolean b)
      Controls if ships nodes should be sorted under their parents node.
      void setTreeStructure​(int[] structure)
      DOCUMENT-ME
      void setUnitComparator​(java.util.Comparator<? super Unit> compare)
      DOCUMENT-ME
      void setUnitNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> units)
      DOCUMENT-ME
      • Methods inherited from class java.lang.Object

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

      • TreeBuilder

        public TreeBuilder​(java.util.Properties settings,
                           NodeWrapperFactory nodeWrapperFactory)
        Creates a new treebuilder.
    • Method Detail

      • setDisplayMode

        public void setDisplayMode​(int mode)
        Sets the display mode, which controls what elements to display.
        Parameters:
        mode -
      • setSortShipUnderUnitParent

        public void setSortShipUnderUnitParent​(boolean b)
        Controls if ships nodes should be sorted under their parents node.
        Parameters:
        b -
      • getDisplayMode

        public int getDisplayMode()
        Return the display mode, which controls what elements to display.
        Returns:
        The current display mode.
      • setRegionNodes

        public void setRegionNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> regions)
        DOCUMENT-ME
      • setUnitNodes

        public void setUnitNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> units)
        DOCUMENT-ME
      • setBuildingNodes

        public void setBuildingNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> buildings)
        DOCUMENT-ME
      • setShipNodes

        public void setShipNodes​(java.util.Map<ID,​javax.swing.tree.TreeNode> ships)
        DOCUMENT-ME
      • setActiveAlliances

        public void setActiveAlliances​(java.util.Map<EntityID,​Alliance> alliances)
        DOCUMENT-ME
      • setUnitComparator

        public void setUnitComparator​(java.util.Comparator<? super Unit> compare)
        DOCUMENT-ME
      • setTreeStructure

        public void setTreeStructure​(int[] structure)
        DOCUMENT-ME
      • buildTree

        public void buildTree​(javax.swing.tree.DefaultMutableTreeNode rootNode,
                              GameData data)
        constructs a region tree from scratch
      • buildTree

        public void buildTree​(javax.swing.tree.DefaultMutableTreeNode rootNode,
                              java.util.Collection<Region> regionCollection,
                              java.util.Collection<Unit> units,
                              java.util.Collection<Unit> oldUnits,
                              java.util.Map<ID,​javax.swing.tree.TreeNode> regionNodes,
                              java.util.Map<ID,​javax.swing.tree.TreeNode> unitNodes,
                              java.util.Map<ID,​javax.swing.tree.TreeNode> buildingNodes,
                              java.util.Map<ID,​javax.swing.tree.TreeNode> shipNodes,
                              java.util.Comparator<? super Unit> unitSorting,
                              java.util.Map<EntityID,​Alliance> activeAlliances,
                              int[] treeStructure,
                              GameData data)
        DOCUMENT-ME