com.threerings.delta
Class Delta

java.lang.Object
  extended by com.threerings.delta.Delta
All Implemented Interfaces:
Streamable
Direct Known Subclasses:
ArrayDelta, ReflectiveDelta

public abstract class Delta
extends Object
implements Streamable

Represents a set of changes that may be applied to an existing object to create a new object (with a streamed form that is more compact than that which would be required for streaming the entire new object).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected static Streamer _classStreamer
          Streamer for raw class references.
protected static HashMap<Class<?>,Method> _creators
          Custom creator methods mapped by class.
protected static Method _none
          Irrelevant method used to indicate that the class has no custom creator.
protected static HashMap<Class<?>,Streamer> _wrapperStreamers
          Maps primitive types to Streamer instances for corresponding wrappers.
 
Constructor Summary
Delta()
           
 
Method Summary
abstract  Object apply(Object original)
          Applies this delta to the specified object.
static boolean checkDeltable(Object original, Object revised)
          Determines whether it is possible to create a Delta converting the original object to the revised object.
static Delta createDelta(Object original, Object revised)
          Creates and returns a new Delta that will convert the original object to the revised object.
abstract  Delta merge(Delta other)
          Merges this delta with another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_creators

protected static HashMap<Class<?>,Method> _creators
Custom creator methods mapped by class.


_none

protected static Method _none
Irrelevant method used to indicate that the class has no custom creator.


_classStreamer

protected static Streamer _classStreamer
Streamer for raw class references.


_wrapperStreamers

protected static HashMap<Class<?>,Streamer> _wrapperStreamers
Maps primitive types to Streamer instances for corresponding wrappers.

Constructor Detail

Delta

public Delta()
Method Detail

checkDeltable

public static boolean checkDeltable(Object original,
                                    Object revised)
Determines whether it is possible to create a Delta converting the original object to the revised object.


createDelta

public static Delta createDelta(Object original,
                                Object revised)
Creates and returns a new Delta that will convert the original object to the revised object.


apply

public abstract Object apply(Object original)
Applies this delta to the specified object.

Returns:
a new object incorporating the changes represented by this delta.

merge

public abstract Delta merge(Delta other)
Merges this delta with another.

Returns:
a new delta containing the changes included in both.