|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--com.franz.jlinker.LispCall
The purpose of this class is to facilitate calls from Lisp to Java. The connection to Lisp is assumed to be open and ready.
Typical usage style:
Components of a LispCall instance:
| Field Summary | |
static int |
RES_BOOLEAN
Result type constant: boolean. |
static int |
RES_DOUBLE_ARRAY
Result type constant: array of floating point numbers. |
static int |
RES_ERROR
Result type constant: remote reference to a Lisp error. |
static int |
RES_INT_ARRAY
Result type constant: array of integer values. |
static int |
RES_INTEGER
Result type constant: integer. |
static int |
RES_JAVA_POINTER
Result type constant: Java Object instance. |
static int |
RES_LISP_POINTER
Result type constant: remote reference to a Lisp object. |
static int |
RES_LONG
Result type constant: long integer. |
static int |
RES_MISSING
Result type constant: missing result. |
static int |
RES_NULL
Result type constant: null. |
static int |
RES_REAL
Result type constant: floating point number. |
static int |
RES_STRING
Result type constant: string. |
static int |
RES_STRING_ARRAY
Result type constant: array of strings. |
static int |
RES_SYMBOL
Result type constant: remote reference to a Lisp symbol. |
static int |
RES_UNKNOWN
Result type constant: unknown type. |
static int |
RES_WRONG_STATE
Result type constant: incorrect LispCall state.. |
static int |
STATE_CLOSED
Internal state constant: arguments and values discarded. |
static int |
STATE_COLLECTING
Internal state constant: collecting arguments to call. |
static int |
STATE_DONE
Internal state constant: call completed, value(s) available. |
static int |
STATE_NEW
Internal state constant: new, uninitialized instance. |
static int |
STATE_READY
Internal state constant: ready to make call. |
static int |
STATE_WAITDONE
Internal state constant: call completed, but value(s) not retrieved. |
static int |
STATE_WAITING
Internal state constant: waiting for call to complete. |
static int |
STYLE_ASYNC_BR
Call style constant: asynchronous call. |
static int |
STYLE_ASYNC_GO
Call style constant: asynchronous call. |
static int |
STYLE_COPY
Call style constant: default call returning Java data values if possible. |
static int |
STYLE_IGNORE
Call style constant: call with ignored value(s). |
static int |
STYLE_ONEWAY
Call style constant: one-way call. |
static int |
STYLE_REF
Call style constant: call returning remote reference(s) if possible. |
| Constructor Summary | |
LispCall()
Create a LispCall instance with default style and default retention strategy. |
|
LispCall(boolean r)
Create a LispCall instance with default style and the specified retention strategy. |
|
LispCall(int s)
Create a LispCall instance with the specifed call style. |
|
LispCall(java.lang.String op)
Create a LispCall instance to call the specified Lisp function. |
|
| Method Summary | |
int |
addArg(boolean x)
Add an argument to the call. |
int |
addArg(double x)
Add an argument to the call. |
int |
addArg(int x)
Add an argument to the call. |
int |
addArg(int[] x)
Add an argument to the call. |
int |
addArg(long x)
Add an argument to the call. |
int |
addArg(java.lang.Object x)
Add an argument to the call. |
int |
addArg(java.lang.String x)
Add an argument to the call. |
int |
addArg(java.lang.String[] x)
Add an argument to the call. |
int |
addArg(com.franz.jlinker.TranStruct x)
Add an argument to the call. |
int |
addSymbol(java.lang.String x)
Add an argument to the call. |
boolean |
booleanValue()
Get the first or only value returned from Lisp. |
boolean |
booleanValue(int i)
Get the i-th value returned from Lisp. |
int |
call()
Call a function in Lisp. |
int |
callAsyncBr()
Call a function in Lisp. |
int |
callAsyncGo()
Call a function in Lisp. |
int |
callCopy()
Call a function in Lisp. |
int |
callIgnore()
Call a function in Lisp. |
int |
callOneWay()
Call a function in Lisp. |
int |
callRef()
Call a function in Lisp. |
void |
close()
Discard all arguments and results. |
double[] |
doubleArrayValue()
Get the first or only value returned from Lisp. |
double[] |
doubleArrayValue(int i)
Get the i-th value returned from Lisp. |
double |
doubleValue()
Get the first or only value returned from Lisp. |
double |
doubleValue(int i)
Get the i-th value returned from Lisp. |
com.franz.jlinker.TranStruct |
getOp()
Get the Lisp operation. |
boolean |
getRetain()
Get the retention strategy. |
int |
getState()
Get the state of the LispCall instance. |
int |
getStyle()
Get the call style of the LispCall instance. |
com.franz.jlinker.TranStruct |
getValue()
Get the first or only raw value returned by a call to Lisp. |
com.franz.jlinker.TranStruct |
getValue(int i)
Get the i-th raw value returned by a call to Lisp. |
int[] |
intArrayValue()
Get the first or only value returned from Lisp. |
int[] |
intArrayValue(int i)
Get the i-th value returned from Lisp. |
int |
intValue()
Get the first or only value returned from Lisp. |
int |
intValue(int i)
Get the i-th value returned from Lisp when it is expected to be of type int. |
java.lang.String |
lispType()
Identify the Lisp type of the first or only returned value. |
java.lang.String |
lispType(int i)
Identify the Lisp type of a returned value. |
long |
longValue()
Get the first or only value returned from Lisp. |
long |
longValue(int i)
Get the i-th value returned from Lisp. |
static java.lang.String |
nameOfType(int type)
Translate an integer type code to a descriptive string. |
java.lang.Object |
objectValue()
Get the first or only value returned from Lisp. |
java.lang.Object |
objectValue(int i)
Get the i-th value returned from Lisp. |
int |
query()
Query the state of a call to Lisp. |
int |
query(boolean doquery,
boolean dofetch)
Query the state of a call to Lisp. |
boolean |
reset()
Discard the results but keep the arguments. |
void |
setArg(int i,
boolean arg)
Set or modify a specified argument position. |
void |
setArg(int i,
double arg)
Set or modify a specified argument position. |
void |
setArg(int i,
double[] arg)
Set or modify a specified argument position. |
void |
setArg(int i,
int arg)
Set or modify a specified argument position. |
void |
setArg(int i,
int[] arg)
Set or modify a specified argument position. |
void |
setArg(int i,
long arg)
Set or modify a specified argument position. |
void |
setArg(int i,
java.lang.Object arg)
Set or modify a specified argument position. |
void |
setArg(int i,
java.lang.String arg)
Set or modify a specified argument position. |
void |
setArg(int i,
java.lang.String[] arg)
Set or modify a specified argument position. |
void |
setArg(int i,
com.franz.jlinker.TranStruct arg)
Set or modify a specified argument position. |
void |
setOp(java.lang.String op)
Specify the Lisp function that will be called. |
void |
setOp(com.franz.jlinker.TranStruct op)
Specify the Lisp function that will be called. |
void |
setRetain(boolean r)
Set the retention strategy. |
void |
setStyle(int s)
Specify the call style. |
void |
setSymbol(int i,
java.lang.String name)
Set or modify a specified argument position. |
java.lang.String[] |
stringArrayValue()
Get the first or only value returned from Lisp. |
java.lang.String[] |
stringArrayValue(int i)
Get the i-th value returned from Lisp. |
java.lang.String |
stringValue()
Get the first or only value returned from Lisp. |
java.lang.String |
stringValue(int i)
Get the i-th value returned from Lisp. |
java.lang.String |
symbolName()
Get the name of a Lisp symbol. |
java.lang.String |
symbolName(int i)
Get the name of a Lisp symbol. |
java.lang.String |
symbolPackage()
Get the name of the package of a Lisp symbol. |
java.lang.String |
symbolPackage(int i)
Get the name of the package of a Lisp symbol. |
int |
typeOf()
Query the type of the first or only value returned from Lisp. |
int |
typeOf(int i)
Query the type of the i-th value returned from Lisp. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int STYLE_ONEWAY
public static final int STYLE_IGNORE
public static final int STYLE_REF
public static final int STYLE_COPY
public static final int STYLE_ASYNC_BR
An important side-effect of this style of call is that Lisp errors are handled in the Lisp thread, and are not just returned to Java.
public static final int STYLE_ASYNC_GO
Lisp errors are cought and returned to Java.
public static final int STATE_NEW
public static final int STATE_COLLECTING
public static final int STATE_READY
public static final int STATE_DONE
public static final int STATE_WAITING
public static final int STATE_WAITDONE
public static final int STATE_CLOSED
public static final int RES_NULL
public static final int RES_BOOLEAN
public static final int RES_INTEGER
public static final int RES_LONG
public static final int RES_REAL
public static final int RES_STRING
public static final int RES_SYMBOL
public static final int RES_LISP_POINTER
public static final int RES_ERROR
public static final int RES_INT_ARRAY
public static final int RES_DOUBLE_ARRAY
public static final int RES_STRING_ARRAY
public static final int RES_JAVA_POINTER
public static final int RES_WRONG_STATE
public static final int RES_MISSING
public static final int RES_UNKNOWN
| Constructor Detail |
public LispCall()
public LispCall(boolean r)
r - A boolean value that specifies the retention strategy.
A true value specifies that arguments and results are retained
until released with a call to close().
A false values specifies that argument wrappers are discarded immediately
after the call to Lisp is made.public LispCall(int s)
s - An integer that specifies the call style.
It must be one of the constants
STYLE_ONEWAY, STYLE_IGNORE, STYLE_REF, STYLE_COPY, STYLE_ASYNC.public LispCall(java.lang.String op)
op - A string that specifies a Lisp function name.| Method Detail |
public int getState()
public com.franz.jlinker.TranStruct getOp()
public int getStyle()
public void setOp(java.lang.String op)
op - A string that specifies a Lisp function name.public void setOp(com.franz.jlinker.TranStruct op)
op - A TranStuct instance that specifies a Lisp function.public void setStyle(int s)
s - An integer that specifies the call style.
It must be one of the constants
STYLE_ONEWAY, STYLE_IGNORE, STYLE_REF, STYLE_COPY, STYLE_ASYNC.java.lang.IllegalArgumentException - if the argument is not suitable.public boolean getRetain()
public void setRetain(boolean r)
r - A boolean value that specidies the new retention strategy.public int addArg(com.franz.jlinker.TranStruct x)
x - A pre-wrapped object to be passed to Lisp.public int addArg(int x)
x - A short value that will be wrapped in a TranStruct instance.public int addArg(long x)
x - A short value that will be wrapped in a TranStruct instance.public int addArg(boolean x)
x - An int value that will be wrapped in a TranStruct instance.public int addArg(int[] x)
x - An int vector that will be wrapped in a TranStruct instance.public int addArg(java.lang.String x)
x - A String value that will be wrapped in a TranStruct instance.public int addArg(java.lang.String[] x)
x - A String vector that will be wrapped in a TranStruct instance.public int addArg(double x)
x - A double value that will be wrapped in a TranStruct instance.public int addArg(java.lang.Object x)
x - An Object value that will be wrapped in a TranStruct instance.public int addSymbol(java.lang.String x)
x - A String value that will be wrapped in a
TranStruct instance that regferences the desired symbol.
public int call()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
IllegalStateException - if a previous call is not complete.com.franz.jlinker.JavaLinkDist.JLinkerException - or a subclass if an error is detected
during the call.
public int callOneWay()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
public int callIgnore()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
public int callRef()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
com.franz.jlinker.JavaLinkDist.JLinkerException - or a subclass if there
was some error in the call.
public int callCopy()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
com.franz.jlinker.JavaLinkDist.JLinkerException - or a subclass if there
was some error in the call.
public int callAsyncBr()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
com.franz.jlinker.JavaLinkDist.JLinkerException - or a subclass if there
was some error in the call.
public int callAsyncGo()
throws com.franz.jlinker.JavaLinkDist.JLinkerException
com.franz.jlinker.JavaLinkDist.JLinkerException - or a subclass if there
was some error in the call.public com.franz.jlinker.TranStruct getValue()
public com.franz.jlinker.TranStruct getValue(int i)
i - The index of the desired value.WrongStateException - if
public static java.lang.String nameOfType(int type)
| Integer type code | String name |
|---|---|
| RES_NULL | "Null" |
| RES_BOOLEAN | "Boolean" |
| RES_INTEGER | "Integer" |
| RES_LONG | "Long" |
| RES_REAL | "Real" |
| RES_STRING | "String" |
| RES_ERROR | "Error" |
| RES_SYMBOL | "Symbol" |
| RES_LISP_POINTER | "Lisp-Pointer" |
| RES_INT_ARRAY | "Int-Array" |
| RES_DOUBLE_ARRAY | "Double-Array" |
| RES_STRING_ARRAY | "String-Array" |
| RES_UNKNOWN | "Unknown" |
| RES_JAVA_POINTER | "Java-Pointer" |
| RES_WRONG_STATE | "Wrong-State" |
| RES_MISSING | "Missing" |
| "Unknown-nn" where nn is the integer type code |
public int typeOf()
public int typeOf(int i)
i - The index of the value queried.public int intValue()
UnsupportedOperationException - when the value returned from Lisp
is not convertible to int.ArrayOutOfBoundsException - when the i-th value is not there.public int intValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not convertible to int.ArrayOutOfBoundsException - when the i-th value is not there.public long longValue()
public long longValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not convertible to long.ArrayOutOfBoundsException - when the i-th value is not there.public double doubleValue()
public double doubleValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not convertible to double.ArrayOutOfBoundsException - when the i-th value is not there.public boolean booleanValue()
public boolean booleanValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not boolean.ArrayOutOfBoundsException - when the i-th value is not there.public java.lang.String stringValue()
public java.lang.String stringValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not String.ArrayOutOfBoundsException - when the i-th value is not there.public int[] intArrayValue()
public int[] intArrayValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not int[].ArrayOutOfBoundsException - when the i-th value is not there.public java.lang.String[] stringArrayValue()
public java.lang.String[] stringArrayValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not String[].ArrayOutOfBoundsException - when the i-th value is not there.public double[] doubleArrayValue()
public double[] doubleArrayValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not double[].ArrayOutOfBoundsException - when the i-th value is not there.public java.lang.Object objectValue()
public java.lang.Object objectValue(int i)
i - The index of the desired value.UnsupportedOperationException - when the i-th value returned from Lisp
is not Object.ArrayOutOfBoundsException - when the i-th value is not there.public java.lang.String symbolName()
UnsupportedOperationException - when the returned value is not
a Lisp symbol.public java.lang.String symbolName(int i)
UnsupportedOperationException - when the returned value is not
a Lisp symbol.public java.lang.String symbolPackage()
UnsupportedOperationException - when the returned value is not
a Lisp symbol.public java.lang.String symbolPackage(int i)
UnsupportedOperationException - when the returned value is not
a Lisp symbol.public java.lang.String lispType()
public java.lang.String lispType(int i)
If the returned value has been converted to a Java data value or Object, the string is one of the strings returned by nameOfType().
If the returned value is a remote reference to a Lisp object, then the string is the Lisp format ~A representation of the Lisp type.
public int query()
public int query(boolean doquery,
boolean dofetch)
throws com.franz.jlinker.JavaLinkDist.JLinkerException
doquery - When this argument is true, fetch a more detailed description
of the state of an STYLE_ASYNC call.dofetch - When this argument is true, and an STYLE_ASYNC call is complete
in Lisp, fetch the values of the call.com.franz.jlinker.JavaLinkDist.JLinkerException - If an error occurs when fetching the
the state or results of a STYLE_ASYNC call.public void close()
public boolean reset()
When the returned value is false, the LispCall instance is in the STATE_NEW or STATE_COLLECTING state ansd is not ready for another call.
public void setArg(int i,
com.franz.jlinker.TranStruct arg)
public void setArg(int i,
boolean arg)
public void setArg(int i,
int arg)
public void setArg(int i,
long arg)
public void setArg(int i,
double arg)
public void setArg(int i,
java.lang.String arg)
public void setArg(int i,
java.lang.Object arg)
public void setArg(int i,
int[] arg)
public void setArg(int i,
double[] arg)
public void setArg(int i,
java.lang.String[] arg)
public void setSymbol(int i,
java.lang.String name)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||