ostore.dataobj
Class CompositeSelection

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

public class CompositeSelection
extends Object
implements Selection

A set of Selections; similar to iovecs used in scatter/gather system calls. To facilitate use of CompositeSelections, we require that they adhere to a certain canonical form. Canonical form requres that component Selections are:

  1. Homogeneous: All components must be of the same type (Range or KeyedSelection)
  2. Separable: Keys must be unique, Ranges must be separable (non-overlapping and non-adjacent).
  3. Sorted: Ranges must be sorted by ascending offsets, Keys must be sorted by their natural order (they already implement Comparable).

Version:
$Id: CompositeSelection.java,v 1.17 2002/12/02 18:55:15 geels Exp $
Author:
Dennis Geels

Constructor Summary
CompositeSelection(InputBuffer buffer)
          Creates a CompositeSelection from its QuickSerializable form.
CompositeSelection(Selection[] elts)
          Creates a CompositeSelection
 
Method Summary
 boolean contains(Selection sel)
          Tests for inclusion with other Selection.
 boolean equals(Object obj)
           
 Selection[] getSelections()
          An array of Selections in canonical form, the union of which define this CompositeSelection.
 int hashCode()
           
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeSelection

public CompositeSelection(Selection[] elts)
Creates a CompositeSelection

Parameters:
elts - The component Selections. See the class description for the restrictions on canonical form.

CompositeSelection

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

Method Detail

getSelections

public Selection[] getSelections()
An array of Selections in canonical form, the union of which define this CompositeSelection. See above for the restrictions on canonical form.


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).

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