com.rolemodelsoft.drawlet.util
Interface Duplicatable
- All Known Subinterfaces:
- DrawingStyle, Figure, LineFigure, Locator, MovableLocator, PolygonFigure, RelativeLocator
- public interface Duplicatable
- extends java.lang.Cloneable
This interface defines a simple interface for objects that can be duplicated.
This would typically be used for copy/cut/paste type operations.
The intended use is:
1. One or more objects are sent duplicate().
2. A Hashtable is built with each of the original objects as keys and their
duplicates as corresponding values.
3. Each of the duplicates are sent postDuplicate(Hashtable), giving them
the opportunity to resolve any changes they might want to make.
E.g. Object A points to Object B, Object A' (the result of duplicate())
still points to Object B. When Object A' receives postDuplicate(), it could
make a change to point to Object B', or some other object if B' is not available.
|
Method Summary |
java.lang.Object |
duplicate()
Answers a duplicate of this object. |
java.lang.Object |
duplicateIn(java.util.Hashtable duplicates)
Answers a duplicate of this object. |
void |
postDuplicate(java.util.Hashtable duplicates)
After a series of objects are duplicated, this can be sent to each of the
duplicates to resolve any changes it might like to reconcile. |
duplicate
public java.lang.Object duplicate()
- Answers a duplicate of this object.
This is intended for copy/cut/paste operations, hence may be different
than what you would like to do for other "cloning" type operations.
- Parameters:
Object - the duplicate.
duplicateIn
public java.lang.Object duplicateIn(java.util.Hashtable duplicates)
- Answers a duplicate of this object. While doing so, place the original
as a key and the duplicate as a value into the duplicates HashTable.
Implementers may also wish to place duplicates of components in the HashTable
if they may be significant when resolving pointers after a group of objects
have been duplicated.
This is intended for copy/cut/paste operations, hence may be different
than what you would like to do for other "cloning" type operations.
- Parameters:
duplicates - the table which will be used to map the originals to the duplicates.Object - the duplicate.- See Also:
postDuplicate(java.util.Hashtable)
postDuplicate
public void postDuplicate(java.util.Hashtable duplicates)
- After a series of objects are duplicated, this can be sent to each of the
duplicates to resolve any changes it might like to reconcile.
For example, replacing observers with their duplicates, if available.
- Parameters:
duplicates - a Hashtable with originals as keys and duplicates as elements.