Class AbstractField

    • Field Detail

      • SEPARATOR_DISPLAY

        public static final String SEPARATOR_DISPLAY
        the replacement for tabs in the fields when displaying in the GUI.
        See Also:
        Constant Field Values
      • m_Name

        protected String m_Name
        the name of the field.
      • m_Prefix

        protected String m_Prefix
        the prefix part of the name (if applicable).
      • m_Suffix

        protected String m_Suffix
        the suffix part of the name (if applicable).
      • m_DataType

        protected DataType m_DataType
        the data type.
    • Constructor Detail

      • AbstractField

        public AbstractField()
        Constructor. Sets the name to null and the type to UNKNOWN.
      • AbstractField

        public AbstractField​(AbstractField field)
        Uses the values from the given field.
        Parameters:
        field - the field to use as basis
      • AbstractField

        public AbstractField​(String prefix,
                             String suffix,
                             DataType dt)
        Constructor.
        Parameters:
        prefix - the prefix of the compound field
        suffix - the prefix of the compound field
        dt - the type of the field, UNKNOWN is used if null
      • AbstractField

        public AbstractField​(String name,
                             DataType dt)
        Constructor.
        Parameters:
        name - the name of the field
        dt - the type of the field, UNKNOWN is used if null
    • Method Detail

      • getName

        public String getName()
        Get field name.
        Returns:
        the field name
      • getDataType

        public DataType getDataType()
        Get datatype.
        Returns:
        the data type
      • isCompound

        public boolean isCompound()
        Checks whether the name is a compound one, i.e., contains a SEPARATOR.
        Returns:
        true if name is a compound one
        See Also:
        SEPARATOR
      • split

        public String[] split()
        Returns the name split up in its single parts.
        Returns:
        the parts of the compound name
        See Also:
        SEPARATOR
      • toParseableString

        public String toParseableString()
        Returns the name and the type (format: name[type]). Can be restored with parseField.
        Returns:
        the name and type
        See Also:
        parseField(String)
      • toString

        public String toString()
        Returns the name of the field.
        Overrides:
        toString in class Object
        Returns:
        the name
      • toDisplayString

        public String toDisplayString()
        Returns the name of the field.
        Returns:
        the name
      • toString

        public String toString​(Object o)
        String representation.
        Parameters:
        o - the object to turn into a string
        Returns:
        the string
      • valueOf

        public Object valueOf​(String s)
        Parse string to appropriate datatype.
        Parameters:
        s - the string to parse
        Returns:
        the parsed object: STRING, NUMERIC or BOOLEAN
      • escape

        protected static String escape​(String name,
                                       String separator)
        Escapes the name.
        Parameters:
        name - the name to escape
        separator - the separator to use
        Returns:
        the escaped name
      • unescape

        protected static String unescape​(String name)
        Unescapes the name.
        Parameters:
        name - the name to unescape
        Returns:
        the unescaped name
      • 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
      • 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 interface Comparable
        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.
      • equals

        public boolean equals​(Object o)
        The equals method (only uses the name).
        Overrides:
        equals in class Object
        Parameters:
        o - the object to compare with
        Returns:
        true if the same name
      • hashCode

        public int hashCode()
        Hashcode so can be used as hashtable key. Returns the hashcode of the name.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • getPrefix

        public String getPrefix()
        Returns the prefix for compound fields.
        Returns:
        the prefix, null if not compound field
      • getSuffix

        public String getSuffix()
        Returns the suffix for compound fields.
        Returns:
        the suffix, null if not compound field
      • newField

        public abstract AbstractField newField​(String name,
                                               DataType dtype)
        Returns a new field.
        Parameters:
        name - the name of the field
        dtype - the data type of the field
        Returns:
        the new field
      • replacePrefix

        public AbstractField replacePrefix​(String prefix)
        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.
        Parameters:
        prefix - the new prefix
        Returns:
        the generated field
      • replacePrefix

        public abstract 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.
        Parameters:
        prefix - the new prefix
        dt - the data type to use
        Returns:
        the generated field
      • replaceSuffix

        public AbstractField replaceSuffix​(String suffix)
        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.
        Parameters:
        suffix - the new suffix
        Returns:
        the generated field
      • replaceSuffix

        public abstract 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.
        Parameters:
        suffix - the new suffix
        dt - the data type to use
        Returns:
        the generated field
      • fixString

        public static String fixString​(String s)
        Replaces ' with `.
        Parameters:
        s - the string to process
        Returns:
        the processed string