- QuickSort
- HeapSort
- InsSort
- NoSort
An iteration is defined by giving the columns over which to iterate. For example, take a UV data set with "axes" frequency, baseline and time. Getting all frequencies per time and baseline can be done by iterating over columns time and baseline (as shown in the example). The main iteration column must be given first. It is possible to define an iteration order per column. It is also possible to define a compare function per column. This can, for example, be used to iterate in intervals by treating a range of values as equal (e.g. iterate in 60 seconds time intervals).
Currently the table is sorted before doing the iteration. This may change in the future when, for example, indices are supported.
// Iterate over time and baseline (by default in ascending order). // Time is the main iteration order. Table t; Table tab ("UV_Table.data"); Block<String> iv0(2); iv0[0] = "time"; iv0[1] = "baseline"; // Create the iterator. This will prepare the first subtable. TableIterator iter(tab, iv0); Int nr = 0; while (!iter.pastEnd()) { // Get the first subtable. // This will contain rows with equal time and baseline. t = iter.table(); cout << t.nrow() << " "; nr++; // Prepare the next subtable with the next time,baseline value. iter.next(); } cout << endl << nr << " iteration steps" << endl;
Create a table iterator for the given table. Each iteration step results in a Table containing all rows in which the values in each given column is equal. An iteration order can be given; it default to DontCare. Per column a compare function can be given to use other compare functions than the standard ones defined in Compare.h. The compare functions are used for both the sort and the iteration. The option argument makes it possible to choose from various sorting algorithms. Usually QuickSort is the fastest, but for some ill-conditioned input HeapSort performs much better. InsSort (insertion sort) should only be used when the input is almost in order. When the table is already in order, the sort step can be bypassed by giving the option TableIterator::NoSort. The default option is HeapSort.
Give the iteration order per column.
Create a table iterator for the given table. Each iteration step results in a Table containing all rows in which the values in each given column is equal. An iteration order can be given; it default to DontCare. Per column a compare function can be given to use other compare functions than the standard ones defined in Compare.h. The compare functions are used for both the sort and the iteration. The option argument makes it possible to choose from various sorting algorithms. Usually QuickSort is the fastest, but for some ill-conditioned input HeapSort performs much better. InsSort (insertion sort) should only be used when the input is almost in order. When the table is already in order, the sort step can be bypassed by giving the option TableIterator::NoSort. The default option is HeapSort.
Give the iteration order per column. Give an optional compare function per column. A zero pointer means that the default compare function will be used.
Create a table iterator for the given table. Each iteration step results in a Table containing all rows in which the values in each given column is equal. An iteration order can be given; it default to DontCare. Per column a compare function can be given to use other compare functions than the standard ones defined in Compare.h. The compare functions are used for both the sort and the iteration. The option argument makes it possible to choose from various sorting algorithms. Usually QuickSort is the fastest, but for some ill-conditioned input HeapSort performs much better. InsSort (insertion sort) should only be used when the input is almost in order. When the table is already in order, the sort step can be bypassed by giving the option TableIterator::NoSort. The default option is HeapSort.
Copy constructor (copy semantics).
Assignment (copy semantics).
Test if the object is null, i.e. does not reference a table yet. This is the case if the default constructor is used.
Throw an exception if the object is null, i.e. if function isNull() is True.
Reset the iterator (i.e. restart iteration).
Test if at the end.
Go to the next group.
Get the current group.