org.opends.server.backends.jeb
Class Longs

java.lang.Object
  extended by org.opends.server.backends.jeb.Longs

public class Longs
extends java.lang.Object

This class represents a sorted set of longs. Internally it uses an array that can grow when necessary. A goal of this class is to avoid memory allocations where possible.


Constructor Summary
Longs()
          Construct a new empty set.
 
Method Summary
 boolean add(long v)
          Add a new value to the set.
 void addAll(Longs that)
          Adds all the elements of a provided set to this set if they are not already present.
 void clear()
          Clears the set leaving it empty.
 void decode(java.io.DataInputStream dataInputStream)
          Decode a value from a data input stream.
 void deleteAll(Longs that)
          Deletes all the elements of a provided set from this set if they are present.
 int encodedSize()
          Get the number of bytes needed to encode this value into a byte array.
 int size()
          Return the number of elements in the set.
 long[] toArray()
          Convert the set to a new array of longs.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Longs

public Longs()
Construct a new empty set.

Method Detail

encodedSize

public int encodedSize()
Get the number of bytes needed to encode this value into a byte array.

Returns:
The number of bytes needed to encode this value into a byte array.

add

public boolean add(long v)
Add a new value to the set.

Parameters:
v - The value to be added.
Returns:
true if the value was added, false if it was already present in the set.

addAll

public void addAll(Longs that)
Adds all the elements of a provided set to this set if they are not already present.

Parameters:
that - The set of elements to be added.

deleteAll

public void deleteAll(Longs that)
Deletes all the elements of a provided set from this set if they are present.

Parameters:
that - The set of elements to be deleted.

size

public int size()
Return the number of elements in the set.

Returns:
The number of elements in the set.

decode

public void decode(java.io.DataInputStream dataInputStream)
            throws java.io.IOException
Decode a value from a data input stream.

Parameters:
dataInputStream - The data input stream to read the value from.
Throws:
java.io.IOException - If an I/O error occurs while reading the value.

clear

public void clear()
Clears the set leaving it empty.


toArray

public long[] toArray()
Convert the set to a new array of longs.

Returns:
An array of longs.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object