Class Attribute

  • Direct Known Subclasses:
    NominalAttribute, NumericAttribute

    abstract class Attribute
    extends java.lang.Object
    Stores information for an attribute. An attribute has a name.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name
      this attribute's name
    • Constructor Summary

      Constructors 
      Constructor Description
      Attribute()
      Default constructor.
      Attribute​(java.lang.String name)
      Explicit constructor that sets the name of this attribute.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Gets the name of this attribute.
      void setName​(java.lang.String name)
      Sets the name of this attribute to the specified name.
      (package private) abstract int size()
      Gets the size of this attribute's domain.
      java.lang.String toString()
      Returns a string representation of this attribute with the @attribute tag followed by the name.
      (package private) abstract boolean validValue​(java.lang.Object value)
      Returns whether the specified value is valid for the attribute.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        protected java.lang.String name
        this attribute's name
    • Constructor Detail

      • Attribute

        public Attribute()
        Default constructor.
      • Attribute

        public Attribute​(java.lang.String name)
        Explicit constructor that sets the name of this attribute.
        Parameters:
        name - the name of this attribute
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the name of this attribute.
        Returns:
        a string storing the name
      • size

        abstract int size()
        Gets the size of this attribute's domain.
        Returns:
        an int storing the size of the domain
      • setName

        public void setName​(java.lang.String name)
        Sets the name of this attribute to the specified name.
        Parameters:
        name - the name of this attribute
      • toString

        public java.lang.String toString()
        Returns a string representation of this attribute with the @attribute tag followed by the name.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this attribute
      • validValue

        abstract boolean validValue​(java.lang.Object value)
        Returns whether the specified value is valid for the attribute.
        Parameters:
        value - the value for testing
        Returns:
        true if the value is valid; false otherwise