org.rlcommunity.rlglue.codec.types
Class RL_abstract_type

java.lang.Object
  extended by org.rlcommunity.rlglue.codec.types.RL_abstract_type
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
Action, Observation

public class RL_abstract_type
extends java.lang.Object
implements java.lang.Comparable

Common superclass for all of the Java RL-Glue types. Try to keep handles to the objects and not their arrays, because there is no guarantee that the arrays will not be reallocated during certain operations.

Author:
btanner

Field Summary
 char[] charArray
           
 double[] doubleArray
           
 int[] intArray
           
 
Constructor Summary
RL_abstract_type(int numInts, int numDoubles, int numChars)
          Create a RL_abstract_type with arrays allocated according to numInts, numDoubles, and numChars
RL_abstract_type(RL_abstract_type src)
          Create a new RL_abstract_type that is a deep, independent copy of src.
 
Method Summary
 int compareTo(java.lang.Object cObject)
          Allows us to easily compare abstract types so that we can put them in maps and stuff.
 char getChar(int which)
           
 double getDouble(int which)
           
 int getInt(int which)
           
 int getNumChars()
           
 int getNumDoubles()
           
 int getNumInts()
           
static void RLStructCopy(RL_abstract_type src, RL_abstract_type dest)
          Useful (maybe?) utility method for deep copying one RL_Abstract_type into another.
 void setChar(int which, char value)
           
 void setDouble(int which, double value)
           
 void setInt(int which, int value)
           
 java.lang.String toString()
          Prints out a human-readable format of the RL_abstract_type, which is useful for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

intArray

public int[] intArray

doubleArray

public double[] doubleArray

charArray

public char[] charArray
Constructor Detail

RL_abstract_type

public RL_abstract_type(int numInts,
                        int numDoubles,
                        int numChars)
Create a RL_abstract_type with arrays allocated according to numInts, numDoubles, and numChars

Parameters:
numInts - Size of int array to allocate.
numDoubles - Size of double array to allocate.
numChars - Size of char array to allocate.

RL_abstract_type

public RL_abstract_type(RL_abstract_type src)
Create a new RL_abstract_type that is a deep, independent copy of src.

Parameters:
src -
Method Detail

getInt

public int getInt(int which)

getDouble

public double getDouble(int which)

getChar

public char getChar(int which)

setInt

public void setInt(int which,
                   int value)

setDouble

public void setDouble(int which,
                      double value)

setChar

public void setChar(int which,
                    char value)

getNumInts

public int getNumInts()

getNumDoubles

public int getNumDoubles()

getNumChars

public int getNumChars()

RLStructCopy

public static void RLStructCopy(RL_abstract_type src,
                                RL_abstract_type dest)
Useful (maybe?) utility method for deep copying one RL_Abstract_type into another.

Parameters:
src -
dest -

toString

public java.lang.String toString()
Prints out a human-readable format of the RL_abstract_type, which is useful for debugging.

Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object cObject)
Allows us to easily compare abstract types so that we can put them in maps and stuff.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
cObject -
Returns:
-1 if this is 'smaller' then cObject, +1 if this is 'bigger' than cObject, 0 if they are identical.