Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.graph
Class GraphMap

    java.lang.Object
      org.apache.cayenne.graph.GraphMap

All Implemented Interfaces:
  GraphChangeHandler, GraphManager

    public class GraphMap

extends java.lang.Object
implements GraphManager

A base implementation of GraphManager that stores graph nodes keyed by their ids.

### Tracking Object Changes

Registered objects may choose to notify GraphMap of their changes by using callback methods defined in GraphChangeHandler interface. GraphMap itself implements as noops, leaving it up to subclasses to handle object updates.

Since:
  1.2
Author:
  Andrus Adamchik

Field Summary
`protected java.util.Map` | `nodes`

Constructor Summary
`GraphMap()` Creates a new GraphMap.

Method Summary
`void` | `arcCreated(java.lang.Object nodeId, java.lang.Object targetNodeId, java.lang.Object arcId)` Notifies implementing object that a new arc was created between two nodes.
`void` | `arcDeleted(java.lang.Object nodeId, java.lang.Object targetNodeId, java.lang.Object arcId)` Notifies implementing object that an arc between two nodes was deleted.
`java.lang.Object` | `getNode(java.lang.Object nodeId)` Returns a graph node given an id.
`void` | `nodeCreated(java.lang.Object nodeId)` Notifies implementing object that a new node was created in the graph.
`void` | `nodeIdChanged(java.lang.Object nodeId, java.lang.Object newId)` Notifies implementing object that a node was assigned a new id.
`void` | `nodePropertyChanged(java.lang.Object nodeId, java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)` Notifies implementing object that a node's property was modified.
`void` | `nodeRemoved(java.lang.Object nodeId)` Notifies implementing object that a node was removed from the graph.
`java.util.Collection` | `registeredNodes()` Returns an immutable collection of registered nodes.
`void` | `registerNode(java.lang.Object nodeId, java.lang.Object nodeObject)` "Registers" a graph node, usually striong the node in some internal map using its id as a key.
`java.lang.Object` | `unregisterNode(java.lang.Object nodeId)` "Unregisters" a graph node, forgetting any information associated with nodeId.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### nodes

    protected java.util.Map nodes

Constructor Detail

### GraphMap

    public GraphMap()

  Creates a new GraphMap.

Method Detail

### registeredNodes

    public java.util.Collection registeredNodes()

  Returns an immutable collection of registered nodes.

  Specified by:
    `registeredNodes` in interface `GraphManager`

### getNode

    public java.lang.Object getNode(java.lang.Object nodeId)

  Description copied from interface: `GraphManager`
  Returns a graph node given an id.

  Specified by:
    `getNode` in interface `GraphManager`

### registerNode

    public void registerNode(java.lang.Object nodeId,
                             java.lang.Object nodeObject)

  Description copied from interface: `GraphManager`
  "Registers" a graph node, usually striong the node in some internal map using its id as a key.

  Specified by:
    `registerNode` in interface `GraphManager`

### unregisterNode

    public java.lang.Object unregisterNode(java.lang.Object nodeId)

  Description copied from interface: `GraphManager`
  "Unregisters" a graph node, forgetting any information associated with nodeId.

  Specified by:
    `unregisterNode` in interface `GraphManager`

### arcCreated

    public void arcCreated(java.lang.Object nodeId,
                           java.lang.Object targetNodeId,
                           java.lang.Object arcId)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that a new arc was created between two nodes.

  Specified by:
    `arcCreated` in interface `GraphChangeHandler`

### arcDeleted

    public void arcDeleted(java.lang.Object nodeId,
                           java.lang.Object targetNodeId,
                           java.lang.Object arcId)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that an arc between two nodes was deleted.

  Specified by:
    `arcDeleted` in interface `GraphChangeHandler`

### nodeCreated

    public void nodeCreated(java.lang.Object nodeId)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that a new node was created in the graph.

  Specified by:
    `nodeCreated` in interface `GraphChangeHandler`

### nodeRemoved

    public void nodeRemoved(java.lang.Object nodeId)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that a node was removed from the graph.

  Specified by:
    `nodeRemoved` in interface `GraphChangeHandler`

### nodeIdChanged

    public void nodeIdChanged(java.lang.Object nodeId,
                              java.lang.Object newId)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that a node was assigned a new id.

  Specified by:
    `nodeIdChanged` in interface `GraphChangeHandler`

### nodePropertyChanged

    public void nodePropertyChanged(java.lang.Object nodeId,
                                    java.lang.String property,
                                    java.lang.Object oldValue,
                                    java.lang.Object newValue)

  Description copied from interface: `GraphChangeHandler`
  Notifies implementing object that a node's property was modified.

  Specified by:
    `nodePropertyChanged` in interface `GraphChangeHandler`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.