Record Class OperationInfo<L,R,T>
java.lang.Object
java.lang.Record
org.skriptlang.skript.lang.arithmetic.OperationInfo<L,R,T>
- Type Parameters:
L
- type of the left operandR
- type of the right operandT
- return type of the operation- Record Components:
left
- type of the left operandright
- type of the right operandreturnType
- return type of the operationoperation
-Operation
that performs the actual calculation
public record OperationInfo<L,R,T> (Class<L> left, Class<R> right, Class<T> returnType, Operation<L,R,T> operation)
extends Record
Represents a binary operation including information about the types of its
operands and its return type.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.<L2,
R2> @Nullable OperationInfo <L2, R2, T> getConverted
(Class<L2> fromLeft, Class<R2> fromRight) Attempts to create a newOperationInfo
that accepts operands of typesfromLeft
andfromRight
, while maintaining the original return type and calculation of this operation info.<L2,
R2, T2>
@Nullable OperationInfo<L2, R2, T2> getConverted
(Class<L2> fromLeft, Class<R2> fromRight, Class<T2> toReturnType) Attempts to create a newOperationInfo
that accepts operands of typesfromLeft
andfromRight
, and returnstoReturnType
, while maintaining the calculation of this operation info.getLeft()
Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.getRight()
Deprecated, for removal: This API element is subject to removal in a future version.final int
hashCode()
Returns a hash code value for this object.left()
Returns the value of theleft
record component.Returns the value of theoperation
record component.Returns the value of thereturnType
record component.right()
Returns the value of theright
record component.toString()
Returns a string representation of this record class.
-
Constructor Details
-
OperationInfo
public OperationInfo(@NotNull @NotNull Class<L> left, @NotNull @NotNull Class<R> right, @NotNull @NotNull Class<T> returnType, @NotNull @NotNull Operation<L, R, T> operation) Creates an instance of aOperationInfo
record class.- Parameters:
left
- the value for theleft
record componentright
- the value for theright
record componentreturnType
- the value for thereturnType
record componentoperation
- the value for theoperation
record component
-
-
Method Details
-
getLeft
Deprecated, for removal: This API element is subject to removal in a future version. -
getRight
Deprecated, for removal: This API element is subject to removal in a future version. -
getReturnType
Deprecated, for removal: This API element is subject to removal in a future version. -
getOperation
Deprecated, for removal: This API element is subject to removal in a future version. -
getConverted
@Nullable public <L2,R2> @Nullable OperationInfo<L2,R2, getConvertedT> (Class<L2> fromLeft, Class<R2> fromRight) Attempts to create a newOperationInfo
that accepts operands of typesfromLeft
andfromRight
, while maintaining the original return type and calculation of this operation info.- Type Parameters:
L2
- type of the new left operandR2
- type of the new right operand- Parameters:
fromLeft
- type for the new left operandfromRight
- type for the new right operand- Returns:
- new
OperationInfo
capable of handling the specified input types if converters for them exist, else null
-
getConverted
@Nullable public <L2,R2, @Nullable OperationInfo<L2,T2> R2, getConvertedT2> (Class<L2> fromLeft, Class<R2> fromRight, Class<T2> toReturnType) Attempts to create a newOperationInfo
that accepts operands of typesfromLeft
andfromRight
, and returnstoReturnType
, while maintaining the calculation of this operation info.- Type Parameters:
L2
- type of the new left operandR2
- type of the new right operand- Parameters:
fromLeft
- type for the new left operandfromRight
- type for the new right operandtoReturnType
- new return type- Returns:
- new
OperationInfo
capable of handling the specified input types and return type if converters for them exist, else null
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
left
Returns the value of theleft
record component.- Returns:
- the value of the
left
record component
-
right
Returns the value of theright
record component.- Returns:
- the value of the
right
record component
-
returnType
Returns the value of thereturnType
record component.- Returns:
- the value of the
returnType
record component
-
operation
Returns the value of theoperation
record component.- Returns:
- the value of the
operation
record component
-