Package com.io7m.jaffirm.core
Class ContractDoubleCondition
- java.lang.Object
-
- com.io7m.jaffirm.core.ContractDoubleCondition
-
- All Implemented Interfaces:
ContractDoubleConditionType
public final class ContractDoubleCondition extends java.lang.Object implements ContractDoubleConditionType
Adoublespecialized version of theContractConditionTypetype.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContractDoubleCondition.BuilderBuilds instances of typeContractDoubleCondition.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContractDoubleCondition.Builderbuilder()Creates a builder forContractDoubleCondition.static ContractDoubleConditioncopyOf(ContractDoubleConditionType instance)Creates an immutable copy of aContractDoubleConditionTypevalue.java.util.function.DoubleFunction<java.lang.String>describer()booleanequals(java.lang.Object another)This instance is equal to all instances ofContractDoubleConditionthat have equal attribute values.inthashCode()Computes a hash code from attributes:predicate,describer.static ContractDoubleConditionof(java.util.function.DoublePredicate predicate, java.util.function.DoubleFunction<java.lang.String> describer)Construct a new immutableContractDoubleConditioninstance.java.util.function.DoublePredicatepredicate()java.lang.StringtoString()Prints the immutable valueContractDoubleConditionwith attribute values.ContractDoubleConditionwithDescriber(java.util.function.DoubleFunction<java.lang.String> value)Copy the current immutable object by setting a value for thedescriberattribute.ContractDoubleConditionwithPredicate(java.util.function.DoublePredicate value)Copy the current immutable object by setting a value for thepredicateattribute.
-
-
-
Method Detail
-
predicate
public java.util.function.DoublePredicate predicate()
- Specified by:
predicatein interfaceContractDoubleConditionType- Returns:
- A predicate that must evaluate to
truefor the contract to hold
-
describer
public java.util.function.DoubleFunction<java.lang.String> describer()
- Specified by:
describerin interfaceContractDoubleConditionType- Returns:
- A function that returns a textual description of the predicate
-
withPredicate
public final ContractDoubleCondition withPredicate(java.util.function.DoublePredicate value)
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
public final ContractDoubleCondition withDescriber(java.util.function.DoubleFunction<java.lang.String> value)
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
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofContractDoubleConditionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:predicate,describer.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueContractDoubleConditionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static ContractDoubleCondition of(java.util.function.DoublePredicate predicate, java.util.function.DoubleFunction<java.lang.String> describer)
Construct a new immutableContractDoubleConditioninstance.- Parameters:
predicate- The value for thepredicateattributedescriber- The value for thedescriberattribute- Returns:
- An immutable ContractDoubleCondition instance
-
copyOf
public static ContractDoubleCondition copyOf(ContractDoubleConditionType instance)
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
public static ContractDoubleCondition.Builder builder()
Creates a builder forContractDoubleCondition.- Returns:
- A new ContractDoubleCondition builder
-
-