Class BasicScript
java.lang.Object
ca.phon.script.BasicScript
- All Implemented Interfaces:
IExtendable,PhonScript,Appendable,CharSequence,Cloneable
- Direct Known Subclasses:
LazyQueryScript
Basic phon script in memory. This script stores the script
text in an internal
StringBuffer. This object is intended
to be immutable, however sub-classes may alter the internal script
using the provided buffer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddClassImport(String classImport) booleanaddPackageImport(String pkgImport) booleanaddRequirePath(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) intcapacity()charcharAt(int index) clone()intcodePointAt(int index) intcodePointBefore(int index) intcodePointCount(int beginIndex, int endIndex) delete(int start, int end) deleteCharAt(int index) voidensureCapacity(int minimumCapacity) protected StringBufferUsed by sub-classes to allow direct access to buffervoidgetChars(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.<T> TgetExtension(Class<T> cap) Get the requested extension if available.Return all extension types supportedGet required packages that should be imported when the scope is created.Get the list of URLs that should be available for script loading using therequirefunction.Get the script text.intintinsert(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) intlastIndexOf(String str) intlastIndexOf(String str, int fromIndex) intlength()intoffsetByCodePoints(int index, int codePointOffset) <T> TputExtension(Class<T> cap, T impl) Add a new extension.booleanremoveClassImport(String classImport) <T> TremoveExtension(Class<T> cap) Remove a capability.booleanremovePackageImport(String pkgImport) booleanremoveRequirePath(URI uri) Resets query context.reverse()voidsetCharAt(int index, char ch) voidsetLength(int newLength) subSequence(int start, int end) substring(int start) substring(int start, int end) voidMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty, toString
-
Constructor Details
-
BasicScript
-
BasicScript
- Throws:
IOException
-
-
Method Details
-
getBuffer
Used by sub-classes to allow direct access to buffer- Returns:
- script buffer
-
getScript
Description copied from interface:PhonScriptGet the script text.- Specified by:
getScriptin interfacePhonScript- Returns:
- script
-
getContext
Description copied from interface:PhonScriptGet a script context for this script. The context is used to compile and evaulate the script.- Specified by:
getContextin interfacePhonScript- Returns:
- the script context
-
resetContext
Resets query context.- Specified by:
resetContextin interfacePhonScript- Returns:
- the current context (before reset)
-
getExtensions
Description copied from interface:IExtendableReturn all extension types supported- Specified by:
getExtensionsin interfaceIExtendable
-
getExtension
Description copied from interface:IExtendableGet the requested extension if available.- Specified by:
getExtensionin interfaceIExtendable- Returns:
- the capability object or
nullif the cability is not available
-
putExtension
Description copied from interface:IExtendableAdd a new extension.- Specified by:
putExtensionin interfaceIExtendable- Parameters:
cap- the extension to add- Returns:
- the added extension implementation
-
removeExtension
Description copied from interface:IExtendableRemove a capability.- Specified by:
removeExtensionin interfaceIExtendable- Parameters:
cap- the capability to remove
-
getPackageImports
Description copied from interface:PhonScriptGet required packages that should be imported when the scope is created. These packages will also be available to any script imported using therequire()function.- Specified by:
getPackageImportsin interfacePhonScript- Returns:
- the list of packages that should be available to this script and any dependencies
-
addPackageImport
- Specified by:
addPackageImportin interfacePhonScript
-
removePackageImport
- Specified by:
removePackageImportin interfacePhonScript
-
getClassImports
Description copied from interface:PhonScriptGet 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.- Specified by:
getClassImportsin interfacePhonScript- Returns:
- the list of classes that should be availble to this script and any dependencies
-
addClassImport
- Specified by:
addClassImportin interfacePhonScript
-
removeClassImport
- Specified by:
removeClassImportin interfacePhonScript
-
getRequirePaths
Description copied from interface:PhonScriptGet the list of URLs that should be available for script loading using therequirefunction.- Specified by:
getRequirePathsin interfacePhonScript- Returns:
- list of javascript library folders
-
addRequirePath
- Specified by:
addRequirePathin interfacePhonScript
-
removeRequirePath
- Specified by:
removeRequirePathin interfacePhonScript
-
clone
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
append
- Specified by:
appendin interfacePhonScript
-
appendCodePoint
- Specified by:
appendCodePointin interfacePhonScript
-
capacity
public int capacity()- Specified by:
capacityin interfacePhonScript
-
charAt
public char charAt(int index) - Specified by:
charAtin interfaceCharSequence- Specified by:
charAtin interfacePhonScript
-
codePointAt
public int codePointAt(int index) - Specified by:
codePointAtin interfacePhonScript
-
codePointBefore
public int codePointBefore(int index) - Specified by:
codePointBeforein interfacePhonScript
-
codePointCount
public int codePointCount(int beginIndex, int endIndex) - Specified by:
codePointCountin interfacePhonScript
-
delete
- Specified by:
deletein interfacePhonScript
-
deleteCharAt
- Specified by:
deleteCharAtin interfacePhonScript
-
ensureCapacity
public void ensureCapacity(int minimumCapacity) - Specified by:
ensureCapacityin interfacePhonScript
-
getChars
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) - Specified by:
getCharsin interfacePhonScript
-
indexOf
- Specified by:
indexOfin interfacePhonScript
-
indexOf
- Specified by:
indexOfin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
insert
- Specified by:
insertin interfacePhonScript
-
lastIndexOf
- Specified by:
lastIndexOfin interfacePhonScript
-
lastIndexOf
- Specified by:
lastIndexOfin interfacePhonScript
-
length
public int length()- Specified by:
lengthin interfaceCharSequence- Specified by:
lengthin interfacePhonScript
-
offsetByCodePoints
public int offsetByCodePoints(int index, int codePointOffset) - Specified by:
offsetByCodePointsin interfacePhonScript
-
replace
- Specified by:
replacein interfacePhonScript
-
reverse
- Specified by:
reversein interfacePhonScript
-
setCharAt
public void setCharAt(int index, char ch) - Specified by:
setCharAtin interfacePhonScript
-
setLength
public void setLength(int newLength) - Specified by:
setLengthin interfacePhonScript
-
subSequence
- Specified by:
subSequencein interfaceCharSequence- Specified by:
subSequencein interfacePhonScript
-
substring
- Specified by:
substringin interfacePhonScript
-
substring
- Specified by:
substringin interfacePhonScript
-
trimToSize
public void trimToSize()- Specified by:
trimToSizein interfacePhonScript
-