Package adams.data.report
Class PrefixField
- java.lang.Object
-
- adams.data.report.AbstractField
-
- adams.data.report.Field
-
- adams.data.report.PrefixField
-
- All Implemented Interfaces:
CloneHandler<AbstractField>
,PrefixOnlyField
,RegularField
,Serializable
,Comparable
public class PrefixField extends Field implements PrefixOnlyField
A compound filed that only displays the first half of the name.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DUMMY_SUFFIX
the dummy suffix.-
Fields inherited from class adams.data.report.AbstractField
m_DataType, m_Name, m_Prefix, m_Suffix, SEPARATOR, SEPARATOR_DISPLAY, SEPARATOR_ESCAPED
-
-
Constructor Summary
Constructors Constructor Description PrefixField()
Constructor.PrefixField(AbstractField field)
Uses the values from the given field.PrefixField(String name, DataType dt)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
Compares this object with the specified object for order.AbstractField
newField(String name, DataType dtype)
Returns a new field.static PrefixField
parseField(String s)
Parses the given string and returns the field.String
toDisplayString()
Returns the prefix of the field.String
toString()
Returns the prefix of the field.-
Methods inherited from class adams.data.report.Field
isValid, main, replacePrefix, replaceSuffix
-
Methods inherited from class adams.data.report.AbstractField
equals, escape, fixString, getClone, getDataType, getName, getPrefix, getSuffix, hashCode, isCompound, replacePrefix, replaceSuffix, split, toParseableString, toString, unescape, valueOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.data.report.PrefixOnlyField
getPrefix, isCompound
-
-
-
-
Field Detail
-
DUMMY_SUFFIX
public static final String DUMMY_SUFFIX
the dummy suffix.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PrefixField
public PrefixField()
Constructor. Sets the name to null and the type to UNKNOWN.
-
PrefixField
public PrefixField(AbstractField field)
Uses the values from the given field.- Parameters:
field
- the field to use as basis
-
-
Method Detail
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.- Specified by:
compareTo
in interfaceComparable
- Overrides:
compareTo
in classAbstractField
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
toString
public String toString()
Returns the prefix of the field.- Overrides:
toString
in classAbstractField
- Returns:
- the prefix
-
toDisplayString
public String toDisplayString()
Returns the prefix of the field.- Overrides:
toDisplayString
in classAbstractField
- Returns:
- the prefix
-
newField
public AbstractField newField(String name, DataType dtype)
Returns a new field.
-
parseField
public static PrefixField 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
-
-