Package io.dialob.program.expr.arith
Class ImmutableBinaryOperator<T>
- java.lang.Object
-
- io.dialob.program.expr.arith.ImmutableBinaryOperator<T>
-
- All Implemented Interfaces:
BinaryOperator<T>,Expression,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableBinaryOperator<T> extends Object implements BinaryOperator<T>
Immutable implementation ofBinaryOperator.Use the builder to create immutable instances:
ImmutableBinaryOperator.builder().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableBinaryOperator.Builder<T>Builds instances of typeImmutableBinaryOperator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ImmutableBinaryOperator.Builder<T>builder()Creates a builder forImmutableBinaryOperator.static <T> ImmutableBinaryOperator<T>copyOf(BinaryOperator<T> instance)Creates an immutable copy of aBinaryOperatorvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableBinaryOperatorthat have equal attribute values.com.google.common.collect.ImmutableList<Expression>getNodes()Reducer<T>getReducer()inthashCode()Computes a hash code from attributes:nodes,reducer.StringtoString()Prints the immutable valueBinaryOperatorwith attribute values.ImmutableBinaryOperator<T>withNodes(Expression... elements)Copy the current immutable object with elements that replace the content ofnodes.ImmutableBinaryOperator<T>withNodes(Iterable<? extends Expression> elements)Copy the current immutable object with elements that replace the content ofnodes.ImmutableBinaryOperator<T>withReducer(Reducer<T> value)Copy the current immutable object by setting a value for thereducerattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.dialob.program.expr.arith.BinaryOperator
eval, getEvalRequiredConditions, getValueType
-
-
-
-
Method Detail
-
getNodes
public com.google.common.collect.ImmutableList<Expression> getNodes()
- Specified by:
getNodesin interfaceBinaryOperator<T>- Returns:
- The value of the
nodesattribute
-
getReducer
public Reducer<T> getReducer()
- Specified by:
getReducerin interfaceBinaryOperator<T>- Returns:
- The value of the
reducerattribute
-
withNodes
public final ImmutableBinaryOperator<T> withNodes(Expression... elements)
Copy the current immutable object with elements that replace the content ofnodes.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withNodes
public final ImmutableBinaryOperator<T> withNodes(Iterable<? extends Expression> elements)
Copy the current immutable object with elements that replace the content ofnodes. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of nodes elements to set- Returns:
- A modified copy of
thisobject
-
withReducer
public final ImmutableBinaryOperator<T> withReducer(Reducer<T> value)
Copy the current immutable object by setting a value for thereducerattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for reducer- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableBinaryOperatorthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:nodes,reducer.
-
toString
public String toString()
Prints the immutable valueBinaryOperatorwith attribute values.
-
copyOf
public static <T> ImmutableBinaryOperator<T> copyOf(BinaryOperator<T> instance)
Creates an immutable copy of aBinaryOperatorvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Type Parameters:
T- generic parameter T- Parameters:
instance- The instance to copy- Returns:
- A copied immutable BinaryOperator instance
-
builder
public static <T> ImmutableBinaryOperator.Builder<T> builder()
Creates a builder forImmutableBinaryOperator.ImmutableBinaryOperator.<T>builder() .addNodes|addAllNodes(io.dialob.program.model.Expression) //nodeselements .reducer(io.dialob.program.expr.arith.Reducer<T>) // requiredreducer.build();- Type Parameters:
T- generic parameter T- Returns:
- A new ImmutableBinaryOperator builder
-
-