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 operand
R - type of the right operand
T - return type of the operation
Record Components:
left - type of the left operand
right - type of the right operand
returnType - return type of the operation
operation - 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
    Constructor
    Description
    OperationInfo(@NotNull Class<L> left, @NotNull Class<R> right, @NotNull Class<T> returnType, @NotNull Operation<L,R,T> operation)
    Creates an instance of a OperationInfo record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final 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 new OperationInfo that accepts operands of types fromLeft and fromRight, 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 new OperationInfo that accepts operands of types fromLeft and fromRight, and returns toReturnType, while maintaining the calculation of this operation info.
    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.
    Deprecated, for removal: This API element is subject to removal in a future version.
    final int
    Returns a hash code value for this object.
    Returns the value of the left record component.
    Returns the value of the operation record component.
    Returns the value of the returnType record component.
    Returns the value of the right record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a OperationInfo record class.
      Parameters:
      left - the value for the left record component
      right - the value for the right record component
      returnType - the value for the returnType record component
      operation - the value for the operation record component
  • Method Details

    • getLeft

      @Deprecated(since="2.13", forRemoval=true) public Class<L> getLeft()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getRight

      @Deprecated(since="2.13", forRemoval=true) public Class<R> getRight()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getReturnType

      @Deprecated(since="2.13", forRemoval=true) public Class<T> getReturnType()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getOperation

      @Deprecated(since="2.13", forRemoval=true) public Operation<L,R,T> getOperation()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getConverted

      @Nullable public <L2, R2> @Nullable OperationInfo<L2,R2,T> getConverted(Class<L2> fromLeft, Class<R2> fromRight)
      Attempts to create a new OperationInfo that accepts operands of types fromLeft and fromRight, while maintaining the original return type and calculation of this operation info.
      Type Parameters:
      L2 - type of the new left operand
      R2 - type of the new right operand
      Parameters:
      fromLeft - type for the new left operand
      fromRight - 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, T2> @Nullable OperationInfo<L2,R2,T2> getConverted(Class<L2> fromLeft, Class<R2> fromRight, Class<T2> toReturnType)
      Attempts to create a new OperationInfo that accepts operands of types fromLeft and fromRight, and returns toReturnType, while maintaining the calculation of this operation info.
      Type Parameters:
      L2 - type of the new left operand
      R2 - type of the new right operand
      Parameters:
      fromLeft - type for the new left operand
      fromRight - type for the new right operand
      toReturnType - new return type
      Returns:
      new OperationInfo capable of handling the specified input types and return type if converters for them exist, else null
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • left

      public Class<L> left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component
    • right

      public Class<R> right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • returnType

      public Class<T> returnType()
      Returns the value of the returnType record component.
      Returns:
      the value of the returnType record component
    • operation

      public Operation<L,R,T> operation()
      Returns the value of the operation record component.
      Returns:
      the value of the operation record component