com.threerings.delta
Class ArrayDelta

java.lang.Object
  extended by com.threerings.delta.Delta
      extended by com.threerings.delta.ArrayDelta
All Implemented Interfaces:
Streamable

public class ArrayDelta
extends Delta

A delta object representing the different between two arrays. This doesn't do anything fancy like try to find inserted and deleted strings; it simply represents a change of size and any changed elements.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  Class<?> _clazz
          The object class.
protected  int _length
          The length of the array.
protected  BareArrayMask _mask
          The mask indicating which fields have changed.
protected  Object[] _values
          The array values.
 
Fields inherited from class com.threerings.delta.Delta
_classStreamer, _creators, _none, _wrapperStreamers
 
Constructor Summary
ArrayDelta()
          No-arg constructor for deserialization.
ArrayDelta(Object original, Object revised)
          Creates a new array delta that transforms the original object into the revised object (both of which must be instances of the same class).
 
Method Summary
 Object apply(Object original)
          Applies this delta to the specified object.
 Delta merge(Delta other)
          Merges this delta with another.
 void readObject(ObjectInputStream in)
          Custom read method.
 String toString()
           
 void writeObject(ObjectOutputStream out)
          Custom write method.
 
Methods inherited from class com.threerings.delta.Delta
checkDeltable, createDelta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_clazz

protected Class<?> _clazz
The object class.


_length

protected int _length
The length of the array.


_mask

protected BareArrayMask _mask
The mask indicating which fields have changed.


_values

protected Object[] _values
The array values.

Constructor Detail

ArrayDelta

public ArrayDelta(Object original,
                  Object revised)
Creates a new array delta that transforms the original object into the revised object (both of which must be instances of the same class).


ArrayDelta

public ArrayDelta()
No-arg constructor for deserialization.

Method Detail

writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
Custom write method.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Custom read method.

Throws:
IOException
ClassNotFoundException

apply

public Object apply(Object original)
Description copied from class: Delta
Applies this delta to the specified object.

Specified by:
apply in class Delta
Returns:
a new object incorporating the changes represented by this delta.

merge

public Delta merge(Delta other)
Description copied from class: Delta
Merges this delta with another.

Specified by:
merge in class Delta
Returns:
a new delta containing the changes included in both.

toString

public String toString()
Overrides:
toString in class Object