|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.functions.Function
public abstract class Function
This is the base class of all MillScript Functions.
Two constructors are provided here, no-args or a single
Package argument. When adding functions
via a package configuration file, the single arg version will be tried first
and then the no-arg version. Hence if both are provided, the single argument
version would not be used, unless an explicit reference is made.
| Constructor Summary | |
|---|---|
protected |
Function()
Constructs a new function with no additional parameters. |
protected |
Function(Package p)
Constructs a new function to be part of the specified pacakge. |
| Method Summary | |
|---|---|
abstract void |
apply(Machine mc,
int nargs)
Performs this function using the specified machine, with the specified number of arguments. |
void |
applyUpdater(Machine mc,
int nargs,
int unargs)
Performs this functions updater. |
void |
checkNargs(Machine mc,
int required,
int actual)
Convenience method for checking if the right number of arguments are supplied when calling this function. |
void |
checkNargsGT(Machine mc,
int required,
int actual)
Convenience method for checking if the right number of arguments are supplied when calling this function. |
void |
checkUNargs(Machine mc,
int req,
int actual,
int ureq,
int uactual)
Convenience method for checking if the right number of arguments are supplied when calling this functions updater. |
java.lang.String |
getName()
Returns this functions name. |
Function |
modName(java.lang.String s)
Returns this function after having changed it's name to the specified value. |
void |
reportNargsError(Machine mc,
int required,
int actual)
Generates a mishap for use when the wrong number of arguments are supplied when calling this function. |
void |
reportNargsGTError(Machine mc,
int required,
int actual)
Generates a mishap for use when the wrong number of arguments are supplied when calling this function. |
void |
setName(java.lang.String s)
Sets this functions name to the specified value. |
java.lang.String |
toString()
|
static java.lang.Object |
tryClone(java.lang.Object x)
Attempts to clone the specified object by calling its public clone method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Function()
This constructor is for general use and is the most commonly required. If the function requires access to the configuration during construction it should provide the single argument version instead.
protected Function(Package p)
This constructor will be tried first when adding a function to a package via a configuration file. If this constructor is not available, the no argument version will be tried. This constructor should only be used if the package argument is required.
p - the Package this new
function will be part of| Method Detail |
|---|
public abstract void apply(Machine mc,
int nargs)
mc - the machine to perform this function onnargs - the number of arguments the function is being invoked with
public void applyUpdater(Machine mc,
int nargs,
int unargs)
mc - the machine to perform this function onnargs - the number of arguments the function is being invoked withunargs - the number of update argumentspublic java.lang.String getName()
public Function modName(java.lang.String s)
s - the new name for this function
public void setName(java.lang.String s)
s - the new name for this functionpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
public void checkNargs(Machine mc,
int required,
int actual)
mc - the machine to gather arguments fromrequired - the required number of arguments to this functionactual - the actual number of arguments to this function
public void checkNargsGT(Machine mc,
int required,
int actual)
mc - the machine to gather arguments fromrequired - the minimum number of arguments to this functionactual - the actual number of arguments to this function
public void checkUNargs(Machine mc,
int req,
int actual,
int ureq,
int uactual)
mc - the machine to gather arguments fromreq - the required number of arguments to this functionactual - the actual number of arguments to this functionureq - the required number of update values for this updateruactual - the actual number of update values for this updater
public void reportNargsError(Machine mc,
int required,
int actual)
mc - the machine to gather arguments fromrequired - the required number of arguments to this functionactual - the actual number of arguments to this function
public void reportNargsGTError(Machine mc,
int required,
int actual)
mc - the machine to gather arguments fromrequired - the minimum number of arguments to this functionactual - the actual number of arguments to this functionpublic static java.lang.Object tryClone(java.lang.Object x)
x - the object to try and clone
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||