Class ConditionalExpression
java.lang.Object
io.github.syst3ms.skriptparser.lang.base.ConditionalExpression
- All Implemented Interfaces:
Expression<Boolean>, SyntaxElement
- Direct Known Subclasses:
CondExprCompare, CondExprContains, CondExprDateCompare, CondExprIsEmpty, CondExprMatch, CondExprStartsEnds, PropertyConditional
A base class for all boolean expressions (i.e Expression<Boolean>) that should be treated as
"conditional". This means that they can't be used "as-is" (e.g in trying to set a variable to them).
Instead, they can only be used either in :
- Conditions (if and else if)
- While loops
- Expression whose boolean parameters are declared as %=boolean% inside their syntax.
whether %=boolean% expression.
Other, non-conditional boolean expressions should implement Expression<Boolean>- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleancheck(TriggerContext ctx) Boolean[]getValues(TriggerContext ctx) Retrieves all values of this Expression, accounting for possible modifiers.booleanWhether a condition is negated.voidsetNegated(boolean negated) Decides whether the output of a condition should be inverted in order to create a "negated" condition.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Expression
acceptsChange, acceptsChange, acceptsChange, change, check, check, convertExpression, getArray, getReturnType, getSingle, getSource, isAndList, isLoopOf, isSingle, iterator, setAndList, streamMethods inherited from interface SyntaxElement
init, toString
-
Constructor Details
-
ConditionalExpression
public ConditionalExpression()
-
-
Method Details
-
getValues
Description copied from interface:ExpressionRetrieves all values of this Expression, accounting for possible modifiers. This means that if this is an or-list, it will choose a random value to return.- Specified by:
getValuesin interfaceExpression<Boolean>- Parameters:
ctx- the event- Returns:
- an array of the values
- See Also:
-
check
-
isNegated
public boolean isNegated()Whether a condition is negated. This is used in conjunction withsetNegated(boolean).- Returns:
- whether the condition is negated
-
setNegated
public void setNegated(boolean negated) Decides whether the output of a condition should be inverted in order to create a "negated" condition. This was made a built-in method because it is a very common feature of conditions.- Parameters:
negated- whether the condition should be negated
-