org.coweb.oe
Class ContextVectorTable

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

public class ContextVectorTable
extends Object


Constructor Summary
ContextVectorTable(ContextVector cv, int site)
           
 
Method Summary
 ContextVector getContextVector(int site)
          Gets the context vector for the given site.
 int[] getEquivalents(ContextVector cv, int skip)
          Gets the index of each entry in the table frozen to (i.e., sharing a reference with, the given context vector, skipping the one noted in the skip param.
 ContextVector getMinimumContextVector()
          Gets the context vector with the minimum sequence number for each site among all context vectors in the table.
 int[][] getState()
          Serializes the state of this context vector table for transmission.
 void growTo(int count)
          Increases the size of the context vector table to the given size.
 void setState(int[][] arr)
          Unserializes context vector table contents to initialize this intance.
 String toString()
          Converts the contents of this context vector table to a string.
 void updateWithContextVector(int site, ContextVector cv)
          Sets the context vector for the given site.
 void updateWithOperation(Operation op)
          Sets the context vector for the site on the given operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextVectorTable

public ContextVectorTable(ContextVector cv,
                          int site)
                   throws OperationEngineException
Throws:
OperationEngineException
Method Detail

toString

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

Overrides:
toString in class Object
Returns:
{String} All context vectors in the table (for debug)

getEquivalents

public int[] getEquivalents(ContextVector cv,
                            int skip)
Gets the index of each entry in the table frozen to (i.e., sharing a reference with, the given context vector, skipping the one noted in the skip param.

Parameters:
{ContextVector} - cv Context vector instance
{Number} - skip Integer index to skip

getState

public int[][] getState()
Serializes the state of this context vector table for transmission.


setState

public void setState(int[][] arr)
              throws OperationEngineException
Unserializes context vector table contents to initialize this intance.

Parameters:
{Array[]} - arr Array in the format returned by getState
Throws:
OperationEngineException

growTo

public void growTo(int count)
            throws OperationEngineException
Increases the size of the context vector table to the given size. Inceases the size of all context vectors in the table to the given size. Initializes new entries with zeroed context vectors.

Parameters:
{Number} - count Desired integer size
Throws:
OperationEngineException

getContextVector

public ContextVector getContextVector(int site)
                               throws OperationEngineException
Gets the context vector for the given site. Grows the table if it does not include the site yet and returns a zeroed context vector if so.

Parameters:
{Number} - site Integer site ID
Throws:
OperationEngineException

updateWithContextVector

public void updateWithContextVector(int site,
                                    ContextVector cv)
                             throws OperationEngineException
Sets the context vector for the given site. Grows the table if it does not include the site yet.

Parameters:
{Number} - site Integer site ID
{ContextVector} - cv Context vector instance
Throws:
OperationEngineException

updateWithOperation

public void updateWithOperation(Operation op)
                         throws OperationEngineException
Sets the context vector for the site on the given operation. Grows the table if it does not include the site yet.

Parameters:
{Operation} - op Operation with the site ID and context vector
Throws:
OperationEngineException

getMinimumContextVector

public ContextVector getMinimumContextVector()
                                      throws OperationEngineException
Gets the context vector with the minimum sequence number for each site among all context vectors in the table. Gets null if the minimum vector cannot be constructed because the table is empty.

Throws:
OperationEngineException


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