Class ArgumentList
- All Implemented Interfaces:
Iterable<FunctionArgument>
,Collection<FunctionArgument>
,List<FunctionArgument>
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArgumentList
static ArgumentList
Create an unary argument list.static ArgumentList
Create a binary argument list.static ArgumentList
Create a ternary argument list.static ArgumentList
Create a quarternary argument list.<T> ResultOrProblems<T>
evaluateConstant
(RealizationContext context, FunctionCall functionCall, String keyword, Class<T> requiredJavaType, Type requiredType) Deprecated.static ArgumentList
fromArray
(FunctionArgument... functionArguments) static ArgumentList
fromStruct
(Struct struct) get
(int index) getArgument
(FunctionCall fc, String keywordName) Returns the FunctionCallFunctionCall.Argument
(i.e.com.google.common.collect.Range<Integer>
getArity()
getProblems
(RealizationContext context, List<Type> givenArgs) getProblems
(RealizationContext context, List<Type> givenArgs, BiFunction<FunctionArgument, Type, List<Problem>> describeMismatch) Same asgetProblems(RealizationContext, List)
except it lets you customize how argument/type mismatches are reportedgetRequiredArgument
(FunctionCall fc, String keyword) <T extends Type>
ResultOrProblems<T>getRequiredAs
(List<Type> givenTypes, int argIndex, Class<T> requiredType) boolean
hasArgument
(String keyword) boolean
isCompatible
(RealizationContext context, List<Type> givenTypes) int
size()
withExtraArgument
(String keyword, Type type) Convenience version ofthat accepts the keyword and type of the extra argument</p>
withExtraArgument
(FunctionArgument... extraArgs) Return a new argument list which has the same arguments has this one but with extraArg appended.Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
ArgumentList
-
-
Method Details
-
fromArray
-
fromStruct
-
anonymous
- Returns:
- an ArgumentList from an anonymous list of types
-
create
Create an unary argument list. Shorthand for ArgumentList.fromArray(new FunctionArgument(kw0, arg0)).
-
create
Create a binary argument list. Shorthand for ArgumentList.fromArray(new FunctionArgument(kw0, arg0), ...).
-
create
Create a ternary argument list. Shorthand for ArgumentList.fromArray(new FunctionArgument(kw0, arg0), ...).
-
create
public static ArgumentList create(String kw0, Type t0, String kw1, Type t1, String kw2, Type t2, String kw3, Type t3) Create a quarternary argument list. Shorthand for ArgumentList.fromArray(new FunctionArgument(kw0, arg0), ...).
-
get
- Specified by:
get
in interfaceList<FunctionArgument>
- Specified by:
get
in classAbstractList<FunctionArgument>
-
size
public int size()- Specified by:
size
in interfaceCollection<FunctionArgument>
- Specified by:
size
in interfaceList<FunctionArgument>
- Specified by:
size
in classAbstractCollection<FunctionArgument>
- Returns:
- the maximum number of arguments accepted (including any optional/nullable ones)
-
getArity
- Returns:
- the range of arguments accepted. The lower bound includes only the required arguments, and the upper bound includes any optional (nullable) arguments
-
get
-
hasArgument
-
getKeywords
-
getArgumentTypes
-
getArgument
Returns the FunctionCall
FunctionCall.Argument
(i.e. the actual value passed to the function), as opposed to theFunctionArgument
(i.e. the placeholder). -
getRequiredArgument
-
getRequiredAs
public <T extends Type> ResultOrProblems<T> getRequiredAs(List<Type> givenTypes, int argIndex, Class<T> requiredType) - Returns:
- the actual type of the argument provided by the user, or an appropriate error if it doesn't match what was expected.
-
evaluateConstant
@Deprecated public <T> ResultOrProblems<T> evaluateConstant(RealizationContext context, FunctionCall functionCall, String keyword, Class<T> requiredJavaType, Type requiredType) Deprecated. -
isCompatible
- Returns:
- true if the given types are compatible with these arguments (i.e. can be realized), false if not
-
withExtraArgument
Convenience version of
that accepts the keyword and type of the extra argument</p>
- Parameters:
keyword
- the keyword for the extra argumenttype
- the type of the extra argument- Returns:
- new argument list
-
withExtraArgument
Return a new argument list which has the same arguments has this one but with extraArg appended.
- Parameters:
extraArgs
- extra arguments to append to the new argument list- Returns:
- new argument list
-
getProblems
- Returns:
- A list of problems from realization against the given types, or an empty list if there are no problems
-
getProblems
public List<Problem> getProblems(RealizationContext context, List<Type> givenArgs, BiFunction<FunctionArgument, Type, List<Problem>> describeMismatch) Same as
getProblems(RealizationContext, List)
except it lets you customize how argument/type mismatches are reported
-