Package com.io7m.jaffirm.core
Class ContractDoubleCondition
java.lang.Object
com.io7m.jaffirm.core.ContractDoubleCondition
- All Implemented Interfaces:
ContractDoubleConditionType
A
double specialized version of the ContractConditionType
type.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeContractDoubleCondition. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forContractDoubleCondition.static ContractDoubleConditioncopyOf(ContractDoubleConditionType instance) Creates an immutable copy of aContractDoubleConditionTypevalue.booleanThis instance is equal to all instances ofContractDoubleConditionthat have equal attribute values.inthashCode()Computes a hash code from attributes:predicate,describer.static ContractDoubleConditionof(DoublePredicate predicate, DoubleFunction<String> describer) Construct a new immutableContractDoubleConditioninstance.toString()Prints the immutable valueContractDoubleConditionwith attribute values.final ContractDoubleConditionwithDescriber(DoubleFunction<String> value) Copy the current immutable object by setting a value for thedescriberattribute.final ContractDoubleConditionwithPredicate(DoublePredicate value) Copy the current immutable object by setting a value for thepredicateattribute.
-
Method Details
-
predicate
- Specified by:
predicatein interfaceContractDoubleConditionType- Returns:
- A predicate that must evaluate to
truefor the contract to hold
-
describer
- Specified by:
describerin interfaceContractDoubleConditionType- Returns:
- A function that returns a textual description of the predicate
-
withPredicate
Copy the current immutable object by setting a value for thepredicateattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for predicate- Returns:
- A modified copy of the
thisobject
-
withDescriber
Copy the current immutable object by setting a value for thedescriberattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for describer- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofContractDoubleConditionthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:predicate,describer. -
toString
Prints the immutable valueContractDoubleConditionwith attribute values. -
of
public static ContractDoubleCondition of(DoublePredicate predicate, DoubleFunction<String> describer) Construct a new immutableContractDoubleConditioninstance.- Parameters:
predicate- The value for thepredicateattributedescriber- The value for thedescriberattribute- Returns:
- An immutable ContractDoubleCondition instance
-
copyOf
Creates an immutable copy of aContractDoubleConditionTypevalue. 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
Creates a builder forContractDoubleCondition.- Returns:
- A new ContractDoubleCondition builder
-