Class RowEvaluator
java.lang.Object
uk.ac.starlink.table.formats.RowEvaluator
Examines unknown rows (arrays of strings) to work out what they contain.
By repeatedly calling
submitRow(List) the evaluator can refine its
idea of what kind of data is represented by each column.- Since:
- 21 Sep 2004
- Author:
- Mark Taylor (Starlink)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInterface for an object that can turn a string into a cell content object.static classHelper class used to group quantities which describe what the data types found in the columns of a table are. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RowEvaluator.Decoder<?> Decoder for values that are all blank.static final RowEvaluator.Decoder<Boolean> Decoder for booleans.static final RowEvaluator.Decoder<String> Decoder for ISO-8601 dates.static final RowEvaluator.Decoder<String> Decoder for DMS sexagesimal strings.static final RowEvaluator.Decoder<Double> Decoder for doubles.static final RowEvaluator.Decoder<Float> Decoder for floats.static final RowEvaluator.Decoder<String> Decoder for HMS sexagesimal strings.static final RowEvaluator.Decoder<Integer> Decoder for integers.static final PatternRegular expression for ISO 8601 dates.static final RowEvaluator.Decoder<Long> Decoder for longs.static final RowEvaluator.Decoder<Short> Decoder for shorts.static final RowEvaluator.Decoder<String> Decoder for any old string. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new RowEvaluator which will work out the number of columns from the data using the standard list of decoders.RowEvaluator(int ncol) Constructs a new RowEvaluator which will examine rows with a fixed number of columns using the standard list of decoders.RowEvaluator(RowEvaluator.Decoder<?>[] decoders) Constructs a new RowEvaluator which will work out the number of columns from the data using a supplied list of decoders. -
Method Summary
Modifier and TypeMethodDescriptionReturns information gleaned from previoussubmitRowcalls about the kind of data that appears to be in the columns.static RowEvaluator.Decoder<?>[]Returns the standard list of decoder implementation used for identifying column types.voidLooks at a given row (list of strings) and records information about what sort of things it looks like it contains.
-
Field Details
-
ISO8601_REGEX
Regular expression for ISO 8601 dates. -
BLANK_DECODER
Decoder for values that are all blank. -
BOOLEAN_DECODER
Decoder for booleans. -
SHORT_DECODER
Decoder for shorts. -
INTEGER_DECODER
Decoder for integers. -
LONG_DECODER
Decoder for longs. -
FLOAT_DECODER
Decoder for floats. -
DOUBLE_DECODER
Decoder for doubles. -
DATE_DECODER
Decoder for ISO-8601 dates. -
HMS_DECODER
Decoder for HMS sexagesimal strings. -
DMS_DECODER
Decoder for DMS sexagesimal strings. -
STRING_DECODER
Decoder for any old string.
-
-
Constructor Details
-
RowEvaluator
public RowEvaluator()Constructs a new RowEvaluator which will work out the number of columns from the data using the standard list of decoders. -
RowEvaluator
Constructs a new RowEvaluator which will work out the number of columns from the data using a supplied list of decoders.Note the order of the supplied decoder list is significant; a type earlier in the list will be preferred over one later in the list where the data is consistent with both.
In case of no match, a string decoder will be used, even if it does not appear in the supplied list.
- Parameters:
decoders- list of allowed decoders
-
RowEvaluator
public RowEvaluator(int ncol) Constructs a new RowEvaluator which will examine rows with a fixed number of columns using the standard list of decoders.- Parameters:
ncol- column count
-
-
Method Details
-
submitRow
Looks at a given row (list of strings) and records information about what sort of things it looks like it contains.- Parameters:
row-ncol-element list of strings- Throws:
TableFormatException- if the number of elements inrowis not the same as on the first call
-
getMetadata
Returns information gleaned from previoussubmitRowcalls about the kind of data that appears to be in the columns.- Returns:
- metadata
-
getStandardDecoders
Returns the standard list of decoder implementation used for identifying column types.- Returns:
- standard decoder list
-