org.abora.white.value
Class PrimSpec

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.value.PrimSpec
Direct Known Subclasses:
PrimFloatSpec, PrimIntegerSpec, PrimPointerSpec

public abstract class PrimSpec
extends Heaper

A specification of a kind of primitive data type which can be stored in PrimArrays. It gives you protocol for creating and copying PrimArrays. The class and characteristics of this object determine what kind of things are stored there, and how much precision they have.


Field Summary
protected  java.lang.Class arrayClass
           
 
Constructor Summary
protected PrimSpec(java.lang.Class arrayClass)
          Construct a new specification.
 
Method Summary
 int actualHashForEqual()
          Defined by subclasses to produce the value returned by hashForEqual.
 PrimArray array()
          Return an empty array suitable for holding elements that match this specification.
 PrimArray array(int count)
          Return an array suitable for holding the specified count number of elements that match this specification.
protected  java.lang.Class arrayClass()
           
abstract  PrimArray arrayFromBuffer(java.lang.Object buffer)
          Return an array holding a copy of the given elements of buffer suitable for this spec.
 PrimArray arrayWith(Heaper value)
          Return an array holding the single element containing the given value.
 PrimArray arrayWithThree(Heaper value, Heaper other, Heaper another)
          Return an array holding three elements containing the given values in the same order.
 PrimArray arrayWithTwo(Heaper value, Heaper other)
          Return an array holding two elements containing the given values in the same order.
 PrimArray copy(PrimArray array)
           
 PrimArray copy(PrimArray array, int count)
           
 PrimArray copy(PrimArray array, int count, int start)
           
 PrimArray copy(PrimArray array, int count, int start, int before)
           
 PrimArray copy(PrimArray array, int count, int start, int before, int after)
          Make a copy of an array with a different representation size.
 PrimArray copyGrow(PrimArray array, int after)
          Make a copy of the array into a larger array.
static PrimFloatSpec iEEE(int bitCount)
          Return the specification suitable for floating-point numbers of the specified bitCount in size.
static PrimFloatSpec iEEE32()
          Return the specification defining IEEE32 floating-point numbers.
static PrimFloatSpec iEEE64()
          Return the specification defining IEEE64 floating-point numbers.
static PrimIntegerSpec int16()
          Return the specification defining signed 16-bit integer numbers.
static PrimIntegerSpec int32()
          Return the specification defining signed 32-bit integer numbers.
static PrimIntegerSpec int64()
          Return the specification defining signed 64-bit integer numbers.
static PrimIntegerSpec int8()
          Return the specification defining signed 8-bit integer numbers.
static PrimIntegerSpec integerVar()
          Return the specification defining signed unlimited size integer numbers.
static PrimPointerSpec pointer()
          Return the specification defining pointers to Heaper obects.
protected abstract  PrimArray privateCopy(PrimArray array, int size, int start, int count, int offset)
          Support for copy:with:with:with:with:
static PrimPointerSpec sharedPointer()
          Return the specification defining pointers to Heaper obects where a count of the number of shared users are kept.
static PrimIntegerSpec signedInteger(int bitCount)
          Return the specification suitable for signed integer numbers of the specified bitCount in size.
static PrimIntegerSpec toHold(IntegerValue value)
          Return the least demanding integer spec that will hold value.
static PrimIntegerSpec uInt16()
          Return the specification defining un-signed 16-bit integer numbers.
static PrimIntegerSpec uInt32()
          Return the specification defining un-signed 32-bit integer numbers.
static PrimIntegerSpec uInt8()
          Return the specification defining un-signed 8-bit integer numbers.
static PrimIntegerSpec unsignedInteger(int bitCount)
          Return the specification suitable for un-signed integer numbers of the specified bitCount in size.
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, isEqual, printContentsOn, printOn, sendSelfTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

arrayClass

protected java.lang.Class arrayClass
Constructor Detail

PrimSpec

protected PrimSpec(java.lang.Class arrayClass)
Construct a new specification.

Parameters:
arrayClass - the type of PrimArray used to hold values that meet this specification
Method Detail

iEEE32

public static PrimFloatSpec iEEE32()
Return the specification defining IEEE32 floating-point numbers.

Returns:
the specification.

iEEE64

public static PrimFloatSpec iEEE64()
Return the specification defining IEEE64 floating-point numbers.

Returns:
the specification.

iEEE

public static PrimFloatSpec iEEE(int bitCount)
Return the specification suitable for floating-point numbers of the specified bitCount in size. An exact size match is required.

Parameters:
bitCount - number of bits the specifications values have..
Returns:
the matching specification.
Throws:
java.lang.UnsupportedOperationException - if the specified bitCount can not be precisely matched.

