Background:
The current implementation of the MetricTable looks similar to
MetricTable<H, R>. Where H is the Heading type (usually String or Enum)
and R is the Row type(Usually Object or String).
Data is currently added to the MetricTable in rows using one of the
overloaded addRow() methods.
The column iterator currently has to check against the specified row type
(to Object) because of the inflexibility in the way we currently iterate
through rows.
This approach obviously doesn't allow mixed data types in a row. Some
reports use a mixture of int, double and String.
Example:
Name, RSN, ID, ClassName, Metric1, Metric2
Groovy, 1, 1.0-r1, SomeClassInGroovy, 0.33, 0.1
Using Object or String as the row type is a work around this. But it means
the type needs to be checked on a column when using a
ColumnIterator<Object>. This is quite ugly when you have mixed data types
in a row and you want to extract certain columns in a visualization and
need to check or cast each column.
The prefferable option would be to have the ability to add data via
columns, type specifying a column. This would allow you to have multiple
data types in a row.
Issue:
Either change the behaviour of adding data by row to column or provide a
mechanism by which data can be added either way. But only allow one way to
be in effect at a time. Maybe provide an option in the constructor to
specify the add type.
The ColumnIterator would need to be updated to work properly with proper
types instead of checking aginst generic type to Object. Depending on the
difficulty of this it may be neccesary to overload the column iterator
based on type.
Example:
String StringColumnIterator(), Double DoubleColumnIterator()
or possibly specify it as a type to the iterator
ColumnIterator<T> ColumnIterator(T type);
This would allow direct iteration over specific types in a table.
Original issue reported on code.google.com by jtha...@gmail.com on 17 Jul 2007 at 5:49
Original issue reported on code.google.com by
jtha...@gmail.com
on 17 Jul 2007 at 5:49