IloDiscreteDataCollection | +--IloTupleSet
tuple T {
int i;
string s;
}
{T} 1;
{T} tupleset2;
execute {
tupleset1.add(1, "one");
tupleset1.add(2, "two");
tupleset2.add(tupleset1.get(1,"one"));
}
execute{
writeln("tupleset1 = ",tupleset1," and tupleset1.size = ",tupleset1.size);
writeln("tupleset2 = ",tupleset2," and tupleset2.size = ",tupleset2.size);
}tupleset1 = {<1 "one"> <2 "two">} and tupleset1.size = 2
tupleset2 = {<1 "one">} and tupleset2.size = 1| size |
| Method Attributes | Method Name and Description |
|---|---|
| all |
add(componentValue, componentValueN)
Adds a new tuple with the given component values.
|
| all |
addOnly(componentValue, componentValueN)
Adds a new tuple with the given component values, without returning the tuple.
|
| all |
clear()
Removes all tuples from the set.
|
| all |
find(componentValue, componentValueN)
Finds the tuple with the component values you pass as parameters.
|
| all |
get(componentValue, componentValueN)
Gets the tuple with the component values you pass as parameters.
|
| all |
getFieldName(i)
Returns the name of the field at position
i. |
| all |
Returns the number of fields of the tuple of this set.
|
| all |
importSet(tSet)
Adds an external tupleset.
|
| all |
remove(componentValue, componentValueN)
Removes the tuple.
|
| addAll, contains, end, isOrdered, isReversed, isSorted |
The values are passed in the order of declaration of the tuple type.
If the tuple already exists, the method returns the existing tuple.
If the set is sorted, all previous instances of tuples will be invalidated.
The fastest method to populate a set is to use addOnly().
The values are passed in the order of declaration of the tuple type.
This method is faster than add() and uses less memory as it returns nothing.
You can pass all the components or all the key components, in the order of declaration of the tuple type.
If no tuple exists, the value null is returned.
null.You can pass all the components or all the key components, in the order of declaration of the tuple type.
If no tuple exists, a runtime error is raised.
i.
writeln("Tuple:");
for (var i =0; i < ts.getNFields(); i++) {
var f = ts.getFieldName(i);
writeln(" field name: ", f );
}