ostore.oil.patchwork
Class PatchworkModel.Delta

java.lang.Object
  |
  +--ostore.oil.patchwork.PatchworkModel.Delta
All Implemented Interfaces:
Model.Delta, QueueElementIF, QuickSerializable
Enclosing class:
PatchworkModel

public static class PatchworkModel.Delta
extends Object
implements Model.Delta

A PatchworkModel.Delta object contains a diff of the sufficient statistics for a PatchworkModel.

Version:
$Id: PatchworkModel.java,v 1.2 2001/12/04 19:43:17 strib Exp $
Author:
Jeremy Stribling

Constructor Summary
PatchworkModel.Delta()
          Construct a new Delta.
PatchworkModel.Delta(byte[] data, int[] offset)
          Construct a Delta from its QuickSerializable form.
 
Method Summary
 Object clone()
          Clone this delta
 Matrix getMatrix()
          Returns a Matrix containing all the delta information.
 void storeDeltas(NodeId id, Array deltas)
          Store an Array representing the deltas for the node id.
 Model.Delta sum(Model.Delta other)
          Specified by ostore.oil.Model.Delta interface
 void to_bytes(byte[] data, int[] offset)
          Specified by ostore.util.QuickSerializable
 String toString()
          Returns a String representation of this Delta
 int type_code()
          Specified by ostore.util.QuickSerializable
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PatchworkModel.Delta

public PatchworkModel.Delta(byte[] data,
                            int[] offset)
                     throws QSException
Construct a Delta from its QuickSerializable form. See to_bytes(byte[], int[]).

PatchworkModel.Delta

public PatchworkModel.Delta()
Construct a new Delta.
Method Detail

storeDeltas

public void storeDeltas(NodeId id,
                        Array deltas)
Store an Array representing the deltas for the node id. The deltas are doubles indexed by QSInt types in PatchworkModel. Overwrites any existing deltas for that id.
Parameters:
id - the node to record deltas for
deltas - the deltas themselves

getMatrix

public Matrix getMatrix()
Returns a Matrix containing all the delta information. Arrays of deltas are indexed by NodeId, while deltas within those Arrays are indexed by QSInts.
Returns:
the Matrix of deltas

sum

public Model.Delta sum(Model.Delta other)
Specified by ostore.oil.Model.Delta interface
Specified by:
sum in interface Model.Delta
Following copied from interface: ostore.oil.Model.Delta
Parameters:
other - The other Delta.
Returns:
a new Delta, constructed such that applying it to a Model produces an equivalent Model to that produced by adding first this, then other.
Throws:
IllegalArgumentException - if other is not an instance of a compatible Delta subclass.

to_bytes

public void to_bytes(byte[] data,
                     int[] offset)
Specified by ostore.util.QuickSerializable
Specified by:
to_bytes in interface QuickSerializable
Following copied from interface: ostore.util.QuickSerializable
Parameters:
data - The byte array to store into, or null.
offset - A single element array whose first element is the index in data to begin writing at on function entry, and which on function exit has been incremented by the number of bytes written.

type_code

public int type_code()
Specified by ostore.util.QuickSerializable
Specified by:
type_code in interface QuickSerializable
Following copied from interface: ostore.util.QuickSerializable
Returns:
an integer unique to this class

clone

public Object clone()
             throws CloneNotSupportedException
Clone this delta
Overrides:
clone in class Object

toString

public String toString()
Returns a String representation of this Delta
Overrides:
toString in class Object