public class CallContext extends ArgListImpl implements ArgList, ArgListBuilder
Modifier and Type | Field and Description |
---|---|
java.lang.invoke.MethodHandle |
applyMethod |
Consumer |
consumer
Function results are written to this Consumer.
|
java.lang.Object[][] |
evalFrames
Current stack of evaluation frames for interpreter.
|
static int |
MATCH_CHECK
Request to on failure return error code.
|
static int |
MATCH_CHECK_ONLY
Request to on failure return error code; on failure return 0.
|
static int |
MATCH_THROW_ON_EXCEPTION
Request to throw an exception on a match failure.
|
int |
next
Index of next argument.
|
Procedure |
proc |
count
Constructor and Description |
---|
CallContext() |
Modifier and Type | Method and Description |
---|---|
void |
addArg(java.lang.Object arg) |
void |
addArg(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3) |
int |
checkDone() |
void |
checkKeywordsDone() |
void |
cleanupFromContext(int saved)
Cleanup-only part of getFromContext.
|
java.lang.Object |
getArgAsObject(int i)
Index into arguments, not counting keywords.
|
int |
getArgCount() |
java.lang.Object[] |
getArgs() |
java.lang.Object |
getFromContext(int saved)
Routine to extract result and restore state after startFromContext.
|
static CallContext |
getInstance()
Get or create a CallContext for the current thread.
|
int |
getMode() |
java.lang.Object |
getNextArg()
Get the next incoming argument.
|
java.lang.Object |
getNextArg(java.lang.Object defaultValue)
Get the next incoming argument.
|
static CallContext |
getOnlyInstance()
Get but don't create a CallContext for the current thread.
|
java.lang.Object[] |
getRestArgsArray() |
java.lang.Object[] |
getRestArgsArray(int next)
Get remaining arguments as an array.
|
LList |
getRestArgsList() |
LList |
getRestArgsList(int next)
Get remaining arguments as a list.
|
ArgListVector |
getRestArgsVector() |
ArgListVector |
getRestArgsVector(int next)
Get remaining arguments are an ArgListVector.
|
java.lang.Object[] |
getRestPlainArray() |
LList |
getRestPlainList(int next) |
static short[] |
getSortedKeywords(java.lang.String[] keywords,
int nkeys) |
boolean |
haveArg() |
void |
lastArg()
Note that we are done with the input arguments.
|
void |
matchError(int code) |
int |
nextKeyword(java.lang.String keyword)
Return index of matching keyword argument.
|
java.lang.Object |
nextKeyword(java.lang.String keyword,
java.lang.Object dfault) |
int |
nextKeywordAllowOthers(java.lang.String keyword) |
java.lang.Object |
nextKeywordAllowOthers(java.lang.String keyword,
java.lang.Object dfault) |
int |
nextKeywordIndex(java.lang.String keyword,
boolean allowOthers) |
LList |
peekRestArgsList() |
void |
popArgState() |
void |
pushArgState() |
void |
reset() |
void |
rewind() |
void |
rewind(int mode) |
void |
runUntilDone() |
java.lang.Object |
runUntilValue()
Run until no more continuations, returning final result.
|
void |
runUntilValue(Consumer out)
Run until no more continuations, sending result to a COnsumer.
|
static void |
setInstance(CallContext ctx) |
void |
setNextProcedure(Procedure proc) |
void |
setNextProcedure(Procedure proc,
java.lang.invoke.MethodHandle apply) |
void |
setupApply(Procedure proc) |
void |
setupApply(Procedure proc,
java.lang.Object arg0) |
void |
setupApply(Procedure proc,
java.lang.Object arg0,
java.lang.Object arg1) |
void |
setupApply(Procedure proc,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2) |
void |
setupApply(Procedure proc,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3) |
void |
setupApplyAll(Procedure proc,
java.lang.Object[] args) |
void |
setupApplyAll(Procedure proc,
java.lang.Object[] args,
int fromIndex,
int toIndex) |
void |
shiftArgs(Procedure proc,
int toDrop) |
int |
startFromContext()
Setup routine before calling a method that takes a CallContext.
|
boolean |
throwOnException() |
void |
writeValue(java.lang.Object value)
Write values (of function result) to current consumer.
|
add, add, addAll, addAll, addArgList, addKey, addSequence, asArgList, asFreshArgList, clear, findKeyword, findKeyword, firstKeyword, getKeyword, numArguments, numKeywords, popLast, printArgs, setArgs, setArgs, setArgs, setArgs, setArgs, setArgsAll, setArgsAll, setKeys, shiftArgs
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findKeyword, firstKeyword, getKeyword, numArguments, numKeywords
public java.lang.invoke.MethodHandle applyMethod
public Procedure proc
public Consumer consumer
public int next
public static final int MATCH_THROW_ON_EXCEPTION
public static final int MATCH_CHECK
public static final int MATCH_CHECK_ONLY
public java.lang.Object[][] evalFrames
public static void setInstance(CallContext ctx)
public static CallContext getOnlyInstance()
public static CallContext getInstance()
public final void setNextProcedure(Procedure proc, java.lang.invoke.MethodHandle apply)
public final void setNextProcedure(Procedure proc)
public java.lang.Object getArgAsObject(int i)
ArgList
getArgAsObject
in interface ArgList
getArgAsObject
in class ArgListImpl
public void rewind(int mode)
public void rewind()
public void reset()
public void shiftArgs(Procedure proc, int toDrop)
public int getMode()
public void matchError(int code)
public boolean throwOnException()
public boolean haveArg()
public void checkKeywordsDone()
public int checkDone()
public int getArgCount()
public java.lang.Object getNextArg()
public java.lang.Object getNextArg(java.lang.Object defaultValue)
public final java.lang.Object[] getRestPlainArray()
public final java.lang.Object[] getRestArgsArray()
public final java.lang.Object[] getRestArgsArray(int next)
public final LList peekRestArgsList()
public final ArgListVector getRestArgsVector()
public final LList getRestArgsList()
public final LList getRestArgsList(int next)
public final LList getRestPlainList(int next)
public ArgListVector getRestArgsVector(int next)
next
- The number of arguments that should be skipped.
Assume either no keywords have been processed, or they all have.public void lastArg()
public java.lang.Object[] getArgs()
public static short[] getSortedKeywords(java.lang.String[] keywords, int nkeys)
public int nextKeyword(java.lang.String keyword)
dfault
if no matching keyword argument,
or the corresponding keyword value.public int nextKeywordAllowOthers(java.lang.String keyword)
public int nextKeywordIndex(java.lang.String keyword, boolean allowOthers)
public java.lang.Object nextKeyword(java.lang.String keyword, java.lang.Object dfault)
public java.lang.Object nextKeywordAllowOthers(java.lang.String keyword, java.lang.Object dfault)
public void setupApply(Procedure proc)
public void setupApply(Procedure proc, java.lang.Object arg0)
public void setupApply(Procedure proc, java.lang.Object arg0, java.lang.Object arg1)
public void setupApply(Procedure proc, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
public void setupApply(Procedure proc, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
public void setupApplyAll(Procedure proc, java.lang.Object[] args)
public void setupApplyAll(Procedure proc, java.lang.Object[] args, int fromIndex, int toIndex)
public void addArg(java.lang.Object arg)
public void addArg(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
public void runUntilDone() throws java.lang.Throwable
java.lang.Throwable
public final int startFromContext()
public final java.lang.Object getFromContext(int saved) throws java.lang.Throwable
java.lang.Throwable
public final void cleanupFromContext(int saved)
public final java.lang.Object runUntilValue() throws java.lang.Throwable
java.lang.Throwable
public final void runUntilValue(Consumer out) throws java.lang.Throwable
java.lang.Throwable
public void writeValue(java.lang.Object value)
public final void pushArgState()
public final void popArgState()