edu.unh.sdb.datasource
Class PackedIndexSpaceID

java.lang.Object
  extended by edu.unh.sdb.common.SpaceID
      extended by edu.unh.sdb.datasource.IndexSpaceID
          extended by edu.unh.sdb.datasource.PackedIndexSpaceID
All Implemented Interfaces:
java.lang.Cloneable

public class PackedIndexSpaceID
extends IndexSpaceID
implements java.lang.Cloneable

This class implements the IndexSpaceID class using a single integer to represent the dimensions of the ID. The leftmost 2 bits are used to represent the dimensionality, which can range from 1 to 4.


Field Summary
protected  int packedID
           
 
Constructor Summary
PackedIndexSpaceID(IndexSpaceID id)
          Constructs a PackedIndexSpaceID from the contents of the IndexSpaceID argument.
PackedIndexSpaceID(int i)
          Constructs a one dimensional PackedIndexSpaceID with axis value set to the argument.
PackedIndexSpaceID(int[] axes)
          Constructs a PackedIndexSpaceID with dimensionality matching the length of the parameter array.
PackedIndexSpaceID(int i, int j)
          Constructs a two dimensional PackedIndexSpaceID with axis values set to the given values.
PackedIndexSpaceID(int i, int j, int k)
          Constructs a three dimensional PackedIndexSpaceID with axis values set to the given values.
 
Method Summary
 void assign(PackedIndexSpaceID id)
          Set the axes of this id to the axes of the parameter id.
 java.lang.Object clone()
          Return a copy of this IndexSpaceID.
 IndexSpaceID copyID()
          Return a copy of this IndexSpaceID.
 int dim()
          Returns the dimensionality of this IndexSpaceID.
 int getCoord(int axisnumber)
          Get the value corresponding to the specified axis.
 int[] getCoords(int[] coords)
          Fill the array argument with the coordinate values for this ISID.
static void main(java.lang.String[] args)
           
 void setCoord(int axisnumber, int value)
          Set the specified axis to the specified value.
 java.lang.String toString()
          Return a String representing the object.
 
Methods inherited from class edu.unh.sdb.datasource.IndexSpaceID
add, add, containedBy, divide, equals, getCoords, greaterThanOrEqual, lessThanOrEqual, mod, multiply, negate, project, scale, scale, setDimensionsInUnits, shift, subtract, subtract, subtract, toString, volume
 
Methods inherited from class edu.unh.sdb.common.SpaceID
setCoord
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

packedID

protected int packedID
Constructor Detail

PackedIndexSpaceID

public PackedIndexSpaceID(int i)
Constructs a one dimensional PackedIndexSpaceID with axis value set to the argument.


PackedIndexSpaceID

public PackedIndexSpaceID(int i,
                          int j)
Constructs a two dimensional PackedIndexSpaceID with axis values set to the given values.


PackedIndexSpaceID

public PackedIndexSpaceID(int i,
                          int j,
                          int k)
Constructs a three dimensional PackedIndexSpaceID with axis values set to the given values.


PackedIndexSpaceID

public PackedIndexSpaceID(int[] axes)
Constructs a PackedIndexSpaceID with dimensionality matching the length of the parameter array. The axes will be set to the contents of the array.


PackedIndexSpaceID

public PackedIndexSpaceID(IndexSpaceID id)
Constructs a PackedIndexSpaceID from the contents of the IndexSpaceID argument. If the dimensionality of the argument is too large, an exception will be thrown.

Method Detail

copyID

public final IndexSpaceID copyID()
Return a copy of this IndexSpaceID.

Specified by:
copyID in class IndexSpaceID

clone

public java.lang.Object clone()
Return a copy of this IndexSpaceID.

Specified by:
clone in class SpaceID

assign

public final void assign(PackedIndexSpaceID id)
Set the axes of this id to the axes of the parameter id. The assign method may elect to refer to the data in the parameter id, and not make a copy of this information.


getCoord

public int getCoord(int axisnumber)
Get the value corresponding to the specified axis. If the specified axis is too large, a DimensionalityError is created.

Specified by:
getCoord in class IndexSpaceID

getCoords

public int[] getCoords(int[] coords)
Fill the array argument with the coordinate values for this ISID. For convenience, a reference to the argument array is returned.

Specified by:
getCoords in class IndexSpaceID

setCoord

public void setCoord(int axisnumber,
                     int value)
Set the specified axis to the specified value. If the specified axis is too large, a DimensionalityError is created.

Overrides:
setCoord in class SpaceID

dim

public int dim()
Returns the dimensionality of this IndexSpaceID.

Specified by:
dim in class SpaceID

toString

public java.lang.String toString()
Return a String representing the object.

Overrides:
toString in class IndexSpaceID

main

public static void main(java.lang.String[] args)