Package generic

Record Class End.Point<T>

java.lang.Object
java.lang.Record
generic.End.Point<T>
Type Parameters:
T - the type of values
Record Components:
val - the value of the endpoint
epsilon - determines whether the endpoint is included
All Implemented Interfaces:
End<T>
Enclosing interface:
End<T>

public static record End.Point<T>(T val, End.Epsilon epsilon) extends Record implements End<T>
An endpoint representing a bound
  • Constructor Details

    • Point

      public Point(T val, End.Epsilon epsilon)
      Creates an instance of a Point record class.
      Parameters:
      val - the value for the val record component
      epsilon - the value for the epsilon record component
  • Method Details

    • toMinString

      public String toMinString(Function<? super End<T>,String> nToString)
      Specified by:
      toMinString in interface End<T>
      Parameters:
      nToString - the endpoint-to-string function
      Returns:
      the string
      See Also:
    • toMaxString

      public String toMaxString(Function<? super End<T>,String> nToString)
      Specified by:
      toMaxString in interface End<T>
      Parameters:
      nToString - the endpoint-to-string function
      Returns:
      the string
      See Also:
    • inc

      public End<T> inc()
      Description copied from interface: End
      Increment this endpoint, only by changing the coefficient of epsilon
      Specified by:
      inc in interface End<T>
      Returns:
      the resulting endpoint
    • dec

      public End<T> dec()
      Description copied from interface: End
      Decrement this endpoint, only by changing the coefficient of epsilon
      Specified by:
      dec in interface End<T>
      Returns:
      the resulting endpoint
    • isValidMin

      public boolean isValidMin()
      Description copied from interface: End
      Check if this endpoint is allowed as a lower endpoint
      Specified by:
      isValidMin in interface End<T>
      Returns:
      true if allowed
    • isValidMax

      public boolean isValidMax()
      Description copied from interface: End
      Check if this endpoint is allowed as an upper endpoint
      Specified by:
      isValidMax in interface End<T>
      Returns:
      true if allowed
    • isInclusive

      public boolean isInclusive()
      Description copied from interface: End
      Check if this endpoint includes its value
      Specified by:
      isInclusive in interface End<T>
      Returns:
      true if included
    • compareTo

      public int compareTo(End<T> that, Comparator<T> comparator)
      Description copied from interface: End
      Compare two endpoints

      First, the values of infinity are considered. Then, the values of the endpoints are considered. Finally, the coefficients of epsilon are considered.

      Specified by:
      compareTo in interface End<T>
      Parameters:
      that - the other endpoint
      comparator - the value comparator
      Returns:
      the result as in Comparator.compare(Object, Object)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • val

      public T val()
      Returns the value of the val record component.
      Returns:
      the value of the val record component
    • epsilon

      public End.Epsilon epsilon()
      Returns the value of the epsilon record component.
      Returns:
      the value of the epsilon record component