Class FeatureImpl

  • All Implemented Interfaces:
    Feature
    Direct Known Subclasses:
    PathFeatureImpl

    public class FeatureImpl
    extends java.lang.Object
    implements Feature
    Default implementation of Feature.
    Since:
    12.1
    • Constructor Detail

      • FeatureImpl

        public FeatureImpl​(long id,
                           FeatureElement[] elements,
                           CategorizedUserData cud)
        Constructs a feature.
        Parameters:
        id - feature ID
        type - feature type
        elements - feature elements
        cud - categorized user data associated with the feature
    • Method Detail

      • getId

        public long getId()
        Description copied from interface: Feature
        Returns the feature ID.
        Specified by:
        getId in interface Feature
        Returns:
      • getElement

        public FeatureElement getElement​(int i)
        Description copied from interface: Feature
        Returns the ith element in the feature.
        Specified by:
        getElement in interface Feature
        Parameters:
        i - feature element index
        Returns:
      • getElements

        public FeatureElement[] getElements()
        Description copied from interface: Feature
        Returns the feature elements in the feature.
        Specified by:
        getElements in interface Feature
        Returns:
      • getNumberOfElements

        public int getNumberOfElements()
        Description copied from interface: Feature
        Returns the number of elements in the feature.
        Specified by:
        getNumberOfElements in interface Feature
        Returns:
      • addElement

        public void addElement​(int i,
                               FeatureElement element)
        Description copied from interface: Feature
        Adds a feature element at the ith position of the feature.
        Specified by:
        addElement in interface Feature
        Parameters:
        i - feature element index
      • addElements

        public void addElements​(FeatureElement[] newElements)
        Description copied from interface: Feature
        Appends a list of elements to the end of the feature.
        Specified by:
        addElements in interface Feature
      • deleteElement

        public void deleteElement​(int i)
        Description copied from interface: Feature
        Deletes the ith element in the feature.
        Specified by:
        deleteElement in interface Feature
        Parameters:
        i - feature element index
      • findElement

        public int findElement​(FeatureElement element)
        Description copied from interface: Feature
        Finds the input feature element in this feature, and returns the feature element index. If the feature element is not found, returns 0.
        Specified by:
        findElement in interface Feature
        Returns:
      • setElement

        public void setElement​(int i,
                               FeatureElement element)
        Description copied from interface: Feature
        Sets the ith feature element.
        Specified by:
        setElement in interface Feature
        Parameters:
        i - feature element index
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Support cloneable
        Returns:
        cloned object
        Throws:
        java.lang.CloneNotSupportedException
      • equals

        public boolean equals​(java.lang.Object o)
        Returns true if the input feature consists of the same set of feature elements in the same order as this feature. When comparing two features, we assume the order of the feature elements matters. This method returns false if the input feature contains the same set of feature elements but in different order.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o -
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getCategorizedUserData

        public abstract CategorizedUserData getCategorizedUserData()
        Returns categorized user data.
        Returns:
      • setCategorizedUserData

        public abstract void setCategorizedUserData​(CategorizedUserData userData)
        Sets categorized user data.
        Parameters:
        userData -
      • getUserData

        public abstract UserData getUserData​(int category)
        Returns user data for the specified category.
        Returns:
      • setUserData

        public abstract void setUserData​(int category,
                                         UserData userData)
        Sets user data for the specified category.
        Parameters:
        userData -
      • getUserData

        public UserData getUserData​(int category)
      • setUserData

        public void setUserData​(int category,
                                UserData userData)