Package ca.phon.script
Interface PhonScript
- All Superinterfaces:
Appendable
,CharSequence
,IExtendable
- All Known Implementing Classes:
BasicScript
,LazyQueryScript
,QueryScript
Interface for Phon runtime scripts. Scripts are written in ECMAScript and use the Rhino engine directly (instead of using the JSR.)
Phon scripts may also have parameters defined which can be
setup using either a comment at the beginning of the file or
by implementing the setup_params
function in the
script.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addClassImport
(String classImport) boolean
addPackageImport
(String pkgImport) boolean
addRequirePath
(URI uri) append
(boolean arg0) append
(char c) append
(char[] str) append
(char[] str, int offset, int len) append
(double d) append
(float f) append
(int i) append
(long lng) append
(CharSequence s, int start, int end) append
(StringBuffer sb) appendCodePoint
(int codePoint) int
capacity()
char
charAt
(int index) int
codePointAt
(int index) int
codePointBefore
(int index) int
codePointCount
(int beginIndex, int endIndex) delete
(int start, int end) deleteCharAt
(int index) void
ensureCapacity
(int minimumCapacity) void
getChars
(int srcBegin, int srcEnd, char[] dst, int dstBegin) Get a list of classes that should be imported when the scope is created.Get a script context for this script.Get required packages that should be imported when the scope is created.Get the list of URLs that should be available for script loading using therequire
function.Get the script text.int
int
insert
(int offset, boolean b) insert
(int offset, char c) insert
(int offset, char[] str) insert
(int index, char[] str, int offset, int len) insert
(int offset, double d) insert
(int offset, float f) insert
(int offset, int i) insert
(int offset, long l) insert
(int dstOffset, CharSequence s) insert
(int dstOffset, CharSequence s, int start, int end) int
lastIndexOf
(String str) int
lastIndexOf
(String str, int fromIndex) int
length()
int
offsetByCodePoints
(int index, int codePointOffset) boolean
removeClassImport
(String classImport) boolean
removePackageImport
(String pkgImport) boolean
removeRequirePath
(URI uri) Reset contextreverse()
void
setCharAt
(int index, char ch) void
setLength
(int newLength) subSequence
(int start, int end) substring
(int start) substring
(int start, int end) void
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty, toString
Methods inherited from interface ca.phon.extensions.IExtendable
getExtension, getExtensions, putExtension, removeExtension
-
Method Details
-
getScript
String getScript()Get the script text.- Returns:
- script
-
resetContext
PhonScriptContext resetContext()Reset context -
getContext
PhonScriptContext getContext()Get a script context for this script. The context is used to compile and evaulate the script.- Returns:
- the script context
-
getPackageImports
Get required packages that should be imported when the scope is created. These packages will also be available to any script imported using therequire()
function.- Returns:
- the list of packages that should be available to this script and any dependencies
-
addPackageImport
-
removePackageImport
-
getClassImports
Get a list of classes that should be imported when the scope is created. These classes will also be availble to any script imported using therequire()
function.- Returns:
- the list of classes that should be availble to this script and any dependencies
-
addClassImport
-
removeClassImport
-
getRequirePaths
Get the list of URLs that should be available for script loading using therequire
function.- Returns:
- list of javascript library folders
-
addRequirePath
-
removeRequirePath
-
append
-
append
- Specified by:
append
in interfaceAppendable
-
append
-
append
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
append
-
append
-
append
-
append
-
append
-
append
-
append
-
appendCodePoint
-
capacity
int capacity() -
charAt
char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
-
codePointAt
int codePointAt(int index) -
codePointBefore
int codePointBefore(int index) -
codePointCount
int codePointCount(int beginIndex, int endIndex) -
delete
-
deleteCharAt
-
ensureCapacity
void ensureCapacity(int minimumCapacity) -
getChars
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) -
indexOf
-
indexOf
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
insert
-
lastIndexOf
-
lastIndexOf
-
length
int length()- Specified by:
length
in interfaceCharSequence
-
offsetByCodePoints
int offsetByCodePoints(int index, int codePointOffset) -
replace
-
reverse
PhonScript reverse() -
setCharAt
void setCharAt(int index, char ch) -
setLength
void setLength(int newLength) -
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
substring
-
substring
-
trimToSize
void trimToSize()
-