org.coweb.oe
Class ContextVector

java.lang.Object
  extended by org.coweb.oe.ContextVector

public class ContextVector
extends Object


Constructor Summary
ContextVector(Map<String,Object> args)
           
 
Method Summary
 int compare(ContextVector cv)
          Computes an ordered comparison of two context vectors according to the sequence IDs at each site.
 ContextVector copy()
          Makes an independent copy of this context vector.
 int[] copySites()
          Makes an independent copy of the array in this context vector.
 boolean equals(ContextVector cv)
          Determines if this context vector equals the other in terms of the sequence IDs at each site.
 int getSeqForSite(int site)
          Gets the sequence number for the given site in this context vector.
 int[] getSites()
           
 int getSize()
          Gets the size of this context vector.
 int[] getState()
          Serializes this context vector.
 void growTo(int count)
          Increases the size of the context vector to the given size.
 ContextDifference oldestDifference(ContextVector cv)
          Finds the oldest sequence number in the difference in sequence numbers for each site between this context and the one provided.
 void setSeqForSite(int site, int seq)
          Sets the sequence number for the given site in this context vector.
 ContextDifference subtract(ContextVector cv)
          Computes the difference in sequence numbers at each site between this context vector and the one provided.
 String toString()
          Converts the contents of this context vector sites array to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextVector

public ContextVector(Map<String,Object> args)
              throws OperationEngineException
Throws:
OperationEngineException
Method Detail

toString

public String toString()
Converts the contents of this context vector sites array to a string.

Overrides:
toString in class Object

getState

public int[] getState()
Serializes this context vector.


copy

public ContextVector copy()
                   throws OperationEngineException
Makes an independent copy of this context vector.

Throws:
OperationEngineException

copySites

public int[] copySites()
Makes an independent copy of the array in this context vector.

Returns:
{Number[]} Copy of this context vector's sites array

subtract

public ContextDifference subtract(ContextVector cv)
Computes the difference in sequence numbers at each site between this context vector and the one provided.

Parameters:
{ContextVector} - cv Other context vector object

oldestDifference

public ContextDifference oldestDifference(ContextVector cv)
Finds the oldest sequence number in the difference in sequence numbers for each site between this context and the one provided.

Parameters:
{ContextVector} - cv Other context vector object

growTo

public void growTo(int count)
Increases the size of the context vector to the given size. Initializes new entries with zeros.

Parameters:
{Number} - count Desired integer size of the vector

getSeqForSite

public int getSeqForSite(int site)
Gets the sequence number for the given site in this context vector. Grows the vector if it does not include the site yet.

Parameters:
{Number} - site Integer site ID

setSeqForSite

public void setSeqForSite(int site,
                          int seq)
Sets the sequence number for the given site in this context vector. Grows the vector if it does not include the site yet.

Parameters:
{Number} - site Integer site ID
{Number} - seq Integer sequence number

getSize

public int getSize()
Gets the size of this context vector.


equals

public boolean equals(ContextVector cv)
Determines if this context vector equals the other in terms of the sequence IDs at each site. If the vectors are of different sizes, treats missing entries as suffixed zeros.

Parameters:
{ContextVector} - cv Other context vector

compare

public int compare(ContextVector cv)
Computes an ordered comparison of two context vectors according to the sequence IDs at each site. If the vectors are of different sizes, treats missing entries as suffixed zeros.

Parameters:
{ContextVector} - cv Other context vector

getSites

public int[] getSites()


Copyright © 2011-2012 The Dojo Foundation. All Rights Reserved.