/** * Returns the number of capturing groups in this matcher's pattern. * Group zero denotes the entire pattern by convention. It is not included in this count. * Any non-negative integer smaller than or equal to the value returned by this method * is guaranteed to be a valid group index for this matcher. */ public int groupCount() { return ScriptHelper.evalInt("this.$$$matchResult___java_lang_Object.length-1", this); }
/** * Returns the number of key-value mappings in this map. */ public int size() { int size= ScriptHelper.evalInt("this.obj.size()", null); return size; }
/** * Returns the length of this string. */ public int length() { return ScriptHelper.evalInt("this.length", this); }
/** * Returns a hash code for this string. */ public int hashCode() { return ScriptHelper.evalInt("this.split(\"\").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0)", this); }
public static int getLength(Object array) { ScriptHelper.put("anArray", array, null); return ScriptHelper.evalInt("anArray.length", null); }
public int length() { consolidate(); return ScriptHelper.evalInt("this.buffer[0].length", this); }
/** * Compares two strings lexicographically. */ public int compareTo(String other) { ScriptHelper.put("other", other, this); return ScriptHelper.evalInt("this<other?-1:(this>other?1:0)", this); }
public static int identityHashCode(Object object) { ScriptHelper.put("anObject", object, null); return ScriptHelper.evalInt("objectId(anObject)", null); }
/** * Returns the index within this string of the last occurrence of the specified character. */ public int lastIndexOf(int ch) { ScriptHelper.put("str", String.valueOf((char) ch), this); return ScriptHelper.evalInt("this.lastIndexOf(str)", this); }
/** * Returns the index within this string of the first occurrence of the specified character. */ public int indexOf(int ch) { ScriptHelper.put("ch", ch, this); return ScriptHelper.evalInt("this.indexOf(String.fromCharCode(ch), 0)", this); }
private static int getMatchIndex(Object matchObject) { ScriptHelper.put("matchObject", matchObject, null); return ScriptHelper.evalInt("matchObject.index", null); };
public int lastIndexOf(String str) { ScriptHelper.put("str", str, this); return ScriptHelper.evalInt("this.lastIndexOf(str)", this); }
public static long round(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalInt("Math.round(a)", null); }
/** * Returns the absolute value of an int value. */ public static int abs(int a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalInt("Math.abs(a)", null); }
/** * Returns the smaller of two int values. */ public static int min(int a, int b) { ScriptHelper.put("a", a, null); ScriptHelper.put("b", b, null); return ScriptHelper.evalInt("Math.min(a, b)", null); }
/** * Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. */ public int indexOf(String str, int position) { ScriptHelper.put("str", str, this); ScriptHelper.put("position", position, this); return ScriptHelper.evalInt("this.indexOf(str, position)", this); }
private static int getMatchLength(Object matchObject, int index) { ScriptHelper.put("matchObject", matchObject, null); ScriptHelper.put("index", index, null); return ScriptHelper.evalInt("matchObject[index].length", null); };
public int compare(String s1, String s2) { ScriptHelper.put("s1", s1, this); ScriptHelper.put("s2", s2, this); return ScriptHelper.evalInt("s1.localeCompare(s2)", this) - equalityOffset; } };
/** * Returns the greater of two int values. */ public static int max(int a, int b) { ScriptHelper.put("a", a, null); ScriptHelper.put("b", b, null); return ScriptHelper.evalInt("Math.max(a, b)", null); }
/** * Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. */ public int indexOf(int strr, int position) { //FIXME dragome is making char as a int when using charAt( ) so this method is needed or it will give error by saying method dont exist. ScriptHelper.put("strr", strr, this); ScriptHelper.evalNoResult("var str = String.fromCharCode(strr)", this); ScriptHelper.put("position", position, this); return ScriptHelper.evalInt("this.indexOf(str, position)", this); }