ostore.dataobj
Class Range

java.lang.Object
  |
  +--ostore.dataobj.Range
All Implemented Interfaces:
QuickSerializable, Selection

public class Range
extends Object
implements Selection

A contiguous range of bytes in a data btree.

Version:
$Id: Range.java,v 1.18 2002/07/21 20:57:34 srhea Exp $
Author:
Dennis Geels

Field Summary
static long INFINITE
          A value for length indicating that the remainder of the byte array should be included in this Range.
 
Constructor Summary
Range(InputBuffer buffer)
          Creates a Range from its QuickSerializable form.
Range(long offset, long length)
          Creates a Range
 
Method Summary
 boolean before(Range r)
          Checks for ordering and separability with another Range.
 boolean contains(Selection sel)
          Tests for inclusion with other Selection.
 boolean equals(Object obj)
           
 long getLength()
          The number of bytes to include.
 long getOffset()
          The index of the first byte to include.
 int hashCode()
           
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE

public static final long INFINITE
A value for length indicating that the remainder of the byte array should be included in this Range.

See Also:
Constant Field Values
Constructor Detail

Range

public Range(long offset,
             long length)
Creates a Range

Parameters:
offset - The index of the first byte to include.
length - The number of bytes to include.

Range

public Range(InputBuffer buffer)
      throws QSException
Creates a Range from its QuickSerializable form.

Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

contains

public boolean contains(Selection sel)
Description copied from interface: Selection
Tests for inclusion with other Selection. Iff a.contains(b) and b.contains(a), it should also be true that a.equals(b).

Specified by:
contains in interface Selection
Parameters:
sel - Another Selection.
Returns:
true iff this Selection describes a portion of a DataObject which includes the entire portion described by sel (independent of a specific DataObject).

toString

public String toString()
Overrides:
toString in class Object

before

public boolean before(Range r)
Checks for ordering and separability with another Range. This method is used in CompositeSelection integrity checks.

Parameters:
r - The other Range to compare.
Returns:
true iff this Range describes a portion of a byte array that starts before, and does not overlap, the portion described by the other.

getOffset

public long getOffset()
The index of the first byte to include.


getLength

public long getLength()
The number of bytes to include.


serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Parameters:
buffer - the output buffer to add the object to