Class ParentMap

java.lang.Object
org.jgraph.graph.ParentMap
All Implemented Interfaces:
Serializable

public class ParentMap extends Object implements Serializable
An object that describes relations between childs and parents.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Object that represents the relation between a child an a parent.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Set
    Set of changed changedNodes for the parent map.
    protected Map
    Maps parents to integers with the future number of childs.
    protected ArrayList
    Contents of the parent map.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a ParentMap object.
    ParentMap(Object[] children, Object parent)
    Constructs a ParentMap object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEntries(Object[] children, Object parent)
    Adds all child parent pairs using addEntry.
    void
    addEntry(Object child, Object parent)
    Add a new entry for this child, parent pair to the parent map.
    clone(Map map)
    Creates a new parent map based on this parent map, where the child and parents are mapped using map.
    static ParentMap
    create(GraphModel m, Object[] c, boolean remove, boolean onlyUsePassedInCells)
    Returns a parent map that represents the insertion or removal of cells in model based on remove.
    Returns an Iterator for the entries in the map.
    Returns a Set for the nodes, childs and parents, in this parent map.
    int
    Returns the number of entries.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • entries

      protected ArrayList entries
      Contents of the parent map.
    • changedNodes

      protected Set changedNodes
      Set of changed changedNodes for the parent map. Includes childs and parents.
    • childCount

      protected Map childCount
      Maps parents to integers with the future number of childs.
  • Constructor Details

    • ParentMap

      public ParentMap()
      Constructs a ParentMap object.
    • ParentMap

      public ParentMap(Object[] children, Object parent)
      Constructs a ParentMap object.
  • Method Details

    • create

      public static ParentMap create(GraphModel m, Object[] c, boolean remove, boolean onlyUsePassedInCells)
      Returns a parent map that represents the insertion or removal of cells in model based on remove. Unselected childs of selected nodes are moved to the first unselected parent of that node.

      Note: Consequently, cells "move up" one level when their parent is removed. Note: onlyUsePassedInCells can be used to indicate if only cells from the passed-in cell array are allowed parents. This is only used if remove is not true.

    • addEntry

      public void addEntry(Object child, Object parent)
      Add a new entry for this child, parent pair to the parent map. The child and parent are added to the set of changed nodes. Note: The previous parent is changed on execution of this parent map and must be added by the GraphModel and reflected by the GraphChange.getChanged method. TODO: In general, the GraphModel should be in charge of computing the set of changed cells.
    • addEntries

      public void addEntries(Object[] children, Object parent)
      Adds all child parent pairs using addEntry.
    • size

      public int size()
      Returns the number of entries.
    • entries

      public Iterator entries()
      Returns an Iterator for the entries in the map.
    • getChangedNodes

      public Set getChangedNodes()
      Returns a Set for the nodes, childs and parents, in this parent map.
    • clone

      public ParentMap clone(Map map)
      Creates a new parent map based on this parent map, where the child and parents are mapped using map. If one the cells is not in map, then the original cell is used instead.

    • toString

      public String toString()
      Overrides:
      toString in class Object