com.jgraph.graph
Class ParentMap

java.lang.Object
  extended bycom.jgraph.graph.ParentMap
All Implemented Interfaces:
java.io.Serializable

public class ParentMap
extends java.lang.Object
implements java.io.Serializable

An object that describes relations between childs and parents.

See Also:
Serialized Form

Nested Class Summary
 class ParentMap.Entry
          Object that represents the relation between a child an a parent.
 
Field Summary
protected  java.util.Map childCount
          Maps parents to integers with the future number of childs.
protected  java.util.ArrayList entries
          Contents of the parent map.
protected  java.util.Set nodes
          Set of changed nodes for the parent map.
 
Constructor Summary
ParentMap()
           
 
Method Summary
 void addEntry(java.lang.Object child, java.lang.Object parent)
          Set parent of child in the parent map.
protected  void changeChildCount(java.lang.Object parent, int change)
          Returns an Iterator for the entries in the map.
static ParentMap create(GraphModel m, java.lang.Object[] c, boolean remove)
          Returns a parent map that represents the insertion or removal of cells in model based on remove.
 java.lang.Object[] emptyParents()
          Returns the parents that will be empty when this parent map is applied.
 java.util.Iterator entries()
          Returns an Iterator for the entries in the map.
 java.util.Set getChangedNodes()
          Returns a Set for the nodes, childs and parents, in this parent map.
 int size()
          Returns the number of entries.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

entries

protected java.util.ArrayList entries
Contents of the parent map.


nodes

protected java.util.Set nodes
Set of changed nodes for the parent map. Includes childs and parents.


childCount

protected java.util.Map childCount
Maps parents to integers with the future number of childs.

Constructor Detail

ParentMap

public ParentMap()
Method Detail

create

public static ParentMap create(GraphModel m,
                               java.lang.Object[] c,
                               boolean remove)
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.


addEntry

public void addEntry(java.lang.Object child,
                     java.lang.Object parent)
Set parent of child in the parent map.


changeChildCount

protected void changeChildCount(java.lang.Object parent,
                                int change)
Returns an Iterator for the entries in the map.


emptyParents

public java.lang.Object[] emptyParents()
Returns the parents that will be empty when this parent map is applied.


size

public int size()
Returns the number of entries.


entries

public java.util.Iterator entries()
Returns an Iterator for the entries in the map.


getChangedNodes

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


toString

public java.lang.String toString()