org.apache.directory.mitosis.common
Class CSNVector

java.lang.Object
  extended by org.apache.directory.mitosis.common.CSNVector

public class CSNVector
extends java.lang.Object

Creates a set of CSNs, which is defined in LDUP specification. Each CSN in the same CSNVector has different Replica Id from each other. Its data structure is similar to a Map whose key is the Replica Id.

CSNVector is usually used to represent 'Update Vector (UV)' and 'Purge Vector (PV)'. Please refer to the LDUP specification and other Mitosis classes such as ReplicationClientContextHandler.

Author:
Apache Directory Project

Constructor Summary
CSNVector()
          Creates a new empty instance.
 
Method Summary
 CSNVector clone()
          Creates a deep copy of this vector and returns it.
 boolean equals(java.lang.Object object)
          Returns true if and if only the specified object is a CSNVector and contains the CSNs with the same values.
 CSN getCSN(java.lang.String replicaId)
          Returns the CSN with the specified replicaId from this vector.
 java.util.Set<java.lang.String> getReplicaIds()
          Returns the Set of the ReplicaIds extracted from the CSNs in this vector.
 int hashCode()
          Returns the hash code of this vector, calculated from each CSN element.
 CSN removeCSN(java.lang.String replicaId)
          Removed the CSN with the specified replicaId from this vector and returns the removed CSN.
 void setAllCSN(CSNVector vector)
          Adds all CSNs that the specified vector contains to this vector.
 void setCSN(CSN csn)
          Adds the specified csn to this vector.
 int size()
          Returns the number of CSNs that this vector contains.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CSNVector

public CSNVector()
Creates a new empty instance.

Method Detail

setCSN

public void setCSN(CSN csn)
Adds the specified csn to this vector. If there's a CSN with the same ReplicaId, it is replaced by the specified csn.


setAllCSN

public void setAllCSN(CSNVector vector)
Adds all CSNs that the specified vector contains to this vector. If there's a CSN with the same ReplicaId in this vector, it is replaced by the CSN in the specified vector.


getCSN

public CSN getCSN(java.lang.String replicaId)
Returns the CSN with the specified replicaId from this vector.

Returns:
null if there's no match

removeCSN

public CSN removeCSN(java.lang.String replicaId)
Removed the CSN with the specified replicaId from this vector and returns the removed CSN.

Returns:
null if there's no match

getReplicaIds

public java.util.Set<java.lang.String> getReplicaIds()
Returns the Set of the ReplicaIds extracted from the CSNs in this vector.


size

public int size()
Returns the number of CSNs that this vector contains.


equals

public boolean equals(java.lang.Object object)
Returns true if and if only the specified object is a CSNVector and contains the CSNs with the same values.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code of this vector, calculated from each CSN element.

Overrides:
hashCode in class java.lang.Object
Returns:
the instance's hashcode

clone

public CSNVector clone()
Creates a deep copy of this vector and returns it.

Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.