Package adams.data.report
Class Field
- java.lang.Object
-
- adams.data.report.AbstractField
-
- adams.data.report.Field
-
- All Implemented Interfaces:
CloneHandler<AbstractField>,RegularField,Serializable,Comparable
- Direct Known Subclasses:
PrefixField,SuffixField
public class Field extends AbstractField implements RegularField
A single report field identifier.- Author:
- dale (dale at cs dot waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.data.report.AbstractField
m_DataType, m_Name, m_Prefix, m_Suffix, SEPARATOR, SEPARATOR_DISPLAY, SEPARATOR_ESCAPED
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanisValid(String s)Checks whether the field is valid.static voidmain(String[] args)For testing only.AbstractFieldnewField(String name, DataType dtype)Returns a new field.static AbstractFieldparseField(String s)Parses the given string and returns the field.AbstractFieldreplacePrefix(String prefix, DataType dt)Replaces the prefix of a Field and returns a new Field object.AbstractFieldreplaceSuffix(String suffix, DataType dt)Replaces the suffix of a Field and returns a new Field object.-
Methods inherited from class adams.data.report.AbstractField
compareTo, equals, escape, fixString, getClone, getDataType, getName, getPrefix, getSuffix, hashCode, isCompound, replacePrefix, replaceSuffix, split, toDisplayString, toParseableString, toString, toString, unescape, valueOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Constructor Detail
-
Field
public Field()
Constructor. Sets the name to null and the type to UNKNOWN.
-
Field
public Field(AbstractField field)
Uses the values from the given field.- Parameters:
field- the field to use as basis
-
Field
public Field(String prefix, String suffix, DataType dt)
Constructor.- Parameters:
prefix- the prefix of the compound fieldsuffix- the prefix of the compound fielddt- the type of the field, UNKNOWN is used if null
-
-
Method Detail
-
newField
public AbstractField newField(String name, DataType dtype)
Returns a new field.- Specified by:
newFieldin classAbstractField- Parameters:
name- the name of the fielddtype- the data type of the field- Returns:
- the new field
-
replacePrefix
public AbstractField replacePrefix(String prefix, DataType dt)
Replaces the prefix of a Field and returns a new Field object. The Field must be a compound object, if not a clone of the field is returned.- Specified by:
replacePrefixin classAbstractField- Parameters:
prefix- the new prefixdt- the data type- Returns:
- the generated field
-
replaceSuffix
public AbstractField replaceSuffix(String suffix, DataType dt)
Replaces the suffix of a Field and returns a new Field object. The Field must be a compound object, if not a clone of the field is returned.- Specified by:
replaceSuffixin classAbstractField- Parameters:
suffix- the new suffixdt- the data type- Returns:
- the generated field
-
isValid
public static boolean isValid(String s)
Checks whether the field is valid.- Parameters:
s- the string to check- Returns:
- true if valid format
- See Also:
AbstractField.toParseableString()
-
parseField
public static AbstractField parseField(String s)
Parses the given string and returns the field. The type of the field can be append with parentheses: name[type]. Otherwise, UNKNOWN is used as type.- Parameters:
s- the string to parse- Returns:
- the parsed field
-
main
public static void main(String[] args)
For testing only.- Parameters:
args- ignored
-
-