org.ardverk.collection
Class ShortKeyAnalyzer

java.lang.Object
  extended by org.ardverk.collection.ShortKeyAnalyzer
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<java.lang.Short>, KeyAnalyzer<java.lang.Short>

public class ShortKeyAnalyzer
extends java.lang.Object
implements KeyAnalyzer<java.lang.Short>

A KeyAnalyzer for Shorts

See Also:
Serialized Form

Field Summary
static ShortKeyAnalyzer INSTANCE
          A singleton instance of ShortKeyAnalyzer
static int LENGTH
          The length of an Short in bits
 
Fields inherited from interface org.ardverk.collection.KeyAnalyzer
EQUAL_BIT_KEY, NULL_BIT_KEY, OUT_OF_BOUNDS_BIT_KEY
 
Constructor Summary
ShortKeyAnalyzer()
           
 
Method Summary
 int bitIndex(java.lang.Short key, int offsetInBits, int lengthInBits, java.lang.Short other, int otherOffsetInBits, int otherLengthInBits)
          Returns the n-th different bit between key and found.
 int bitsPerElement()
          Returns the number of bits per element in the key.
 int compare(java.lang.Short o1, java.lang.Short o2)
          
 boolean isBitSet(java.lang.Short key, int bitIndex, int lengthInBits)
          Returns whether or not a bit is set
 boolean isPrefix(java.lang.Short prefix, int offsetInBits, int lengthInBits, java.lang.Short key)
          Determines whether or not the given prefix (from offset to length) is a prefix of the given key.
 int lengthInBits(java.lang.Short key)
          Returns the length of the Key in bits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

INSTANCE

public static final ShortKeyAnalyzer INSTANCE
A singleton instance of ShortKeyAnalyzer


LENGTH

public static final int LENGTH
The length of an Short in bits

See Also:
Constant Field Values
Constructor Detail

ShortKeyAnalyzer

public ShortKeyAnalyzer()
Method Detail

bitsPerElement

public int bitsPerElement()
Returns the number of bits per element in the key. This is only useful for variable-length keys, such as Strings.

Specified by:
bitsPerElement in interface KeyAnalyzer<java.lang.Short>

lengthInBits

public int lengthInBits(java.lang.Short key)
Returns the length of the Key in bits.

Specified by:
lengthInBits in interface KeyAnalyzer<java.lang.Short>

isBitSet

public boolean isBitSet(java.lang.Short key,
                        int bitIndex,
                        int lengthInBits)
Returns whether or not a bit is set

Specified by:
isBitSet in interface KeyAnalyzer<java.lang.Short>

bitIndex

public int bitIndex(java.lang.Short key,
                    int offsetInBits,
                    int lengthInBits,
                    java.lang.Short other,
                    int otherOffsetInBits,
                    int otherLengthInBits)
Returns the n-th different bit between key and found. This starts the comparison in key at 'keyStart' and goes for 'keyLength' bits, and compares to the found key starting at 'foundStart' and going for 'foundLength' bits.

Specified by:
bitIndex in interface KeyAnalyzer<java.lang.Short>

compare

public int compare(java.lang.Short o1,
                   java.lang.Short o2)

Specified by:
compare in interface java.util.Comparator<java.lang.Short>

isPrefix

public boolean isPrefix(java.lang.Short prefix,
                        int offsetInBits,
                        int lengthInBits,
                        java.lang.Short key)
Determines whether or not the given prefix (from offset to length) is a prefix of the given key.

Specified by:
isPrefix in interface KeyAnalyzer<java.lang.Short>


Copyright © 2005-2009 Roger Kapsi, Sam Berlin. All Rights Reserved.