Class HeaderDefinition

    • Field Detail

      • m_Dataset

        protected String m_Dataset
        the name of the "dataset".
      • m_Names

        protected List<String> m_Names
        the names.
      • m_HashCode

        protected Integer m_HashCode
        the hashcode.
    • Constructor Detail

      • HeaderDefinition

        public HeaderDefinition()
        Initializes the header with default dataset name DEFAULT_DATASET_NAME and empty set of features.
      • HeaderDefinition

        public HeaderDefinition​(String dataset)
        Initializes the header with the given dataset name and empty set of features.
        Parameters:
        dataset - the name of the dataset, uses DEFAULT_DATASET_NAME if null
      • HeaderDefinition

        public HeaderDefinition​(String dataset,
                                List<String> names,
                                List<DataType> types)
        Initializes the header.
        Parameters:
        dataset - the name of the dataset, uses DEFAULT_DATASET_NAME if null
        names - the names of the fields
        types - the types of the fields
    • Method Detail

      • setDataset

        public void setDataset​(String value)
        Sets the name of the dataset.
        Parameters:
        value - the name, uses DEFAULT_DATASET_NAME if null
      • getDataset

        public String getDataset()
        Returns the name of the dataset.
        Returns:
        the name
      • getNames

        public List<String> getNames()
        Returns the names.
        Returns:
        the names
      • getTypes

        public List<DataType> getTypes()
        Returns the data types.
        Returns:
        the types
      • size

        public int size()
        Returns the number of fields.
        Returns:
        the total
      • getName

        public String getName​(int index)
        Returns the name at the specified index.
        Parameters:
        index - the index of the name to retrieve
        Returns:
        the name
      • getType

        public DataType getType​(int index)
        Returns the data type at the specified index.
        Parameters:
        index - the index of the data type to retrieve
        Returns:
        the data type
      • rename

        public void rename​(int index,
                           String name)
        Renames the name at the specified index.
        Parameters:
        index - the index of the name to rename
        name - the new name
      • add

        public void add​(int index,
                        String name,
                        DataType type)
        Inserts the definition at the specified position.
        Parameters:
        index - the index to insert the definition
        name - the feature name
        type - the data type of the feature
      • add

        public void add​(String name,
                        DataType type)
        Adds the definition at the end.
        Parameters:
        name - the feature name
        type - the data type of the feature
      • add

        public void add​(HeaderDefinition definition)
        Adds all the definitions at the end.
        Parameters:
        definition - the definitions to add
      • remove

        public void remove​(int index)
        Removes the specified definition.
        Parameters:
        index - the index of the name/type to remove
      • hashCode

        public int hashCode()
        Returns the hashcode.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • compareTo

        public int compareTo​(HeaderDefinition o)
        Compares itself with the specified object.
        Specified by:
        compareTo in interface Comparable<HeaderDefinition>
        Parameters:
        o - the object to compare with
        Returns:
        returns less than, equal to or greater than zero if this object is less than, equal to or greater than the specified object
      • equals

        public boolean equals​(Object obj)
        Returns whether this object is the same as the specified one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare with
        Returns:
        true if the same
      • toString

        public String toString()
        Returns the header definition as string.
        Overrides:
        toString in class Object
        Returns:
        the header definition