@Test public void testBasicScript() throws PhonScriptException { final String script = "x = 1 + 1\n"; final BasicScript bs = new BasicScript(script); final PhonScriptContext ctx = bs.getContext(); final Scriptable scope = ctx.createImporterScope(); final Object val = ctx.exec(scope); Assert.assertEquals(Integer.class, val.getClass()); Assert.assertEquals(2, (int)Integer.valueOf(val.toString())); Assert.assertEquals(val, scope.get("x", scope)); }
public BasicScript(String text) { super(); buffer.append(text); setupImports(); }
BasicScript implements PhonScript, Cloneable { public BasicScript(String text) { super(); buffer.append(text); setupImports(); } }
BasicScript implements PhonScript, Cloneable { public BasicScript(String text) { super(); buffer.append(text); setupImports(); } BasicScript(String text);  BasicScript(File file); }
BasicScript implements PhonScript, Cloneable { public BasicScript(String text) { super(); buffer.append(text); setupImports(); } BasicScript(String text);  BasicScript(File file); @Override String getScript(); @Override PhonScriptContext getContext(); PhonScriptContext resetContext(); @Override Set<Class<?>> getExtensions(); @Override T getExtension(Class<T> cap); @Override T putExtension(Class<T> cap, T impl); @Override T removeExtension(Class<T> cap); @Override List<String> getPackageImports(); @Override boolean addPackageImport(String pkgImport); @Override boolean removePackageImport(String pkgImport); @Override List<String> getClassImports(); @Override boolean addClassImport(String classImport); @Override boolean removeClassImport(String classImport); @Override List<URI> getRequirePaths(); @Override boolean addRequirePath(URI uri); @Override boolean removeRequirePath(URI uri); @Override Object clone(); BasicScript append(boolean arg0); BasicScript append(char c); BasicScript append(char[] str, int offset, int len); BasicScript append(char[] str); BasicScript append(CharSequence s, int start, int end); BasicScript append(CharSequence s); BasicScript append(double d); BasicScript append(float f); BasicScript append(int i); BasicScript append(long lng); BasicScript append(Object obj); BasicScript append(String str); BasicScript append(StringBuffer sb); BasicScript appendCodePoint(int codePoint); int capacity(); char charAt(int index); int codePointAt(int index); int codePointBefore(int index); int codePointCount(int beginIndex, int endIndex); BasicScript delete(int start, int end); BasicScript deleteCharAt(int index); void ensureCapacity(int minimumCapacity); void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin); int indexOf(String str, int fromIndex); int indexOf(String str); BasicScript insert(int offset, boolean b); BasicScript insert(int offset, char c); BasicScript insert(int index, char[] str, int offset, int len); BasicScript insert(int offset, char[] str); BasicScript insert(int dstOffset, CharSequence s, int start, int end); BasicScript insert(int dstOffset, CharSequence s); BasicScript insert(int offset, double d); BasicScript insert(int offset, float f); BasicScript insert(int offset, int i); BasicScript insert(int offset, long l); BasicScript insert(int offset, Object obj); BasicScript insert(int offset, String str); int lastIndexOf(String str, int fromIndex); int lastIndexOf(String str); int length(); int offsetByCodePoints(int index, int codePointOffset); BasicScript replace(int start, int end, String str); BasicScript reverse(); void setCharAt(int index, char ch); void setLength(int newLength); CharSequence subSequence(int start, int end); String substring(int start, int end); String substring(int start); void trimToSize(); }
BasicScript implements PhonScript, Cloneable { public BasicScript(String text) { super(); buffer.append(text); setupImports(); } BasicScript(String text);  BasicScript(File file); @Override String getScript(); @Override PhonScriptContext getContext(); PhonScriptContext resetContext(); @Override Set<Class<?>> getExtensions(); @Override T getExtension(Class<T> cap); @Override T putExtension(Class<T> cap, T impl); @Override T removeExtension(Class<T> cap); @Override List<String> getPackageImports(); @Override boolean addPackageImport(String pkgImport); @Override boolean removePackageImport(String pkgImport); @Override List<String> getClassImports(); @Override boolean addClassImport(String classImport); @Override boolean removeClassImport(String classImport); @Override List<URI> getRequirePaths(); @Override boolean addRequirePath(URI uri); @Override boolean removeRequirePath(URI uri); @Override Object clone(); BasicScript append(boolean arg0); BasicScript append(char c); BasicScript append(char[] str, int offset, int len); BasicScript append(char[] str); BasicScript append(CharSequence s, int start, int end); BasicScript append(CharSequence s); BasicScript append(double d); BasicScript append(float f); BasicScript append(int i); BasicScript append(long lng); BasicScript append(Object obj); BasicScript append(String str); BasicScript append(StringBuffer sb); BasicScript appendCodePoint(int codePoint); int capacity(); char charAt(int index); int codePointAt(int index); int codePointBefore(int index); int codePointCount(int beginIndex, int endIndex); BasicScript delete(int start, int end); BasicScript deleteCharAt(int index); void ensureCapacity(int minimumCapacity); void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin); int indexOf(String str, int fromIndex); int indexOf(String str); BasicScript insert(int offset, boolean b); BasicScript insert(int offset, char c); BasicScript insert(int index, char[] str, int offset, int len); BasicScript insert(int offset, char[] str); BasicScript insert(int dstOffset, CharSequence s, int start, int end); BasicScript insert(int dstOffset, CharSequence s); BasicScript insert(int offset, double d); BasicScript insert(int offset, float f); BasicScript insert(int offset, int i); BasicScript insert(int offset, long l); BasicScript insert(int offset, Object obj); BasicScript insert(int offset, String str); int lastIndexOf(String str, int fromIndex); int lastIndexOf(String str); int length(); int offsetByCodePoints(int index, int codePointOffset); BasicScript replace(int start, int end, String str); BasicScript reverse(); void setCharAt(int index, char ch); void setLength(int newLength); CharSequence subSequence(int start, int end); String substring(int start, int end); String substring(int start); void trimToSize();  }