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

## com.nwoods.jgo
Interface JGoCopyEnvironment

All Superinterfaces:
  java.util.Map

All Known Implementing Classes:
  JGoCopyMap

public interface JGoCopyEnvironment
extends java.util.Map

An interface for environment objects used during copy operations. JGoCopyEnvironment is an interface based on Map.

An object supporting JGoCopyEnvironment is used during copy operations to allow copying complex networks of objects to be handled flexibly. Override JGoObject.copyObject to customize how individual classes of objects get copied.

For example, when a network of objects is copied, references among the objects being copied can be considered to be references to the newly copied object, or references to the original objects, or references to already existing objects.

Some objects may not want to be copied immediately, but only after other objects have been copied-- this is supported by keeping track of delayed objects. This produces a two-pass copying operation: the delayed objects are processed after the initial pass of copying.

See Also:
  `JGoObject.copyObject(com.nwoods.jgo.JGoCopyEnvironment)`

Nested Class Summary

Nested classes inherited from class java.util.Map
`java.util.Map.Entry`

Method Summary
`void` | `clearDelayeds()` Removes all delayed objects.
`JGoObject` | `copy(JGoObject obj)` Get a new object corresponding to the argument, either by finding an already copied object for it or by calling JGoObject.copyObject.
`JGoObject` | `copyComplete(JGoObject obj)` This convenience method performs both copy phases making a copy of a single object.
`void` | `delay(java.lang.Object key)` Adds the object to the collection of delayed objects.
`void` | `finishDelayedCopies()` Perform calls to JGoObject.copyObjectDelayed for any objects that were added to the Delayeds collection during earlier calls to copy(JGoObject).
`java.util.Vector` | `getDelayeds()` Returns the Vector of objects whose copy operation has been delayed.
`boolean` | `isDelayed(java.lang.Object key)` Tests if the specified object is in this collection of delayed objects.
`boolean` | `isEmptyDelayeds()` Returns `true` if there are no delayed objects.
`void` | `removeDelayed(java.lang.Object key)` Remove the object from the collection of delayed objects.
`int` | `sizeDelayeds()` Returns the number of delayed objects.

Methods inherited from interface java.util.Map
`clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values`

Method Detail

### copy

    public JGoObject copy(JGoObject obj)

  Get a new object corresponding to the argument, either by finding an already copied object for it or by calling JGoObject.copyObject.

  This is a convenience method for JGoObject.copyObject implementations to call to find the corresponding new object for an old object even when it has already been copied: `newobj.myObjRef = env.copy(myObjRef);`

  If the given object is null, this method returns null.

### copyComplete

    public JGoObject copyComplete(JGoObject obj)

  This convenience method performs both copy phases making a copy of a single object.

  This returns null if the argument is null. Otherwise this returns the result of copy(JGoObject) after a call to finishDelayedCopies().

### finishDelayedCopies

    public void finishDelayedCopies()

  Perform calls to JGoObject.copyObjectDelayed for any objects that were added to the Delayeds collection during earlier calls to copy(JGoObject).

  This is primarily called by JGoDocument.copyFromCollection.

### clearDelayeds

    public void clearDelayeds()

  Removes all delayed objects.

### isEmptyDelayeds

    public boolean isEmptyDelayeds()

  Returns `true` if there are no delayed objects.

### sizeDelayeds

    public int sizeDelayeds()

  Returns the number of delayed objects.

### isDelayed

    public boolean isDelayed(java.lang.Object key)

  Tests if the specified object is in this collection of delayed objects.

  Parameters:
    `key` - an object.
  Returns:
    `true` if the object is considered delayed.

### delay

    public void delay(java.lang.Object key)

  Adds the object to the collection of delayed objects. The copying operation should copy this object after all the other objects have been copied.

  Parameters:
    `key` - the object to be delayed

### removeDelayed

    public void removeDelayed(java.lang.Object key)

  Remove the object from the collection of delayed objects.

  Parameters:
    `key` - element to be removed from this Vector, if present.
  Returns:
    true if the Vector contained the specified element.

### getDelayeds

    public java.util.Vector getDelayeds()

  Returns the Vector of objects whose copy operation has been delayed. After all the regular objects have been copied, it may be safe to copy the delayed objects.

  Returns:
    Vector of objects whose copy operation has been delayed.

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