|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Column
A column is an indexed collection of values of homogeneous type.
Values can also be undefined, which is useful for data sets with missing values.
A column has a name, can contain metadata and user properties, and triggers notification when its contents is changed. By convention, when the name of a column starts with a '#' character (sharp sign), the column is considered "internal", i.e not user supplied.
The interface defines columns as a collection of Strings. However,
the intent is that every concrete column has to provide a textual
representation for the data type it contains. The translation from
the concrete data type to the string and parsing of a string
representation to the concrete type is controlled by a
Format
.
Each column class containing objects of type TYPE implements type-specific methods with the same names (Java has no true parametric types so this has to be hand made). These methods are:
TYPE get(int index)
void set(int index, TYPE element)
void setExtend(int index, TYPE element)
void add(TYPE element)
TYPE parse(String v) throws ParseException
String format(TYPE v)
static TYPEColumn getColumn(Table t, String name)
Table
or null
if none exist.
TYPEColumn getColumn(Table t, int index)
Table
.
TYPEColumn findColumn(Table t, String name)
Table
, creating it if needed.
Field Summary |
---|
Fields inherited from interface infovis.metadata.Constants |
---|
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE |
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener listener)
Adds a listener to the list that's notified each time a change occurs. |
void |
addValue(String v)
Appends the element specified in its String representation to the end of this column. |
boolean |
addValueOrNull(String v)
Appends the element specified in its String representation to the end of this column or adds an undefined object if the String cannot be parsed. |
int |
capacity()
Returns the current capacity of this column. |
void |
clear()
Removes all of the elements from this column. |
void |
disableNotify()
Disables notification until enableNotify has been called. |
void |
enableNotify()
Re enable notifications, triggering eventListeners if modifications occur. |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this column, if necessary, to ensure that it can hold at least the number of values specified by the minimum capacity argument. |
Format |
getFormat()
Returns the format. |
int |
getMaxIndex()
Returns an the index of a row containing the maximum value of this column or -1 if the column has only undefined values or is empty. |
int |
getMinIndex()
Returns an the index of a row containing the minimum value of this column or -1 if the column has only undefined values or is empty. |
String |
getName()
Returns the column name. |
String |
getValueAt(int index)
Returns the String representation of the element at the specified position in this column or null if
the element is undefined. |
Class |
getValueClass()
Returns the class of the elements. |
boolean |
hasUndefinedValue()
Returns true if the columns contains
undefined values, false otherwise. |
boolean |
isEmpty()
Returns true if this column contains no elements. |
boolean |
isInternal()
Returns true if the column name starts with a '#'. |
boolean |
isValueUndefined(int i)
Returns true if the ith value is undefined. |
RowIterator |
iterator()
Returns a RowIterator over all the valid rows of this column. |
void |
removeChangeListener(ChangeListener listener)
Removes a listener from the list that's notified each time a change occurs. |
void |
setFormat(Format format)
Sets the format. |
void |
setName(String name)
Sets the column name. |
void |
setSize(int newSize)
Sets the size of this column. |
void |
setValueAt(int index,
String element)
Replaces the element at the specified position in this column with the element specified in its String representation or sets if undefined if the element is null
It will be read and translated using the Format. |
boolean |
setValueOrNullAt(int index,
String v)
Replaces the element at the specified position in this column with the element specified in its String representation or set it undefined if the String cannot be parsed. |
void |
setValueUndefined(int i,
boolean undef)
Sets the ith element to have an undefined value. |
int |
size()
Returns the number of elements in this column. |
Methods inherited from interface infovis.Metadata |
---|
getClientProperty, getMetadata |
Methods inherited from interface cern.colt.function.IntComparator |
---|
compare, equals |
Method Detail |
---|
String getName()
void setName(String name)
name
- The name to setboolean isInternal()
boolean isValueUndefined(int i)
isValueUndefined
in interface RowComparator
i
- the index
void setValueUndefined(int i, boolean undef)
i
- the indexundef
- true if the value should be undefined,
false otherwise.boolean hasUndefinedValue()
true
if the columns contains
undefined values, false
otherwise.
true
if the columns contains
undefined values, false
otherwise.Format getFormat()
void setFormat(Format format)
format
- The format to setboolean isEmpty()
int size()
void setSize(int newSize)
Some column will ignore this request.
newSize
- the new size.void clear()
CategoricalFormat
, it
is not cleared so results may not be what you expected. The
CategoricalFormat
can be cleared explicitely if
needed.
void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacity.int capacity()
String getValueAt(int index)
null
if
the element is undefined. The representation is
generated by the current format.
index
- index of element representation to return.
null
if the element is undefined.void setValueAt(int index, String element) throws ParseException
null
It will be read and translated using the Format. A null value
sets the value to undefined. The column is extended if
needed.
index
- index of element to replace.element
- element to be stored at the specified position.
ParseException
- if the specified string cannot be parsed.boolean setValueOrNullAt(int index, String v)
index
- index of element to setv
- element to be appended to this column.
void addValue(String v) throws ParseException
col.addValue(a)
is equivalent to
col.setValueAt(col.size(), a)
.
v
- element to be appended to this column.
ParseException
- if the specified string
cannot be parsed.boolean addValueOrNull(String v)
col.addValueOrNull(a)
is equivalent to
col.setValueAtOrNull(col.size(), a)
.
v
- element to be appended to this column.
int getMinIndex()
int getMaxIndex()
Class getValueClass()
void disableNotify()
This method is useful if a large number of modifications is going to happen on the column and notifying each time would be too time consuming. The notification will be deferred until enableNotify is called.
Calls to disableNotify can be nested
enableNotify()
void enableNotify()
disableNotify()
void addChangeListener(ChangeListener listener)
listener
- the listenervoid removeChangeListener(ChangeListener listener)
listener
- the listenerRowIterator iterator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |