Class SingleInteger

    • Constructor Summary

      Constructors 
      Constructor Description
      SingleInteger()
      Initializes this function input to 0.
      SingleInteger​(int x)
      Initializes this function input to a specified value.
      SingleInteger​(SingleInteger other)
      Initializes this function input as a copy of another.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SingleInteger copy()
      Creates an identical copy of this object.
      boolean equals​(Object other)
      Indicates whether some other object is "equal to" this one.
      int get()
      Accesses the current value of this function input.
      int get​(int i)
      Accesses the current value of this function input.
      int hashCode()
      Returns a hash code value.
      int length()
      Gets the number of parameters.
      void set​(int x)
      Sets this function input to a specified value.
      void set​(int i, int x)
      Sets this function input to a specified value.
      int[] toArray​(int[] values)
      Accesses the current values of all of the parameters.
    • Constructor Detail

      • SingleInteger

        public SingleInteger()
        Initializes this function input to 0.
      • SingleInteger

        public SingleInteger​(int x)
        Initializes this function input to a specified value.
        Parameters:
        x - The initial value for this function input.
      • SingleInteger

        public SingleInteger​(SingleInteger other)
        Initializes this function input as a copy of another.
        Parameters:
        other - The other function input to copy.
    • Method Detail

      • length

        public final int length()
        Description copied from interface: IntegerValued
        Gets the number of parameters.
        Specified by:
        length in interface IntegerValued
        Returns:
        The number of parameters for this function.
      • get

        public final int get()
        Accesses the current value of this function input.
        Returns:
        The current value of this function input.
      • toArray

        public final int[] toArray​(int[] values)
        Description copied from interface: IntegerValued
        Accesses the current values of all of the parameters.
        Specified by:
        toArray in interface IntegerValued
        Parameters:
        values - An array to hold the result. If values is null or if values.length is not equal to this.length(), then a new array is constructed for the result.
        Returns:
        An array containing the current values of all of the parameters.
      • get

        public final int get​(int i)
        Accesses the current value of this function input. This method originates with the IntegerValued interface. Since this is a univariate function, there is only 1 input variable by definition. Rather than throw an exception for values of i other than 0, this method ignores the i parameter and is equivalent to the get() method regardless of value passed for i.
        Specified by:
        get in interface IntegerValued
        Parameters:
        i - The input to get (ignored by this implementation since this is an input for a univariate function).
        Returns:
        The current value of this function input.
      • set

        public void set​(int x)
        Sets this function input to a specified value.
        Parameters:
        x - The new value for this function input.
      • set

        public final void set​(int i,
                              int x)

        Sets this function input to a specified value. This method originates with the IntegerValued interface. Since this is a univariate function, there is only 1 input variable by definition. Rather than throw an exception for values of i other than 0, this method ignores the i parameter and is equivalent to the set(int) method regardless of value passed for i.

        This method delegates work to the set(int) method, so the behavior of this method will be consistent with any subclasses that override set(int).

        Specified by:
        set in interface IntegerValued
        Parameters:
        i - The input variable to set (ignored by this implementation since this is an input for a univariate function).
        x - The new value for this function input.
      • equals

        public boolean equals​(Object other)
        Indicates whether some other object is "equal to" this one. To be equal, the other object must be of the same runtime type and contain the same value of the function input.
        Overrides:
        equals in class Object
        Parameters:
        other - The other object to compare.
        Returns:
        true if other is not null, is of the same runtime type as this, and contains the same function input value.
      • hashCode

        public int hashCode()
        Returns a hash code value.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value