Class Arithmetics
java.lang.Object
org.skriptlang.skript.lang.arithmetic.Arithmetics
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <L,
R, T> T static <L,
R, T> T calculateUnsafe
(Operator operator, L left, R right) static <T,
R> R difference
(T left, T right, Class<R> returnType) static boolean
differenceExists
(Class<?> type) static <T,
R> R differenceUnsafe
(T left, T right) static boolean
exactDifferenceExists
(Class<?> type) static boolean
exactOperationExists
(Operator operator, Class<?> leftClass, Class<?> rightClass) static Collection
<Class<?>> getAllReturnTypes
(Operator operator) All registered types that could be returned from a calculation using this operator.static <R,
T extends R>
RgetDefaultValue
(Class<T> type) static <T> Operation
<T, T, ?> getDifference
(Class<T> type) static <T,
R> Operation <T, T, R> getDifference
(Class<T> type, Class<R> returnType) static <T> DifferenceInfo
<T, ?> getDifferenceInfo
(Class<T> type) static <T,
R> DifferenceInfo <T, R> getDifferenceInfo
(Class<T> type, Class<R> returnType) static <L,
R> @Nullable Operation <L, R, ?> getOperation
(Operator operator, Class<L> leftClass, Class<R> rightClass) static <L,
R, T> @Nullable Operation <L, R, T> getOperation
(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType) static <L,
R> @Nullable OperationInfo <L, R, ?> getOperationInfo
(Operator operator, Class<L> leftClass, Class<R> rightClass) static <L,
R, T> @Nullable OperationInfo <L, R, T> getOperationInfo
(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType) static @UnmodifiableView List
<OperationInfo<?, ?, ?>> getOperations
(Operator operator) static <T> List
<OperationInfo<T, ?, ?>> getOperations
(Operator operator, Class<T> type) static <L,
R> @Nullable OperationInfo <L, R, ?> lookupOperationInfo
(Operator operator, Class<L> leftClass, Class<R> rightClass) static <L,
R, T> @Nullable OperationInfo <L, R, T> lookupOperationInfo
(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType) static boolean
operationExists
(Operator operator, Class<?> leftClass, Class<?> rightClass) static <T> void
registerDefaultValue
(Class<T> type, Supplier<T> supplier) static <T,
R> void registerDifference
(Class<T> type, Class<R> returnType, Operation<T, T, R> operation) static <T> void
registerDifference
(Class<T> type, Operation<T, T, T> operation) static <L,
R, T> void registerOperation
(Operator operator, Class<L> leftClass, Class<R> rightClass, Class<T> returnType, Operation<L, R, T> operation) 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) static <L,
R> void registerOperation
(Operator operator, Class<L> leftClass, Class<R> rightClass, Operation<L, R, L> operation) static <L,
R> void registerOperation
(Operator operator, Class<L> leftClass, Class<R> rightClass, Operation<L, R, L> operation, Operation<R, L, L> commutativeOperation) static <T> void
registerOperation
(Operator operator, Class<T> type, Operation<T, T, T> operation)
-
Constructor Details
-
Arithmetics
public Arithmetics()
-
-
Method Details
-
registerOperation
-
registerOperation
-
registerOperation
-
registerOperation
-
registerOperation
-
exactOperationExists
-
operationExists
-
getOperations
-
getOperations
-
getOperationInfo
@Nullable public static <L,R, @Nullable OperationInfo<L,T> R, getOperationInfoT> (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
-
getOperation
-
lookupOperationInfo
@Nullable public static <L,R, @Nullable OperationInfo<L,T> R, lookupOperationInfoT> (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
-
calculateUnsafe
-
registerDifference
-
registerDifference
-
exactDifferenceExists
-
differenceExists
-
getDifferenceInfo
-
getDifferenceInfo
-
getDifference
-
getDifference
-
difference
-
differenceUnsafe
public static <T,R> R differenceUnsafe(T left, T right) -
registerDefaultValue
-
getDefaultValue
-
getAllReturnTypes
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
-