org.opends.server.backends.jeb
Class SortValues

java.lang.Object
  extended by org.opends.server.backends.jeb.SortValues
All Implemented Interfaces:
java.lang.Comparable<SortValues>

public class SortValues
extends java.lang.Object
implements java.lang.Comparable<SortValues>

This class defines a data structure that holds a set of attribute values that are associated with a sort order for a given entry. Any or all of the attribute values may be null if the entry does not include any values for the attribute type targeted by the corresponding sort key.

This class implements the Comparable interface and may therefore be used to order the elements in components like TreeMap and TreeSet.


Constructor Summary
SortValues(EntryID entryID, AttributeValue[] values, SortOrder sortOrder)
          Creates a new sort values object with the provided information.
SortValues(EntryID entryID, Entry entry, SortOrder sortOrder)
          Creates a new sort values object with the provided information.
 
Method Summary
 int compareTo(AttributeValue assertionValue)
          Compares the first element in this set of sort values with the provided assertion value to determine whether the assertion value is greater than or equal to the initial sort value.
 int compareTo(SortValues sortValues)
          Compares this set of sort values with the provided set of values to determine their relative order in a sorted list.
 long getEntryID()
          Retrieve the entry ID in this sort values.
 AttributeValue[] getValues()
          Retrieve the attribute values in this sort values.
 java.lang.String toString()
          Retrieves a string representation of this sort values object.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this sort values object to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortValues

public SortValues(EntryID entryID,
                  AttributeValue[] values,
                  SortOrder sortOrder)
Creates a new sort values object with the provided information.

Parameters:
entryID - The entry ID for the entry associated with this set of values.
values - The attribute values for this sort values.
sortOrder - The sort order to use to obtain the necessary values.

SortValues

public SortValues(EntryID entryID,
                  Entry entry,
                  SortOrder sortOrder)
Creates a new sort values object with the provided information.

Parameters:
entryID - The entry ID for the entry associated with this set of values.
entry - The entry containing the values to extract and use when sorting.
sortOrder - The sort order to use to obtain the necessary values.
Method Detail

compareTo

public int compareTo(SortValues sortValues)
Compares this set of sort values with the provided set of values to determine their relative order in a sorted list.

Specified by:
compareTo in interface java.lang.Comparable<SortValues>
Parameters:
sortValues - The set of values to compare against this sort values. It must also have the same sort order as this set of values.
Returns:
A negative value if this sort values object should come before the provided values in a sorted list, a positive value if this sort values object should come after the provided values in a sorted list, or zero if there is no significant difference in their relative order.

compareTo

public int compareTo(AttributeValue assertionValue)
Compares the first element in this set of sort values with the provided assertion value to determine whether the assertion value is greater than or equal to the initial sort value. This is used during VLV processing to find the offset by assertion value.

Parameters:
assertionValue - The assertion value to compare against the first sort value.
Returns:
A negative value if the provided assertion value should come before the first sort value, zero if the provided assertion value is equal to the first sort value, or a positive value if the provided assertion value should come after the first sort value.

toString

public java.lang.String toString()
Retrieves a string representation of this sort values object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this sort values object.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this sort values object to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.

getValues

public AttributeValue[] getValues()
Retrieve the attribute values in this sort values.

Returns:
The array of attribute values for this sort values.

getEntryID

public long getEntryID()
Retrieve the entry ID in this sort values.

Returns:
The entry ID for this sort values.