galaxy.lang
Class Int16

java.lang.Object
  |
  +--galaxy.lang.GalaxyObject
        |
        +--galaxy.lang.Int16
All Implemented Interfaces:
ArrayObject, java.lang.Cloneable

public class Int16
extends GalaxyObject
implements ArrayObject

This class encapsulates an array of 16-bit integers.


Fields inherited from class galaxy.lang.GalaxyObject
GAL_BINARY, GAL_CLAUSE_FRAME, GAL_FLOAT, GAL_FLOAT_32, GAL_FLOAT_64, GAL_FRAME, GAL_FREE, GAL_INT, GAL_INT_16, GAL_INT_32, GAL_INT_64, GAL_KEYWORD, GAL_LIST, GAL_PRED_FRAME, GAL_PROXY, GAL_PTR, GAL_STRING, GAL_SYMBOL, GAL_TAG, GAL_TOKEN, GAL_TOPIC_FRAME, nameToType, type, typeToName
 
Constructor Summary
Int16()
          Creates an empty array of shorts.
Int16(short[] shortArray)
          This constructor creates an object that encapsulates the reference to an array of shorts.
Int16(short[] shortArray, boolean makeCopy)
          This constructor creates an object that encapsulates the reference to an array of shorts.
 
Method Summary
 void append(Int16 int16)
          Appends the array of the specified Int16 object to this object's array.
 void append(short[] shortArray)
          Appends an array of shorts to this object's array.
 byte[] getBytes()
          Returns this object's array as a byte array (in big endian byte order).
 short[] getShortArray()
          Returns reference to this object's array of shorts.
 int getSize()
          Returns the length of this object's array of shorts.
 
Methods inherited from class galaxy.lang.GalaxyObject
getNameForObject, getType, getTypeForObject, getTypeName, isArrayType, nameType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Int16

public Int16()
Creates an empty array of shorts.

Int16

public Int16(short[] shortArray)
This constructor creates an object that encapsulates the reference to an array of shorts. If the array is null, an empty array is created.
Parameters:
shortArray - the array

Int16

public Int16(short[] shortArray,
             boolean makeCopy)
      throws java.lang.RuntimeException
This constructor creates an object that encapsulates the reference to an array of shorts. If the array is null, an empty array is created.
Parameters:
shortArray - the array
makeCopy - if true, a copy of the array is stored. Otherwise, the reference to the array is stored.
Throws:
java.lang.RuntimeException - If there is an error while copying the array.
Method Detail

getSize

public int getSize()
Returns the length of this object's array of shorts.
Specified by:
getSize in interface ArrayObject
Returns:
length of array

append

public void append(short[] shortArray)
            throws java.lang.RuntimeException
Appends an array of shorts to this object's array.
Parameters:
shortArray - the array to append
Throws:
java.lang.RuntimeException - If there is an error while appending to the array.

append

public void append(Int16 int16)
            throws java.lang.RuntimeException
Appends the array of the specified Int16 object to this object's array.
Parameters:
int16 - the Int16 to append
Throws:
java.lang.RuntimeException - If there is an error while appending to the array.

getShortArray

public short[] getShortArray()
Returns reference to this object's array of shorts.
Returns:
reference to the array

getBytes

public byte[] getBytes()
Returns this object's array as a byte array (in big endian byte order).
Specified by:
getBytes in interface ArrayObject
Returns:
the byte array