org.netbeans.mdr.persistence.btreeimpl.btreeindex
Class EntryTypeInfo

java.lang.Object
  extended by org.netbeans.mdr.persistence.btreeimpl.btreeindex.EntryTypeInfo
Direct Known Subclasses:
IntInfo, MOFIDInfo, StringInfo

public abstract class EntryTypeInfo
extends java.lang.Object

Encapsulates the behavior of an entry of a given type.

Version:
1.0
Author:
Dana Bergen

Constructor Summary
EntryTypeInfo()
           
 
Method Summary
abstract  byte compare(byte[] key, byte[] key2, int offset, int length)
          Compare two items of this type which are stored in byte arrays.
abstract  java.lang.Object fromBuffer(byte[] buffer)
          Create an object from the contents of the byte array.
static EntryTypeInfo getEntryTypeInfo(Storage.EntryType type, Storage storage)
          Returns an IntInfo, MOFIDInfo, or StringInfo.
abstract  int getLength()
          Returns the length of an item of this type, or 0 if variable length.
abstract  boolean isFixedLength()
          Returns true if this is a fixed length type, otherwise returns false;
 java.lang.Object objectFromBuffer(byte[] buffer, SinglevaluedIndex repos)
          Like fromBuffer, except that if this type is a key, returns object associated with the key
abstract  byte[] toBuffer(java.lang.Object object)
          Store the value of the object in a byte array.
abstract  java.lang.String typeName()
          Returns the name of this type as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntryTypeInfo

public EntryTypeInfo()
Method Detail

getEntryTypeInfo

public static EntryTypeInfo getEntryTypeInfo(Storage.EntryType type,
                                             Storage storage)
Returns an IntInfo, MOFIDInfo, or StringInfo.

Parameters:
type - type to return Info object for
Returns:
a new IntInfo, MOFIDInfo, or StringInfo

toBuffer

public abstract byte[] toBuffer(java.lang.Object object)
Store the value of the object in a byte array.

Parameters:
object -
Returns:
newly allocated byte array

fromBuffer

public abstract java.lang.Object fromBuffer(byte[] buffer)
Create an object from the contents of the byte array.

Parameters:
buffer -
Returns:
new object

objectFromBuffer

public java.lang.Object objectFromBuffer(byte[] buffer,
                                         SinglevaluedIndex repos)
Like fromBuffer, except that if this type is a key, returns object associated with the key

Parameters:
buffer -
Returns:
new object

compare

public abstract byte compare(byte[] key,
                             byte[] key2,
                             int offset,
                             int length)
Compare two items of this type which are stored in byte arrays.

Parameters:
key -
key2 -
offset - offset into key2 of target key
length - length in key2 of target key
Returns:
Returns one of:

EQUAL if the two keys are equal

GREATER if key greater than key2

LESS if key less than key2


getLength

public abstract int getLength()
Returns the length of an item of this type, or 0 if variable length.


isFixedLength

public abstract boolean isFixedLength()
Returns true if this is a fixed length type, otherwise returns false;


typeName

public abstract java.lang.String typeName()
Returns the name of this type as a String.



Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.