CTL.Types
Class Tupel<A,B>

java.lang.Object
  extended by CTL.Types.Tupel<A,B>
All Implemented Interfaces:
Writable, TemplHack
Direct Known Subclasses:
Node, Sibling

public class Tupel<A,B>
extends java.lang.Object
implements Writable, TemplHack

CTL Tupel (a fixed-sized array of multiple types)


Field Summary
protected  java.lang.Object[] data
          Stored data
protected  TypeTree[] type
          Type paramenters
 
Constructor Summary
protected Tupel()
          Dummy constructor to make subclasses happy
  Tupel(java.lang.Class[] type)
          Generate a new Tupel
  Tupel(TypeTree[] tree)
          Constructor from TypeTree
 
Method Summary
 boolean equals(java.lang.Object t)
          Check if two objects are equal
protected static java.lang.Class[] insert(java.lang.Class[] array, int idx, java.lang.Class moo)
          Array helper function
 java.lang.Object item(int i)
          Retrieve the value of a specific element
 int length()
          Retrieve the number of elements this Tupel can store
 void read(SerialIn in)
          Serial read function
 void setItem(int i, java.lang.Object data)
          Set the value of a specific element
 void setTypes(TypeTree[] types)
          Set the type parameters
 java.lang.String toString()
          Retrieve a string representation of this object
 java.lang.Class type(int i)
          Retrieve the type of a specific element
 void write(SerialOut out)
          Serial write function
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected TypeTree[] type
Type paramenters


data

protected java.lang.Object[] data
Stored data

Constructor Detail

Tupel

protected Tupel()
Dummy constructor to make subclasses happy


Tupel

public Tupel(java.lang.Class[] type)
      throws CTLException,
             java.lang.ClassNotFoundException
Generate a new Tupel

Parameters:
type - Type parameters
Throws:
CTLException
java.lang.ClassNotFoundException

Tupel

public Tupel(TypeTree[] tree)
      throws CTLException,
             java.lang.ClassNotFoundException
Constructor from TypeTree

Throws:
CTLException
java.lang.ClassNotFoundException
Method Detail

insert

protected static java.lang.Class[] insert(java.lang.Class[] array,
                                          int idx,
                                          java.lang.Class moo)
Array helper function

Parameters:
array - Array of classes
idx - Index number
moo - New value
Returns:
Array of classes with the specified value replaced

setTypes

public void setTypes(TypeTree[] types)
Set the type parameters

Specified by:
setTypes in interface TemplHack
Parameters:
types - Array of classes

toString

public java.lang.String toString()
Retrieve a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

length

public int length()
Retrieve the number of elements this Tupel can store

Returns:
Number of elements

type

public java.lang.Class type(int i)
                     throws CTLException
Retrieve the type of a specific element

Parameters:
i - Index number
Returns:
Type of the element
Throws:
CTLException

item

public java.lang.Object item(int i)
                      throws CTLException
Retrieve the value of a specific element

Parameters:
i - Index number
Returns:
Value of the element
Throws:
CTLException

setItem

public void setItem(int i,
                    java.lang.Object data)
             throws CTLException
Set the value of a specific element

Parameters:
i - Index number
data - New value
Throws:
CTLException

read

public void read(SerialIn in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
Serial read function

Specified by:
read in interface Writable
Parameters:
in - Input stream
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

write

public void write(SerialOut out)
           throws java.io.IOException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException
Serial write function

Specified by:
write in interface Writable
Parameters:
out - Output stream
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

equals

public boolean equals(java.lang.Object t)
Check if two objects are equal

Overrides:
equals in class java.lang.Object
Parameters:
t - Object to compare to
Returns:
True if equal, false otherwise