Class ExprAmount
java.lang.Object
io.github.syst3ms.skriptparser.lang.properties.PropertyExpression<Object,Number>
io.github.syst3ms.skriptparser.expressions.ExprAmount
- All Implemented Interfaces:
Expression<Number>, SyntaxElement
The amount of elements in a given list.
Note that when getting the size of a list variable, it will only return the size of the first layer of elements.
If you want to get the whole list size, including nested layers in a variable, use the recursive size instead.
- Since:
- ALPHA
-
Field Summary
Fields inherited from class PropertyExpression
PROPERTY_IDENTIFIER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionNumber[]getValues(TriggerContext ctx) A simple default method that will applyPropertyExpression.getProperty(Object)on thePropertyExpression.ownerof this property.booleaninit(Expression<?> @NotNull [] expressions, int matchedPattern, @NotNull ParseContext parseContext) This defaultinit()implementation automatically properly sets the owner of this property, which can be accessed usingPropertyExpression.getOwner().toString(TriggerContext ctx, boolean debug) Methods inherited from class PropertyExpression
composePatterns, getOwner, getProperty, isGenitive, isSingle, setOwner, toStringMethods 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, iterator, setAndList, stream
-
Constructor Details
-
ExprAmount
public ExprAmount()
-
-
Method Details
-
init
public boolean init(Expression<?> @NotNull [] expressions, int matchedPattern, @NotNull @NotNull ParseContext parseContext) Description copied from class:PropertyExpressionThis defaultinit()implementation automatically properly sets the owner of this property, which can be accessed usingPropertyExpression.getOwner(). If this implementation is overridden for one reason or another, it must callPropertyExpression.setOwner(Expression)properly.- Specified by:
initin interfaceSyntaxElement- Overrides:
initin classPropertyExpression<Object,Number> - 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:
-
getValues
Description copied from class:PropertyExpressionA simple default method that will applyPropertyExpression.getProperty(Object)on thePropertyExpression.ownerof this property.- Specified by:
getValuesin interfaceExpression<Number>- Overrides:
getValuesin classPropertyExpression<Object,Number> - Parameters:
ctx- the event- Returns:
- the values of this property after applying the
PropertyExpression.getProperty(Object)function on the owner. - See Also:
-
toString
- Specified by:
toStringin interfaceSyntaxElement- Overrides:
toStringin classPropertyExpression<Object,Number> - 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
-