Class PropertyConditional<P>
java.lang.Object
io.github.syst3ms.skriptparser.lang.base.ConditionalExpression
io.github.syst3ms.skriptparser.lang.properties.PropertyConditional<P>
- Type Parameters:
P- the type of the performer in this condition
- All Implemented Interfaces:
Expression<Boolean>, SyntaxElement
- Direct Known Subclasses:
CondExprIsDivisible, CondExprIsPrime, CondExprIsSet
This class can be used for an easier writing of conditions that contain only one type in the pattern
and are in one of the following forms:
something is somethingsomething can somethingsomething has something
- There is a useful
toString()method and it works well with the plural and negated forms. It is implemented by default. - Registration is very straightforward.
- The performer expression is automatically checked for nullity.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck(TriggerContext ctx) booleanTests this condition for each individual performer.static String[]composePatterns(String performer, ConditionalType conditionalType, String property) booleaninit(Expression<?>[] expressions, int matchedPattern, ParseContext parseContext) This defaultinit()implementation automatically properly sets the performer in this condition, which can be accessed usinggetPerformer().voidsetPerformer(Expression<P> performer) toString(TriggerContext ctx, boolean debug) protected StringtoString(TriggerContext ctx, boolean debug, String property) Methods inherited from class ConditionalExpression
getValues, isNegated, setNegatedMethods 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, stream
-
Field Details
-
PROPERTY_IDENTIFIER
- See Also:
-
CONDITIONAL_TYPE_IDENTIFIER
- See Also:
-
-
Constructor Details
-
PropertyConditional
public PropertyConditional()
-
-
Method Details
-
init
This defaultinit()implementation automatically properly sets the performer in this condition, which can be accessed usinggetPerformer(). If this implementation is overridden for one reason or another, it must callsetPerformer(Expression)properly.- Parameters:
expressions- an array of expressions representing all the expressions that are being passed to this syntax element.matchedPattern- the index of the pattern that was successfully matched. It corresponds to the order of the syntaxes in registrationparseContext- an object containing additional information about the parsing of this syntax element, like regex matches and parse marks- Returns:
- whether the initialization was successful or not.
- See Also:
-
check
- Specified by:
checkin classConditionalExpression
-
check
Tests this condition for each individual performer. Negated conditions are taken care of automatically, so one must not account for it in here.- Parameters:
performer- the performer- Returns:
- whether the conditions is true for this performer
-
toString
- Parameters:
ctx- the eventdebug- whether to show additional information or not- Returns:
- a
Stringthat should aim to resemble what is written in the script as closely as possible
-
toString
-
getPerformer
-
setPerformer
-
composePatterns
public static String[] composePatterns(String performer, ConditionalType conditionalType, String property)
-