Package ca.phon.script
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
-
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) clone()
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) protected StringBuffer
Used by sub-classes to allow direct access to buffervoid
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.<T> T
getExtension
(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 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) <T> T
putExtension
(Class<T> cap, T impl) Add a new extension.boolean
removeClassImport
(String classImport) <T> T
removeExtension
(Class<T> cap) Remove a capability.boolean
removePackageImport
(String pkgImport) boolean
removeRequirePath
(URI uri) Resets query context.reverse()
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 class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:PhonScript
Get the script text.- Specified by:
getScript
in interfacePhonScript
- Returns:
- script
-
getContext
Description copied from interface:PhonScript
Get a script context for this script. The context is used to compile and evaulate the script.- Specified by:
getContext
in interfacePhonScript
- Returns:
- the script context
-
resetContext
Resets query context.- Specified by:
resetContext
in interfacePhonScript
- Returns:
- the current context (before reset)
-
getExtensions
Description copied from interface:IExtendable
Return all extension types supported- Specified by:
getExtensions
in interfaceIExtendable
-
getExtension
Description copied from interface:IExtendable
Get the requested extension if available.- Specified by:
getExtension
in interfaceIExtendable
- Returns:
- the capability object or
null
if the cability is not available
-
putExtension
Description copied from interface:IExtendable
Add a new extension.- Specified by:
putExtension
in interfaceIExtendable
- Parameters:
cap
- the extension to add- Returns:
- the added extension implementation
-
removeExtension
Description copied from interface:IExtendable
Remove a capability.- Specified by:
removeExtension
in interfaceIExtendable
- Parameters:
cap
- the capability to remove
-
getPackageImports
Description copied from interface:PhonScript
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.- Specified by:
getPackageImports
in interfacePhonScript
- Returns:
- the list of packages that should be available to this script and any dependencies
-
addPackageImport
- Specified by:
addPackageImport
in interfacePhonScript
-
removePackageImport
- Specified by:
removePackageImport
in interfacePhonScript
-
getClassImports
Description copied from interface:PhonScript
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.- Specified by:
getClassImports
in interfacePhonScript
- Returns:
- the list of classes that should be availble to this script and any dependencies
-
addClassImport
- Specified by:
addClassImport
in interfacePhonScript
-
removeClassImport
- Specified by:
removeClassImport
in interfacePhonScript
-
getRequirePaths
Description copied from interface:PhonScript
Get the list of URLs that should be available for script loading using therequire
function.- Specified by:
getRequirePaths
in interfacePhonScript
- Returns:
- list of javascript library folders
-
addRequirePath
- Specified by:
addRequirePath
in interfacePhonScript
-
removeRequirePath
- Specified by:
removeRequirePath
in interfacePhonScript
-
clone
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
append
- Specified by:
append
in interfacePhonScript
-
appendCodePoint
- Specified by:
appendCodePoint
in interfacePhonScript
-
capacity
public int capacity()- Specified by:
capacity
in interfacePhonScript
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
- Specified by:
charAt
in interfacePhonScript
-
codePointAt
public int codePointAt(int index) - Specified by:
codePointAt
in interfacePhonScript
-
codePointBefore
public int codePointBefore(int index) - Specified by:
codePointBefore
in interfacePhonScript
-
codePointCount
public int codePointCount(int beginIndex, int endIndex) - Specified by:
codePointCount
in interfacePhonScript
-
delete
- Specified by:
delete
in interfacePhonScript
-
deleteCharAt
- Specified by:
deleteCharAt
in interfacePhonScript
-
ensureCapacity
public void ensureCapacity(int minimumCapacity) - Specified by:
ensureCapacity
in interfacePhonScript
-
getChars
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) - Specified by:
getChars
in interfacePhonScript
-
indexOf
- Specified by:
indexOf
in interfacePhonScript
-
indexOf
- Specified by:
indexOf
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
insert
- Specified by:
insert
in interfacePhonScript
-
lastIndexOf
- Specified by:
lastIndexOf
in interfacePhonScript
-
lastIndexOf
- Specified by:
lastIndexOf
in interfacePhonScript
-
length
public int length()- Specified by:
length
in interfaceCharSequence
- Specified by:
length
in interfacePhonScript
-
offsetByCodePoints
public int offsetByCodePoints(int index, int codePointOffset) - Specified by:
offsetByCodePoints
in interfacePhonScript
-
replace
- Specified by:
replace
in interfacePhonScript
-
reverse
- Specified by:
reverse
in interfacePhonScript
-
setCharAt
public void setCharAt(int index, char ch) - Specified by:
setCharAt
in interfacePhonScript
-
setLength
public void setLength(int newLength) - Specified by:
setLength
in interfacePhonScript
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
- Specified by:
subSequence
in interfacePhonScript
-
substring
- Specified by:
substring
in interfacePhonScript
-
substring
- Specified by:
substring
in interfacePhonScript
-
trimToSize
public void trimToSize()- Specified by:
trimToSize
in interfacePhonScript
-