public class Replicator extends Object
If all nodes in the graph implement
Replicateable and are registered
and passing the root node in the graph will clone all registered nodes and
return a copy of the root node with references to copies of its descendents.
|Constructor and Description|
Constructs a new Replicator.
|Modifier and Type||Method and Description|
Registers a node in a graph that can be copied.
Returns a copy of the registered graph node and its descendants.
public void register(Replicateable node)
node- the graph node to register
public <T> T replicate(T value)
T- the node type
value- the root graph node
IllegalStateException- if value is not a registered node