Class Arithmetics

java.lang.Object
org.skriptlang.skript.lang.arithmetic.Arithmetics

public final class Arithmetics extends Object
  • Constructor Details

    • Arithmetics

      public Arithmetics()
  • Method Details

    • registerOperation

      public static <T> void registerOperation(Operator operator, Class<T> type, Operation<T,T,T> operation)
    • registerOperation

      public static <L, R> void registerOperation(Operator operator, Class<L> leftClass, Class<R> rightClass, Operation<L,R,L> operation)
    • registerOperation

      public static <L, R> void registerOperation(Operator operator, Class<L> leftClass, Class<R> rightClass, Operation<L,R,L> operation, Operation<R,L,L> commutativeOperation)
    • registerOperation

      public static <L, R, T> void registerOperation(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType, Operation<L,R,T> operation, Operation<R,L,T> commutativeOperation)
    • registerOperation

      public static <L, R, T> void registerOperation(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType, Operation<L,R,T> operation)
    • operationExists

      public static boolean operationExists(Operator operator, Class<?> leftClass, Class<?> rightClass)
    • getOperations

      public static @UnmodifiableView List<OperationInfo<?,?,?>> getOperations(Operator operator)
    • getOperations

      public static <T> List<OperationInfo<T,?,?>> getOperations(Operator operator, Class<T> type)
    • getOperationInfo

      @Nullable public static <L, R, T> @Nullable OperationInfo<L,R,T> getOperationInfo(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType)
    • getOperationInfo

      @Nullable public static <L, R> @Nullable OperationInfo<L,R,?> getOperationInfo(Operator operator, Class<L> leftClass, Class<R> rightClass)
    • getOperation

      @Nullable public static <L, R, T> @Nullable Operation<L,R,T> getOperation(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType)
    • getOperation

      @Nullable public static <L, R> @Nullable Operation<L,R,?> getOperation(Operator operator, Class<L> leftClass, Class<R> rightClass)
    • lookupOperationInfo

      @Nullable public static <L, R, T> @Nullable OperationInfo<L,R,T> lookupOperationInfo(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType)
    • lookupOperationInfo

      @Nullable public static <L, R> @Nullable OperationInfo<L,R,?> lookupOperationInfo(Operator operator, Class<L> leftClass, Class<R> rightClass)
    • calculate

      public static <L, R, T> T calculate(Operator operator, L left, R right, Class<T> returnType)
    • calculateUnsafe

      public static <L, R, T> T calculateUnsafe(Operator operator, L left, R right)
    • registerDifference

      public static <T> void registerDifference(Class<T> type, Operation<T,T,T> operation)
    • registerDifference

      public static <T, R> void registerDifference(Class<T> type, Class<R> returnType, Operation<T,T,R> operation)
    • differenceExists

      public static boolean differenceExists(Class<?> type)
    • getDifferenceInfo

      public static <T, R> DifferenceInfo<T,R> getDifferenceInfo(Class<T> type, Class<R> returnType)
    • getDifferenceInfo

      public static <T> DifferenceInfo<T,?> getDifferenceInfo(Class<T> type)
    • getDifference

      public static <T, R> Operation<T,T,R> getDifference(Class<T> type, Class<R> returnType)
    • getDifference

      public static <T> Operation<T,T,?> getDifference(Class<T> type)
    • difference

      public static <T, R> R difference(T left, T right, Class<R> returnType)
    • differenceUnsafe

      public static <T, R> R differenceUnsafe(T left, T right)
    • registerDefaultValue

      public static <T> void registerDefaultValue(Class<T> type, Supplier<T> supplier)
    • getDefaultValue

      public static <R, T extends R> R getDefaultValue(Class<T> type)
    • getAllReturnTypes

      public static Collection<Class<?>> getAllReturnTypes(Operator operator)
      All registered types that could be returned from a calculation using this operator. This is used to fetch potential return types when unknown (variable) arguments are used in a sum.
      Parameters:
      operator - The operator to test
      Returns:
      Every type this could return