Class IntValue

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IntValue>

    public class IntValue
    extends java.lang.Object
    implements java.lang.Comparable<IntValue>, java.io.Serializable
    A base class based on the Java int primitive for value classes that want to implement standard operations on that value without the pain of aggregating an Integer object.
    Since:
    1.2.6
    Author:
    Jonathan Locke
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int value
      the int value
    • Constructor Summary

      Constructors 
      Constructor Description
      IntValue​(int value)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(IntValue that)  
      boolean equals​(java.lang.Object that)
      Compares this Object to a given Object.
      boolean greaterThan​(int value)
      Compares this IntValue with a primitive int value.
      boolean greaterThan​(IntValue that)
      Compares this IntValue with another IntValue.
      int hashCode()
      Returns the hash code for this Object.
      boolean lessThan​(int that)
      Compares this IntValue with a primitive int value.
      boolean lessThan​(IntValue that)
      Compares this IntValue with another IntValue.
      java.lang.String toString()
      Converts this LongValue to a String.
      • Methods inherited from class java.lang.Object

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

      • value

        protected final int value
        the int value
    • Constructor Detail

      • IntValue

        public IntValue​(int value)
        Constructor.
        Parameters:
        value - the int value
    • Method Detail

      • compareTo

        public final int compareTo​(IntValue that)
        Specified by:
        compareTo in interface java.lang.Comparable<IntValue>
        Parameters:
        that - The object to compare with
        Returns:
        0 if equal, -1 if less than or 1 if greater than
      • equals

        public final boolean equals​(java.lang.Object that)
        Compares this Object to a given Object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        that - the Object to compare with
        Returns:
        0 if equal, -1 if less than the given Object's value, or 1 if greater than given Object's value
      • greaterThan

        public final boolean greaterThan​(int value)
        Compares this IntValue with a primitive int value.
        Parameters:
        value - the int value to compare with
        Returns:
        true if this IntValue is greater than the given int value
      • greaterThan

        public final boolean greaterThan​(IntValue that)
        Compares this IntValue with another IntValue.
        Parameters:
        that - the IntValue to compare with
        Returns:
        true if this IntValue is greater than the given IntValue
      • hashCode

        public final int hashCode()
        Returns the hash code for this Object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash code for this Object
      • lessThan

        public final boolean lessThan​(int that)
        Compares this IntValue with a primitive int value.
        Parameters:
        that - the int value to compare with
        Returns:
        true if this IntValue is less than the given int value
      • lessThan

        public final boolean lessThan​(IntValue that)
        Compares this IntValue with another IntValue.
        Parameters:
        that - the IntValue to compare with
        Returns:
        true if this IntValue is less than the given IntValue
      • toString

        public java.lang.String toString()
        Converts this LongValue to a String.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of this LongValue