Class ContractLongCondition

java.lang.Object
com.io7m.jaffirm.core.ContractLongCondition
All Implemented Interfaces:
ContractLongConditionType

public final class ContractLongCondition extends Object implements ContractLongConditionType
A long specialized version of the ContractConditionType type.
  • Method Details

    • predicate

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

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

      public final ContractLongCondition withPredicate(LongPredicate 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 ContractLongCondition withDescriber(LongFunction<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 ContractLongCondition 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 ContractLongCondition with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

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

      public static ContractLongCondition copyOf(ContractLongConditionType instance)
      Creates an immutable copy of a ContractLongConditionType 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 ContractLongCondition instance
    • builder

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