Package org.apache.cayenne.graph
Class GraphMap
- java.lang.Object
-
- org.apache.cayenne.graph.GraphMap
-
- All Implemented Interfaces:
GraphChangeHandler
,GraphManager
public class GraphMap extends 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
-
-
Constructor Summary
Constructors Constructor Description GraphMap()
Creates a new GraphMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
arcCreated(Object nodeId, Object targetNodeId, ArcId arcId)
Notifies implementing object that a new arc was created between two nodes.void
arcDeleted(Object nodeId, Object targetNodeId, ArcId arcId)
Notifies implementing object that an arc between two nodes was deleted.Object
getNode(Object nodeId)
Returns a graph node given an id.void
nodeCreated(Object nodeId)
Notifies implementing object that a new node was created in the graph.void
nodeIdChanged(Object nodeId, Object newId)
Notifies implementing object that a node was assigned a new id.void
nodePropertyChanged(Object nodeId, String property, Object oldValue, Object newValue)
Notifies implementing object that a node's property was modified.void
nodeRemoved(Object nodeId)
Notifies implementing object that a node was removed from the graph.Collection<Object>
registeredNodes()
Returns an immutable collection of registered nodes.void
registerNode(Object nodeId, Object nodeObject)
"Registers" a graph node, usually storing the node in some internal map using its id as a key.Object
unregisterNode(Object nodeId)
"Unregisters" a graph node, forgetting any information associated with nodeId.
-
-
-
Method Detail
-
registeredNodes
public Collection<Object> registeredNodes()
Returns an immutable collection of registered nodes.- Specified by:
registeredNodes
in interfaceGraphManager
-
getNode
public Object getNode(Object nodeId)
Description copied from interface:GraphManager
Returns a graph node given an id.- Specified by:
getNode
in interfaceGraphManager
-
registerNode
public void registerNode(Object nodeId, Object nodeObject)
Description copied from interface:GraphManager
"Registers" a graph node, usually storing the node in some internal map using its id as a key.- Specified by:
registerNode
in interfaceGraphManager
-
unregisterNode
public Object unregisterNode(Object nodeId)
Description copied from interface:GraphManager
"Unregisters" a graph node, forgetting any information associated with nodeId.- Specified by:
unregisterNode
in interfaceGraphManager
-
arcCreated
public void arcCreated(Object nodeId, Object targetNodeId, ArcId arcId)
Description copied from interface:GraphChangeHandler
Notifies implementing object that a new arc was created between two nodes.- Specified by:
arcCreated
in interfaceGraphChangeHandler
-
arcDeleted
public void arcDeleted(Object nodeId, Object targetNodeId, ArcId arcId)
Description copied from interface:GraphChangeHandler
Notifies implementing object that an arc between two nodes was deleted.- Specified by:
arcDeleted
in interfaceGraphChangeHandler
-
nodeCreated
public void nodeCreated(Object nodeId)
Description copied from interface:GraphChangeHandler
Notifies implementing object that a new node was created in the graph.- Specified by:
nodeCreated
in interfaceGraphChangeHandler
-
nodeRemoved
public void nodeRemoved(Object nodeId)
Description copied from interface:GraphChangeHandler
Notifies implementing object that a node was removed from the graph.- Specified by:
nodeRemoved
in interfaceGraphChangeHandler
-
nodeIdChanged
public void nodeIdChanged(Object nodeId, Object newId)
Description copied from interface:GraphChangeHandler
Notifies implementing object that a node was assigned a new id.- Specified by:
nodeIdChanged
in interfaceGraphChangeHandler
-
nodePropertyChanged
public void nodePropertyChanged(Object nodeId, String property, Object oldValue, Object newValue)
Description copied from interface:GraphChangeHandler
Notifies implementing object that a node's property was modified.- Specified by:
nodePropertyChanged
in interfaceGraphChangeHandler
-
-