org.ardverk.collection
Class IntegerKeyAnalyzer

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

public class IntegerKeyAnalyzer
extends AbstractKeyAnalyzer<java.lang.Integer>

A KeyAnalyzer for Integers

See Also:
Serialized Form

Field Summary
static IntegerKeyAnalyzer INSTANCE
          A singleton instance of IntegerKeyAnalyzer
static int LENGTH
          The length of an Integer in bits
 
Fields inherited from interface org.ardverk.collection.KeyAnalyzer
EQUAL_BIT_KEY, NULL_BIT_KEY, OUT_OF_BOUNDS_BIT_KEY
 
Constructor Summary
IntegerKeyAnalyzer()
           
 
Method Summary
 int bitIndex(java.lang.Integer key, int offsetInBits, int lengthInBits, java.lang.Integer 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.
 boolean isBitSet(java.lang.Integer key, int bitIndex, int lengthInBits)
          Returns whether or not a bit is set
 boolean isPrefix(java.lang.Integer prefix, int offsetInBits, int lengthInBits, java.lang.Integer key)
          Determines whether or not the given prefix (from offset to length) is a prefix of the given key.
 int lengthInBits(java.lang.Integer key)
          Returns the length of the Key in bits.
 
Methods inherited from class org.ardverk.collection.AbstractKeyAnalyzer
compare
 
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 IntegerKeyAnalyzer INSTANCE
A singleton instance of IntegerKeyAnalyzer


LENGTH

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

See Also:
Constant Field Values
Constructor Detail

IntegerKeyAnalyzer

public IntegerKeyAnalyzer()
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.


lengthInBits

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


isBitSet

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


bitIndex

public int bitIndex(java.lang.Integer key,
                    int offsetInBits,
                    int lengthInBits,
                    java.lang.Integer 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.


isPrefix

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



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