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 JadaItem 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 JadaItem 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(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)
-
-
Tuple(Tuple)
- Constructor: build a tuple copying the given one.
-
buildItem(InputStream)
- From the JadaItem interface: builds this tuple from an input stream
-
cloneItem(Object)
- From the JadaItem interface: clone a tuple given a "source" one
-
dumpItem(OutputStream)
- From the JadaItem interface: dumps this tuple to a output stream
-
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.
-
I()
- Short form for IntegerClass.
-
initFromString(String)
- Allocates basic data and sets the tuple reading its regular string
representation.
-
IntegerClass()
- Returns the Class for an Integer object.
-
matchesItem(JadaItem)
- Checks for the given tuple to match the current one.
-
S()
- Short form for StringClass.
-
setItem(int, Object)
- Sets an item of the tuple.
Watch out: just String, Integer and JadaItem are valid object types.
-
setItems(int)
- Sets the number of items for this tuple.
-
StringClass()
- Returns the Class for a String object.
-
toString()
- Override Object.toString().
Tuple
public Tuple()
- Constructor: builds an empty tuple.
Tuple
public Tuple(Tuple source)
- Constructor: build a tuple copying the given one.
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)
setItems
public void setItems(int items)
- Sets the number of items for this tuple. Useful when you want to
build a tuple using setItem
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) throws JadaFormatException, ClassNotFoundException
- 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 JadaItem are valid object types.
- See Also:
- getItem
getItem
public Object getItem(int index)
- Returns the Object at the given position.
- See Also:
- setItem
matchesItem
public boolean matchesItem(JadaItem 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
cloneItem
public void cloneItem(Object object_source)
- From the JadaItem interface: clone a tuple given a "source" one
dumpItem
public void dumpItem(OutputStream os) throws JadaItemIsNotStreamableException, IOException
- From the JadaItem interface: dumps this tuple to a output stream
buildItem
public void buildItem(InputStream is) throws JadaItemIsNotStreamableException, IOException
- From the JadaItem interface: builds this tuple from an input stream
All Packages Class Hierarchy This Package Previous Next Index