Class ContractDoubleCondition

java.lang.Object
com.io7m.jaffirm.core.ContractDoubleCondition
All Implemented Interfaces:
ContractDoubleConditionType

public final class ContractDoubleCondition extends Object implements ContractDoubleConditionType
A double specialized version of the ContractConditionType type.
  • Method Details

    • predicate

      public DoublePredicate predicate()
      Specified by:
      predicate in interface ContractDoubleConditionType
      Returns:
      A predicate that must evaluate to true for the contract to hold
    • describer

      public DoubleFunction<String> describer()
      Specified by:
      describer in interface ContractDoubleConditionType
      Returns:
      A function that returns a textual description of the predicate
    • withPredicate

      public final ContractDoubleCondition withPredicate(DoublePredicate value)
      Copy the current immutable object by setting a value for the predicate attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for predicate
      Returns:
      A modified copy of the this object
    • withDescriber

      public final ContractDoubleCondition withDescriber(DoubleFunction<String> value)
      Copy the current immutable object by setting a value for the describer attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for describer
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ContractDoubleCondition that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: predicate, describer.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ContractDoubleCondition with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static ContractDoubleCondition of(DoublePredicate predicate, DoubleFunction<String> describer)
      Construct a new immutable ContractDoubleCondition instance.
      Parameters:
      predicate - The value for the predicate attribute
      describer - The value for the describer attribute
      Returns:
      An immutable ContractDoubleCondition instance
    • copyOf

      public static ContractDoubleCondition copyOf(ContractDoubleConditionType instance)
      Creates an immutable copy of a ContractDoubleConditionType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ContractDoubleCondition instance
    • builder

      public static ContractDoubleCondition.Builder builder()
      Creates a builder for ContractDoubleCondition.
      Returns:
      A new ContractDoubleCondition builder