integerVar

public static PrimIntegerSpec integerVar()
Return the specification defining signed unlimited size integer numbers.

Returns:
the specification.

int8

public static PrimIntegerSpec int8()
Return the specification defining signed 8-bit integer numbers.

Returns:
the specification.

int16

public static PrimIntegerSpec int16()
Return the specification defining signed 16-bit integer numbers.

Returns:
the specification.

int32

public static PrimIntegerSpec int32()
Return the specification defining signed 32-bit integer numbers.

Returns:
the specification.

int64

public static PrimIntegerSpec int64()
Return the specification defining signed 64-bit integer numbers.

Returns:
the specification.

signedInteger

public static PrimIntegerSpec signedInteger(int bitCount)
Return the specification suitable for signed integer numbers of the specified bitCount in size. An exact size match is required.

Parameters:
bitCount - number of bits the specifications values have..
Returns:
the matching specification.
Throws:
java.lang.UnsupportedOperationException - if the specified bitCount is not available.

uInt8

public static PrimIntegerSpec uInt8()
Return the specification defining un-signed 8-bit integer numbers.

Returns:
the specification.

uInt16

public static PrimIntegerSpec uInt16()
Return the specification defining un-signed 16-bit integer numbers.

Returns:
the specification.

uInt32

public static PrimIntegerSpec uInt32()
Return the specification defining un-signed 32-bit integer numbers.

Returns:
the specification.

unsignedInteger

public static PrimIntegerSpec unsignedInteger(int bitCount)
Return the specification suitable for un-signed integer numbers of the specified bitCount in size. An exact size match is required.

Parameters:
bitCount - number of bits the specifications values have..
Returns:
the matching specification.
Throws:
java.lang.UnsupportedOperationException - if the specified bitCount is not available.

toHold

public static PrimIntegerSpec toHold(IntegerValue value)
Return the least demanding integer spec that will hold value.

Parameters:
value - integer value to test against.
Returns:
the matching specification.

pointer

public static PrimPointerSpec pointer()
Return the specification defining pointers to Heaper obects.

Returns:
the specification.

sharedPointer

public static PrimPointerSpec sharedPointer()
Return the specification defining pointers to Heaper obects where a count of the number of shared users are kept.

Returns:
the specification.

arrayClass

protected java.lang.Class arrayClass()

array

public PrimArray array(int count)
Return an array suitable for holding the specified count number of elements that match this specification. Elements should be initialized to some reasonable zero/null value.

Parameters:
count - number of elements this will be able to hold
Returns:
the array

array

public PrimArray array()
Return an empty array suitable for holding elements that match this specification.

Returns:
the array

arrayFromBuffer

public abstract PrimArray arrayFromBuffer(java.lang.Object buffer)
Return an array holding a copy of the given elements of buffer suitable for this spec.

Parameters:
buffer - Java array containing elements meeting this specification.
Returns:
the array

arrayWith

public PrimArray arrayWith(Heaper value)
Return an array holding the single element containing the given value.

Returns:
the array

arrayWithTwo

public PrimArray arrayWithTwo(Heaper value,
                              Heaper other)
Return an array holding two elements containing the given values in the same order.

Parameters:
value - first value to store in array.
other - second value to store in array.
Returns:
the array

arrayWithThree

public PrimArray arrayWithThree(Heaper value,
                                Heaper other,
                                Heaper another)
Return an array holding three elements containing the given values in the same order.

Parameters:
value - first value to store in array.
other - second value to store in array.
another - third value to store in array.
Returns:
the array

copy

public PrimArray copy(PrimArray array)

copy

public PrimArray copy(PrimArray array,
                      int count)

copy

public PrimArray copy(PrimArray array,
                      int count,
                      int start)

copy

public PrimArray copy(PrimArray array,
                      int count,
                      int start,
                      int before)

copy

public PrimArray copy(PrimArray array,
                      int count,
                      int start,
                      int before,
                      int after)
Make a copy of an array with a different representation size. The arguments are the same as in PrimArray::copy.


copyGrow

public PrimArray copyGrow(PrimArray array,
                          int after)
Make a copy of the array into a larger array. The array has 'after' slots after the copied elements.


privateCopy

protected abstract PrimArray privateCopy(PrimArray array,
                                         int size,
                                         int start,
                                         int count,
                                         int offset)
Support for copy:with:with:with:with:


actualHashForEqual

public int actualHashForEqual()
Description copied from class: Heaper
Defined by subclasses to produce the value returned by hashForEqual.

Overrides:
actualHashForEqual in class Heaper


Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.