Class ExprLoopValue
java.lang.Object
io.github.syst3ms.skriptparser.lang.lambda.SectionValue<SecLoop,Object>
io.github.syst3ms.skriptparser.expressions.ExprLoopValue
- All Implemented Interfaces:
Expression<Object>, SyntaxElement
The currently looped value.
- Since:
- ALPHA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> Optional<? extends Expression<R>> convertExpression(Class<R> to) Converts this expression from it's current type (T) to another type, using converters.Class<?> Object[]getSectionValues(SecLoop loop, TriggerContext ctx) Returns the values of thisSectionValue, akin to the output ofExpression.getValues(TriggerContext), given the linked section and theTriggerContext.Returns the selector function for thisSectionValue.booleanpreInitialize(Expression<?>[] expressions, int matchedPattern, ParseContext parseContext) This method is run before the section linked to thisSectionValueis identified, and should be used to initialize fields and other class data using the usual parameters of theSyntaxElement.init(Expression[], int, ParseContext)function.toString(TriggerContext ctx, boolean debug) Methods inherited from class SectionValue
getValues, init, postInitializeMethods 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, getArray, getSingle, getSource, isAndList, isLoopOf, isSingle, iterator, setAndList, stream
-
Constructor Details
-
ExprLoopValue
public ExprLoopValue()
-
-
Method Details
-
preInitialize
public boolean preInitialize(Expression<?>[] expressions, int matchedPattern, ParseContext parseContext) Description copied from class:SectionValueThis method is run before the section linked to thisSectionValueis identified, and should be used to initialize fields and other class data using the usual parameters of theSyntaxElement.init(Expression[], int, ParseContext)function.- Specified by:
preInitializein classSectionValue<SecLoop,Object> - Parameters:
expressions- an array of expressions representing all the expressions that are being passed to thisSectionValue. As opposed to Skript, elements of this array can't benull.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 thisSectionValue, like regex matches and parse marks- Returns:
trueif theSectionValuewas pre-initialized successfully,falseotherwise.- See Also:
-
getSelectorFunction
Description copied from class:SectionValueReturns the selector function for thisSectionValue. This function is supplied with a list of all the sections of the type described bySectionValue.getSectionClass(), and returns an Optional describing the section that thisSectionValueshould be linked to, or an empty Optional if no matching section was found. This is useful for targeting a specific section out of multiple surrounding ones based on criteria specific to the implementation. By default, this always picks the first matching function (i.e the innermost one), if there is one.- Overrides:
getSelectorFunctionin classSectionValue<SecLoop,Object> - Returns:
- the selector function for this
SectionValue.
-
convertExpression
Description copied from interface:ExpressionConverts this expression from it's current type (T) to another type, using converters.- Type Parameters:
R- the type to convert this Expression to- Parameters:
to- the class of the type to convert this Expression to- Returns:
- a converted Expression, or
nullif it couldn't be converted
-
getReturnType
- Returns:
- the return type of this expression. By default, this is defined on registration, but, like Expression.isSingle(), can be overriden.
-
getSectionValues
Description copied from class:SectionValueReturns the values of thisSectionValue, akin to the output ofExpression.getValues(TriggerContext), given the linked section and theTriggerContext.- Specified by:
getSectionValuesin classSectionValue<SecLoop,Object> - Parameters:
loop- the linked sectionctx- theTriggerContext- Returns:
- the values of this
SectionValue
-
getSectionClass
- Specified by:
getSectionClassin classSectionValue<SecLoop,Object> - Returns:
- the class of the
ArgumentSectionthisSectionValueis linked to.
-
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
-