|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.graph.context.PrototypeNodeContextFactory | +--net.sourceforge.esw.graph.context.SameValueNodeContextFactory
Provides same-value context for creation of a single INode
instance, or a graph of INode
instances.
INodeContextFactory
implementors can use this factory to control
creational behavior and patterns for INode
instances. It allows
the program to specifiy the semantics used when creating a graph of
INode
instances, or a single INode
instance. It
allows a one-step indirection for INode
creation beyond the
NodeFactory
.
A typical use of an IPrototypeNodeContextFactory
instance is to
predefine a data structure to be used for a graph, then using the
getGraph()
method to clone that predefined data structure, or
prototype, to fill in the details of the graph.
This IPrototypeNodeContextFactory
interface extends the
INodeContextFactory
interface by providing prototypes to the
context factory. A prototype follows the Prototype design pattern. The
cloning semantics are an implementation detail of the implementor of the
IPrototypeNodeContextFactory
interface.
Intended to be used when the same graph needs to be used over and over again.
For example, use this when the columns of a 2 dimensonal structure are always
the same but the data in those columns change from row to row. To save object
instantiation costs, use a SameValueNodeContextFactory
instance
and each call made to getGraph
will return a reference to the
same object, allowing the instance to be filled in without creating new
INode
instances. Understand that this means that only one "row"
of data can be filled in at a time, and can only be used during a single
thread of execution or the data will be replaced.
INode
, Serialized FormFields inherited from class net.sourceforge.esw.graph.context.PrototypeNodeContextFactory |
prototype |
Constructor Summary | |
SameValueNodeContextFactory()
|
Method Summary | |
INode |
getGraph()
Returns a graph of newly created INode instances. |
INode |
getSingleNode()
Returns a newly created INode instance. |
Methods inherited from class net.sourceforge.esw.graph.context.PrototypeNodeContextFactory |
getPrototype, setPrototype |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SameValueNodeContextFactory()
Method Detail |
public INode getGraph()
This implementation returns the exact prototype that was set on this SameValueNodeContextFactory instance.
getGraph
in class PrototypeNodeContextFactory
public INode getSingleNode()
Implementors can use this method to allow single INode instances to be
added to a graph that follow the semantics of the INode instances created
via the getGraph
method.
This implementation returns a single INode instance returned from a call
to NodeFactory.createNode()
.
getSingleNode
in class PrototypeNodeContextFactory
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |