one is a Class and the other is an instance of that class
so the tuple
Tuple ta = new Tuple(new Integer(3), "three")
will match the tuple
Tuple tb = new Tuple(new Integer(3), new String().getClass())
Note that Tuple implements TupleItem so you can use a
tuple as an item of another tuple.
A tuple can be converted to a string using
toString()
A tuple string format is a list of items between brackets
separated by commas. Items can be actual or formal.
If an item is formal it starts with a ? followed the name of
the class it represents ("i" and "s" are used as short formats for
Integer and String respectively). If it's actual the
toString() method is used to represent its value.
Note: if you don't follow the rules for writing a TupleItem some
method of this class (notably buildItem) may generate a
class-related exception which is caught and is printed to the System.err
stream.
-
Tuple()
- Constructor: builds an empty tuple.
-
Tuple(Tuple)
- Constructor: build a tuple copying the given one.
-
Tuple(int)
- Constructor: builds the tuple calling init(int).
-
Tuple(byte[])
- Constructor: builds the tuple from a byte array calling buildItem.
-
Tuple(Object)
- Constructor: buils a tuple with the item item
This is first of a set of 10 constructors that differ on the
items number.
-
Tuple(Object, Object)
-
-
Tuple(Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object, Object, Object, Object, Object)
-
-
Tuple(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
-
-
I()
- Short form for IntegerClass.
-
IntegerClass()
- Returns the Class for an Integer object.
-
S()
- Short form for StringClass.
-
StringClass()
- Returns the Class for a String object.
-
buildItem(byte[])
- From the TupleItem interface: build this tuple from a tuple array
-
buildItem(byte[], int)
- Builds this tuple from a tuple array starting at position from
-
cloneItem(Object)
- From the TupleItem interface: clone a tuple given a "source" one
-
dumpItem()
- From the TupleItem interface: dumps this tuple to an array of bytes
-
formal()
- Returns the Class for a tuple, useful when we want a tuple as
a formal field for another tuple.
-
getIndex()
- Returns the index of this tuple if it is a result for a multiple
in or read operation.
-
getItem(int)
- Returns the Object at the given position.
-
getSize()
- Returns the size (in bytes) of this object as used in the dumpItem
method (Note: this method really calls dumpItem to calculate the size if
it has not already been called and this may be time-consuming).
-
initFromString(String)
- Allocates basic data and sets the tuple reading its regular string
representation.
-
matchesItem(Object)
- Checks for the given tuple to match the current one.
-
read(InputStream)
- Read this tuple from the given InputStream.
-
setItem(int, Object)
- Sets an item of the tuple.
Watch out: just String, Integer and TupleItem are valid object types.
-
toString()
- Override Object.toString().
-
write(OutputStream)
- Write this tuple to the given OutputStream.
Tuple
public Tuple()
- Constructor: builds an empty tuple.
Tuple
public Tuple(Tuple source)
- Constructor: build a tuple copying the given one.
Tuple
public Tuple(int items)
- Constructor: builds the tuple calling init(int).
The resulting tuple contains formal integer values.
- See Also:
- init
Tuple
public Tuple(byte bytes[])
- Constructor: builds the tuple from a byte array calling buildItem.
- See Also:
- buildItem
Tuple
public Tuple(Object item)
- Constructor: buils a tuple with the item item
This is first of a set of 10 constructors that differ on the
items number.
Tuple
public Tuple(Object item1,
Object item2)
Tuple
public Tuple(Object item1,
Object item2,
Object item3)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5,
Object item6)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5,
Object item6,
Object item7)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5,
Object item6,
Object item7,
Object item8)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5,
Object item6,
Object item7,
Object item8,
Object item9)
Tuple
public Tuple(Object item1,
Object item2,
Object item3,
Object item4,
Object item5,
Object item6,
Object item7,
Object item8,
Object item9,
Object item10)
getSize
public int getSize()
- Returns the size (in bytes) of this object as used in the dumpItem
method (Note: this method really calls dumpItem to calculate the size if
it has not already been called and this may be time-consuming).
- See Also:
- dumpItem
getIndex
public int getIndex()
- Returns the index of this tuple if it is a result for a multiple
in or read operation.
IntegerClass
public static Class IntegerClass()
- Returns the Class for an Integer object. Useful for a Integer
formal tuple item.
- See Also:
- I
StringClass
public static Class StringClass()
- Returns the Class for a String object. Useful for a String
formal tuple item.
- See Also:
- S
I
public static Class I()
- Short form for IntegerClass.
- See Also:
- IntegerClass
S
public static Class S()
- Short form for StringClass.
- See Also:
- StringClass
formal
public static Class formal()
- Returns the Class for a tuple, useful when we want a tuple as
a formal field for another tuple.
initFromString
protected void initFromString(String s)
- Allocates basic data and sets the tuple reading its regular string
representation.
setItem
public void setItem(int index,
Object value)
- Sets an item of the tuple.
Watch out: just String, Integer and TupleItem are valid object types.
- See Also:
- getItem
getItem
public Object getItem(int index)
- Returns the Object at the given position.
Watch out: this is not a copy: its the object itself!
- See Also:
- setItem
matchesItem
public boolean matchesItem(Object object)
- Checks for the given tuple to match the current one.
toString
public String toString()
- Override Object.toString().
Uses the same representation initFromString uses to init a tuple
- Overrides:
- toString in class Object
- See Also:
- initFromString
write
public void write(OutputStream os) throws IOException
- Write this tuple to the given OutputStream.
read
public boolean read(InputStream is) throws IOException
- Read this tuple from the given InputStream.
Return false if an "empty" tuple is read.
cloneItem
public void cloneItem(Object object_source)
- From the TupleItem interface: clone a tuple given a "source" one
dumpItem
public byte[] dumpItem()
- From the TupleItem interface: dumps this tuple to an array of bytes
buildItem
public boolean buildItem(byte b[])
- From the TupleItem interface: build this tuple from a tuple array
buildItem
public boolean buildItem(byte b[],
int from)
- Builds this tuple from a tuple array starting at position from
All Packages Class Hierarchy This Package Previous Next Index