0001 
0002 /*
0003  *  JScripter Standard 1.0 - To Script In Java
0004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
0005  *  
0006  *  This program is free software: you can redistribute it and/or modify
0007  *  it under the terms of the GNU Affero General Public License as published by
0008  *  the Free Software Foundation, either version 3 of the License, or
0009  *  (at your option) any later version.
0010  *  
0011  *  This program is distributed in the hope that it will be useful,
0012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  *  GNU Affero General Public License for more details.
0015  *  
0016  *  You should have received a copy of the GNU Affero General Public License
0017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 package js.core;
0021 
0022 import js.*;
0023 
0024 /**
0025  * <p>An <b>opaque</b> class representing JavaScript string objects.</p>
0026  *
0027  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
0028  * @see js.core.JsGlobal.String#create()
0029  * @see js.core.JsGlobal.String#create(Object)
0030  * @see js.core.JsGlobal.String#create(Vars)
0031  * @see jsx.core.StringLikes
0032  * 
0033  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be 
0034  * generated into the target codes. Re-compilers must exit with error on the operations of 
0035  * accessing that kind of class objects.
0036  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored 
0037  * and <tt>instanceof</tt> to it always <tt>true</tt>.
0038  */
0039 public class JsString extends JsGlobal.String.Prototype implements StringLike
0040 {
0041     /**
0042      * <p>An <b>internal</b> class containing membership data for its enclosing 
0043      * opaque class.</p>
0044      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or 
0045      * class members.</p>
0046      *
0047      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
0048      * 
0049      * @javascript Re-compilers must report error on resolving an <b>internal</b> class. 
0050      */
0051     protected static abstract class Members extends JsGlobal.String.Prototype.Members
0052     {
0053         /**
0054          * <p>An <b>internal</b> static field defining a member ID of the field name and 
0055          * used internally to define a member of the same name.</p>
0056          * @since 1.0
0057          * @see JsString#length
0058          * @see Member#length
0059          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
0060          */
0061         public final static Mid length = id("length");
0062     }
0063 
0064     /**
0065      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
0066      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
0067      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
0068      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
0069      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
0070      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
0071      * either circumstance, the field names must be exactly same as the member names, as 
0072      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
0073      * based on the field names.</p>
0074      *
0075      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
0076      * 
0077      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created 
0078      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
0079      * of class objects.
0080      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in 
0081      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
0082      * <pre>q.m</pre>
0083      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier 
0084      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
0085      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
0086      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
0087      * <pre>m</pre>
0088      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report 
0089      * error on the access to <b>opaque</b> fields declared by this class under any other 
0090      * circumstances.
0091      */
0092     public static class Member extends JsGlobal.String.Prototype.Member
0093     {
0094         /**
0095          * <p>Internally constructs a member based on a qualifying member.</p>
0096          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
0097          * or <b>internal</b> classes or class members.</p>
0098          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
0099          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
0100          * declared in the declaring class of this constructor itself or its subclasses. 
0101          * Under this circumstance, the field names must be exactly same as the member 
0102          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
0103          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly 
0104          * to their names appending to the name resolved from the specified qualifying 
0105          * member with a dot in between.</p>
0106          * @param q A qualifying member
0107          * @param mid The ID of the member to construct
0108          * @since 1.0
0109          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
0110          */
0111         public Member(JsObject.Member q, Mid mid) {
0112             super(q, mid);
0113         }
0114         /**
0115          * <p>Internally constructs a member without a qualifying member.</p>
0116          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
0117          * or <b>internal</b> classes or class members.</p>
0118          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
0119          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
0120          * declared in <b>opaque</b> types other than the declaring class of this constructor 
0121          * itself and its subclasses. Under this circumstance, the field names must be 
0122          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b> 
0123          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
0124          * @param mid The ID of the member to construct
0125          * @since 1.0
0126          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
0127          */
0128         public Member(Mid mid) {
0129             super(mid);
0130         }
0131         /**
0132          * <p>Evaluates the property, represented by the current member instance, of the 
0133          * argument object.</p>
0134          * @param o The argument object
0135          * @return The value of the current member based on the object argument.
0136          * @since 1.0
0137          * @javascript Re-compilers must convert the instance invocation of this method into 
0138          * the JavaScript expression: 
0139          * <pre>o.m</pre>
0140          * where <tt>m</tt> is the identifier name resolved from the current member 
0141          * instance of the invocation.
0142          */
0143         @Override
0144         public JsString with(ObjectLike o) {
0145             return new JsString((JsObject)var(o).var(mid()));
0146         }
0147 
0148         /**
0149          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the 
0150          * name of this field, qualified by the current member instance of the field, and 
0151          * to access the property of the name on an object.</p>
0152          * <p>The <tt>constructor</tt> property of an object is a reference to the function 
0153          * that was the constructor for that object.</p>
0154          * <p>A common use of the <tt>constructor</tt> property is to determine the type of unknown 
0155          * objects. Given an unknown value, you can use the {@link js.Js#typeof(Object)} operation 
0156          * to determine whether it is a primitive value or an object. If it is an object, you can 
0157          * use the <tt>constructor</tt> property to determine what type of object it is.</p>
0158          * <p>Note, however, that while this technique works for the objects built into core 
0159          * JavaScript, it is not guaranteed to work with host objects such as the <tt>window</tt> 
0160          * object of client-side JavaScript. The default implementation of the <tt>toString()</tt> 
0161          * method provides another way to determine the type of an unknown object.</p>
0162          * @since 1.0
0163          * @javascript Re-compilers must resolve the member of this instance field to the 
0164          * identifier of the field name appending to the identifier resolved from its 
0165          * qualifying member with a dot in between.
0166          */
0167         public final JsFunction.Member<JsString> constructor = new JsFunction.Member<JsString>(this, Members.constructor, Generic.get(JsString.class));
0168         /**
0169          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the 
0170          * name of this field, qualified by the current member instance of the field, and 
0171          * to access the property of the name on an object.</p>
0172          * @since 1.0
0173          * @see JsString#length()
0174          * @javascript Re-compilers must resolve the member of this instance field to the 
0175          * identifier of the field name appending to the identifier resolved from its 
0176          * qualifying member with a dot in between.
0177          */
0178         public final Value.Integer.Member length = new Value.Integer.Member(this, Members.length);
0179     }
0180 
0181     /**
0182      * <p>Internally constructs a string object.</p>
0183      * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> or 
0184      * <b>internal</b> classes or class members.</p>
0185      * @since 1.0
0186      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
0187      */
0188     protected JsString(Object var) {
0189         super((JsObject)var);
0190     }
0191     /**
0192      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it 
0193      * with the wrapping constructor.</p>
0194      * @param var The argument of an <b>opaque</b> object.
0195      * @since 1.0
0196      * @javascript Re-compilers must ignore the construction operation of this constructor, 
0197      * that is, replacing it with its only argument.
0198      */
0199     public JsString(JsObject var) {
0200         super(var(var, (JsString)null));
0201     }
0202     /**
0203      * <p>Casts a string value to the current <b>opaque</b> type by wrapping it with the 
0204      * wrapping constructor.</p>
0205      * @param var The argument of a string.
0206      * @since 1.0
0207      * @javascript Re-compilers must ignore the construction operation of this constructor, 
0208      * that is, replacing it with its only argument.
0209      */
0210     public JsString(String var) {
0211         super(JsGlobal.String.with().create(var));
0212     }
0213     /**
0214      * <p>Casts a string value to the current <b>opaque</b> type by wrapping it with the 
0215      * wrapping constructor.</p>
0216      * @param var The argument of a string.
0217      * @since 1.0
0218      * @javascript Re-compilers must ignore the construction operation of this constructor, 
0219      * that is, replacing it with its only argument.
0220      */
0221     public JsString(Var<String> var) {
0222         super(JsGlobal.String.with().create(var));
0223     }
0224 
0225     /**
0226      * <p>Simply returns the current string instance.</p>
0227      * <p>This method is useful for JS Simulation to implement opaque types.</p>
0228      * @return The current string instance.
0229      * @since 1.0
0230      * @javascript Re-compilers must ignore the instance invocation of this method, that is, 
0231      * replacing it with its current instance.
0232      */
0233     @Override
0234     public JsString var() {
0235         return (JsString)super.var();
0236     }
0237     /**
0238      * <p>Assigns the value of another string instance to the string number object.</p>
0239      * @param var The argument string instance.
0240      * @return The new instance.
0241      * @since 1.0
0242      * @javascript Re-compilers must convert the instance invocation of this method into 
0243      * the JavaScript expression: 
0244      * <pre>o = var</pre>
0245      * where <tt>o</tt> is the current instance of the invocation of this method.
0246      */
0247     @Override
0248     public final <S extends JsObject> S var(S var) {
0249         var(var, (JsString)null);
0250         return var;
0251     }
0252 
0253     /**
0254      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
0255      * without a qualifying member and to access the property of the name on an object.</p>
0256      * <p>The <tt>constructor</tt> property of an object is a reference to the function 
0257      * that was the constructor for that object.</p>
0258      * <p>A common use of the <tt>constructor</tt> property is to determine the type of unknown 
0259      * objects. Given an unknown value, you can use the {@link js.Js#typeof(Object)} operation 
0260      * to determine whether it is a primitive value or an object. If it is an object, you can 
0261      * use the <tt>constructor</tt> property to determine what type of object it is.</p>
0262      * <p>Note, however, that while this technique works for the objects built into core 
0263      * JavaScript, it is not guaranteed to work with host objects such as the <tt>window</tt> 
0264      * object of client-side JavaScript. The default implementation of the <tt>toString()</tt> 
0265      * method provides another way to determine the type of an unknown object.</p>
0266      * @since 1.0
0267      * @javascript Re-compilers must resolve the member of this static field to the 
0268      * identifier of the field name.
0269      */
0270     public static final JsFunction.Member<JsString> constructor = new JsFunction.Member<JsString>(Members.constructor, Generic.get(JsString.class));
0271     /**
0272      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
0273      * without a qualifying member and to access the property of the name on an object.</p>
0274      * @since 1.0
0275      * @see JsString#length()
0276      * @javascript Re-compilers must resolve the member of this static field to the 
0277      * identifier of the field name.
0278      */
0279     public static final Value.Integer.Member length = new Value.Integer.Member(Members.length);
0280 
0281     /**
0282      * <p>Gets the length of the current string, an integer that indicates the number of 
0283      * characters in the current string. For any string <tt>s</tt>, the index of the 
0284      * last character is <tt>s.length() - 1</tt>. The length property of a string may 
0285      * not be deleted.</p>
0286      * @return The length of the current string.
0287      * @see jsx.core.StringLikes#length(StringLike)
0288      * @since 1.0
0289      * @javascript Re-compilers must convert the interface invocation of this method into the 
0290      * JavaScript expression: 
0291      * <pre>s.length</pre>
0292      * where <tt>s</tt> is the current string instance of the invocation.
0293      */
0294     public final int length() {
0295         return length.with(this).intValue();
0296     }
0297 
0298     /**
0299      * <p>Returns the character string of length 1 at the specified <tt>index</tt> within 
0300      * the current string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0301      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0302      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0303      * this invocation returns an empty string.</p>
0304      * @param index The index of the character
0305      * @return The character string of length 1 at the specified index of the current string
0306      * @see #charCodeAt(Object)
0307      * @see #indexOf(Object)
0308      * @see #indexOf(Object, Object)
0309      * @see #lastIndexOf(Object)
0310      * @see #lastIndexOf(Object, Object)
0311      * @see jsx.core.StringLikes#charAt(StringLike, Object)
0312      * @see jsx.core.StringLikes#charAt(String, Object)
0313      * @since 1.0
0314      * @javascript Re-compilers must convert the interface invocation of this method directly 
0315      * into a JavaScript invocation on its current string instance without changing the 
0316      * method name, but expanding variable arguments, if any, into comma-separated values. 
0317      */
0318     public final String charAt(Object index) {
0319         return call(charAt, index);
0320     }
0321 
0322     /**
0323      * <p>Returns the character encoding at a specific <tt>index</tt> within the current 
0324      * string. An index ranges from 0 to <tt>length() - 1</tt>. The first 
0325      * character of the sequence is at index 0, the next at index 1, and so on, as for 
0326      * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>, 
0327      * this invocation returns <tt>NaN</tt>.</p>
0328      * @param index The index of the character
0329      * @return The Unicode encoding of the character within the current string. The return 
0330      * value is a 16-bit integer between 0 and 65535.
0331      * @see #charAt(Object)
0332      * @see #indexOf(Object)
0333      * @see #indexOf(Object, Object)
0334      * @see #lastIndexOf(Object)
0335      * @see #lastIndexOf(Object, Object)
0336      * @see jsx.core.StringLikes#charCodeAt(StringLike, Object)
0337      * @see jsx.core.StringLikes#charCodeAt(String, Object)
0338      * @since 1.0
0339      * @javascript Re-compilers must convert the interface invocation of this method directly 
0340      * into a JavaScript invocation on its current string instance without changing the 
0341      * method name, but expanding variable arguments, if any, into comma-separated values. 
0342      */
0343     public final Character charCodeAt(Object index) {
0344         return call(charCodeAt, index);
0345     }
0346 
0347     /**
0348      * <p>Converts the argument to a string (if necessary) and appends them, in order, to 
0349      * the end of the current string and returns the resulting concatenation.</p>
0350      * <p>Note that the current string itself is not modified.</p>
0351      * <p>This method is an analog to {@link ArrayLike#concat(Object)}. Note that it is 
0352      * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
0353      * @param other A value to be concatenated to the current string
0354      * @return A new string that results from concatenating the argument to the current 
0355      * string.
0356      * @see #concat(Vars)
0357      * @see ArrayLike#concat(Object)
0358      * @see ArrayLike#concat(Vars)
0359      * @see jsx.core.StringLikes#concat(StringLike, Object)
0360      * @see jsx.core.StringLikes#concat(String, Object)
0361      * @since 1.0
0362      * @javascript Re-compilers must convert the interface invocation of this method directly 
0363      * into a JavaScript invocation on its current string instance without changing the 
0364      * method name, but expanding variable arguments, if any, into comma-separated values. 
0365      */
0366     public final String concat(Object other) {
0367         return call(concat, other);
0368     }
0369 
0370     /**
0371      * <p>Converts each of the argument values to a string (if necessary) and appends them, 
0372      * in order, to the end of the current string and returns the resulting concatenation.</p>
0373      * <p>Note that the current string itself is not modified.</p>
0374      * <p>This method is an analog to {@link ArrayLike#concat(Vars)}. Note that it is 
0375      * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
0376      * @param args A list of the values to be concatenated to the current string
0377      * @return A new string that results from concatenating each of the argument values 
0378      * to the current string.
0379      * @see #concat(Object)
0380      * @see ArrayLike#concat(Object)
0381      * @see ArrayLike#concat(Vars)
0382      * @since 1.0
0383      * @javascript Re-compilers must convert the interface invocation of this method directly 
0384      * into a JavaScript invocation on its current string instance without changing the 
0385      * method name, but expanding variable arguments, if any, into comma-separated values. 
0386      */
0387     public final String concat(Vars<?> args) {
0388         return call(concat, args);
0389     }
0390 
0391     /**
0392      * <p>Searches the current string instance from beginning to end to see if it contains 
0393      * an occurrence of the substring <tt>other</tt>. The search begins at the beginning 
0394      * of the current string. If an occurrence of the substring is found, this invocation 
0395      * returns the position of the first character of the first occurrence of the substring 
0396      * within the current string. Character positions within string are numbered starting with 
0397      * zero. If no occurrence of substring is found within the current string, this invocation 
0398      * returns -1.</p>
0399      * @param other The substring that is to be searched for within the current string
0400      * @return The position of the first occurrence of <tt>other</tt> within string, if 
0401      * any, or -1 if no such occurrence is found.
0402      * @see #indexOf(Object, Object)
0403      * @see #charAt(Object)
0404      * @see #lastIndexOf(Object)
0405      * @see #lastIndexOf(Object, Object)
0406      * @see #substr(Object)
0407      * @see #substr(Object, Object)
0408      * @see #substring(Object)
0409      * @see #substring(Object, Object)
0410      * @see jsx.core.StringLikes#indexOf(StringLike, Object)
0411      * @see jsx.core.StringLikes#indexOf(String, Object)
0412      * @since 1.0
0413      * @javascript Re-compilers must convert the interface invocation of this method directly 
0414      * into a JavaScript invocation on its current string instance without changing the 
0415      * method name, but expanding variable arguments, if any, into comma-separated values. 
0416      */
0417     public final Integer indexOf(Object other) {
0418         return call(indexOf, other);
0419     }
0420 
0421     /**
0422      * <p>Searches the current string instance from beginning to end to see if it contains 
0423      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0424      * <tt>pos</tt> within string, or at the beginning of string if <tt>pos</tt> is  
0425      * undefined. If an occurrence of the substring is found, this invocation returns the 
0426      * position of the first character of the first occurrence of the substring within 
0427      * the current string. Character positions within string are numbered starting with 
0428      * zero. If no occurrence of substring is found within the current string, this invocation 
0429      * returns -1.</p>
0430      * @param other The substring that is to be searched for within the current string
0431      * @param pos An optional integer argument that specifies the position within the 
0432      * current string at which the search is to start. Legal values are 0 (the position of 
0433      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0434      * the last character in the string). If this argument is undefined, the search begins 
0435      * at the first character of the string
0436      * @return The position of the first occurrence of <tt>other</tt> within string that 
0437      * appears after the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0438      * is found.
0439      * @see #indexOf(Object)
0440      * @see #charAt(Object)
0441      * @see #lastIndexOf(Object)
0442      * @see #lastIndexOf(Object, Object)
0443      * @see #substr(Object)
0444      * @see #substr(Object, Object)
0445      * @see #substring(Object)
0446      * @see #substring(Object, Object)
0447      * @see jsx.core.StringLikes#indexOf(StringLike, Object, Object)
0448      * @see jsx.core.StringLikes#indexOf(String, Object, Object)
0449      * @since 1.0
0450      * @javascript Re-compilers must convert the interface invocation of this method directly 
0451      * into a JavaScript invocation on its current string instance without changing the 
0452      * method name, but expanding variable arguments, if any, into comma-separated values. 
0453      */
0454     public final Integer indexOf(Object other, Object pos) {
0455         return call(indexOf, new Vars<Object>().add(other).add(pos));
0456     }
0457 
0458     /**
0459      * <p>Searches the current string instance from end to beginning to see if it contains 
0460      * an occurrence of the substring <tt>other</tt>. The search begins at the end 
0461      * of the current string. If an occurrence of the substring is found, this invocation 
0462      * returns the position of the first character of that occurrence. If no occurrence of 
0463      * substring is found within the current string, this invocation returns -1.</p>
0464      * @param other The substring that is to be searched for within the current string
0465      * @return The position of the last occurrence of <tt>other</tt> within string, if 
0466      * any, or -1 if no such occurrence is found.
0467      * @see #lastIndexOf(Object, Object)
0468      * @see #charAt(Object)
0469      * @see #indexOf(Object)
0470      * @see #indexOf(Object, Object)
0471      * @see #substr(Object)
0472      * @see #substr(Object, Object)
0473      * @see #substring(Object)
0474      * @see #substring(Object, Object)
0475      * @see jsx.core.StringLikes#lastIndexOf(StringLike, Object)
0476      * @see jsx.core.StringLikes#lastIndexOf(String, Object)
0477      * @since 1.0
0478      * @javascript Re-compilers must convert the interface invocation of this method directly 
0479      * into a JavaScript invocation on its current string instance without changing the 
0480      * method name, but expanding variable arguments, if any, into comma-separated values. 
0481      */
0482     public final Integer lastIndexOf(Object other) {
0483         return call(lastIndexOf, other);
0484     }
0485 
0486     /**
0487      * <p>Searches the current string instance from end to beginning to see if it contains 
0488      * an occurrence of the substring <tt>other</tt>. The search begins at position 
0489      * <tt>pos</tt> within string, or at the end of string if <tt>pos</tt> is  
0490      * undefined. If an occurrence of the substring is found, this invocation returns the 
0491      * position of the first character that occurrence. Since this method 
0492      * searches from end to beginning of the string, the first occurrence found is the last 
0493      * one in the string that occurs before the <tt>pos</tt> position. If no occurrence 
0494      * of substring is found within the current string, this invocation returns -1.</p>
0495      * @param other The substring that is to be searched for within the current string
0496      * @param pos An optional integer argument that specifies the position within the 
0497      * current string at which the search is to start. Legal values are 0 (the position of 
0498      * the first character in the string) to <tt>length() - 1</tt> (the position of 
0499      * the last character in the string). If this argument is undefined, the search begins 
0500      * at the last character of the string
0501      * @return The position of the last occurrence of <tt>other</tt> within string that 
0502      * appears before the <tt>pos</tt> position, if any, or -1 if no such occurrence 
0503      * is found.
0504      * @see #lastIndexOf(Object)
0505      * @see #charAt(Object)
0506      * @see #indexOf(Object)
0507      * @see #indexOf(Object, Object)
0508      * @see #substr(Object)
0509      * @see #substr(Object, Object)
0510      * @see #substring(Object)
0511      * @see #substring(Object, Object)
0512      * @see jsx.core.StringLikes#lastIndexOf(StringLike, Object, Object)
0513      * @see jsx.core.StringLikes#lastIndexOf(String, Object, Object)
0514      * @since 1.0
0515      * @javascript Re-compilers must convert the interface invocation of this method directly 
0516      * into a JavaScript invocation on its current string instance without changing the 
0517      * method name, but expanding variable arguments, if any, into comma-separated values. 
0518      */
0519     public final Integer lastIndexOf(Object other, Object pos) {
0520         return call(lastIndexOf, new Vars<Object>().add(other).add(pos));
0521     }
0522 
0523     /**
0524      * <p>Compares strings taking the collation order of the default locale into account.</p>
0525      * <p>The ECMAScript standard does not specify how the locale-specific comparison is done; 
0526      * it merely specifies that this function utilize the collation order provided by the 
0527      * underlying operating system.</p>
0528      * @param other A string to be compared, in a locale-sensitive fashion, with the current string
0529      * @return An integer number that indicates the result of the comparison. If the current 
0530      * string is "less than" the string <tt>other</tt>, this invocation returns a 
0531      * number less than zero. If the current string is "greater than" <tt>other</tt>, 
0532      * it returns a integer number greater than zero. And if the strings are identical or 
0533      * indistinguishable according to the locale ordering conventions, the method returns 0.
0534      * @see jsx.core.StringLikes#localeCompare(StringLike, Object)
0535      * @see jsx.core.StringLikes#localeCompare(String, Object)
0536      * @since 1.0
0537      * @javascript Re-compilers must convert the interface invocation of this method directly 
0538      * into a JavaScript invocation on its current string instance without changing the 
0539      * method name, but expanding variable arguments, if any, into comma-separated values. 
0540      */
0541     public final Integer localeCompare(Object other) {
0542         return call(localeCompare, other);
0543     }
0544 
0545     /**
0546      * <p>Searches the current string for one or more matches of <tt>regexp</tt>. 
0547      * The behavior of this invocation depends significantly on whether <tt>regexp</tt> 
0548      * has the "g" attribute or not .</p>
0549      * <p>If <tt>regexp</tt> does not have the "g" attribute, this invocation searches 
0550      * string for a single match. If no match is found, it returns <tt>null</tt>. 
0551      * Otherwise, it returns an array containing information about the match that it found. 
0552      * Element 0 of the array contains the matched text. The remaining elements contain 
0553      * the text that matches any parenthesized subexpressions within the regular expression. 
0554      * In addition to these normal array elements, the returned array also has two object 
0555      * properties. The <tt>index</tt> property (see {@link ArrayLike#index()}) of the array  
0556      * specifies the character position within string of the start of the matched text. Also, 
0557      * the <tt>input</tt> property (see {@link ArrayLike#input()}) of the returned array 
0558      * is a reference to string itself.</p>
0559      * <p>If <tt>regexp</tt> has the "g" flag, this invocation does a global search, 
0560      * searching string for all matching substrings. It returns <tt>null</tt> if no 
0561      * match is found, and it returns an array if one or more matches are found. The 
0562      * contents of this returned array are quite different for global matches, however. In 
0563      * this case, the array elements contain each of the matched substrings within string. 
0564      * The returned array does not have <tt>index</tt> (see {@link ArrayLike#index()}) 
0565      * or <tt>input</tt> (see {@link ArrayLike#input()}) properties in this case. Note 
0566      * that for global matches, this invocation does not provide information about 
0567      * parenthesized subexpressions, nor does it specify where within string each match 
0568      * occurred. If you need to obtain this information for a global search, you can use 
0569      * {@link RegExpLike#exec(Object)}.</p>
0570      * @param regexp A RegExp object that specifies the pattern to be matched
0571      * @return An array containing the results of the match. The contents of the array 
0572      * depend on whether regexp has the global "g" attribute set.
0573      * @see #replace(RegExpLike, String)
0574      * @see #replace(RegExpLike, StringLike)
0575      * @see #replace(RegExpLike, JsFunction)
0576      * @see #search(RegExpLike)
0577      * @see ArrayLike#index()
0578      * @see ArrayLike#input()
0579      * @see Js#re(String)
0580      * @see Js#re(String, String)
0581      * @see RegExpLike#exec(Object)
0582      * @see RegExpLike#test(Object)
0583      * @see jsx.core.StringLikes#match(StringLike, RegExpLike)
0584      * @see jsx.core.StringLikes#match(String, RegExpLike)
0585      * @since 1.0
0586      * @javascript Re-compilers must convert the interface invocation of this method directly 
0587      * into a JavaScript invocation on its current string instance without changing the 
0588      * method name, but expanding variable arguments, if any, into comma-separated values. 
0589      */
0590     public final JsArray match(RegExpLike regexp) {
0591         return new JsArray(call(match, regexp));
0592     }
0593 
0594     /**
0595      * <p>Performs a search-and-replace operation on the current string.</p>
0596      * <p>This invocation searches the current string for one or more substrings that 
0597      * match <tt>regexp</tt> and replaces them with the replacement string 
0598      * <tt>newSubStr</tt>.</p>
0599      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0600      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0601      * substring.</p>
0602      * <p>Note that the $ character has special meaning within the replacement string 
0603      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0604      * derived from the pattern match is used in the replacement.</p>
0605      * <ul>
0606      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0607      * subexpression within <tt>regexp</tt></li>
0608      * <li>$& The substring that matched <tt>regexp</tt></li>
0609      * <li>$' The text to the left of the matched substring</li>
0610      * <li>$' The text to the right of the matched substring</li>
0611      * <li>$$ A literal dollar sign</li>
0612      * </ul>
0613      * @param regexp The RegExp object that specifies the pattern to be replaced
0614      * @param newSubStr A string that specifies the replacement text
0615      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0616      * replaced with the replacement.
0617      * @see #replace(RegExpLike, StringLike)
0618      * @see #replace(RegExpLike, JsFunction)
0619      * @see #match(RegExpLike)
0620      * @see #search(RegExpLike)
0621      * @see Js#re(String)
0622      * @see Js#re(String, String)
0623      * @see RegExpLike#exec(Object)
0624      * @see RegExpLike#test(Object)
0625      * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, String)
0626      * @see jsx.core.StringLikes#replace(String, RegExpLike, String)
0627      * @since 1.0
0628      * @javascript Re-compilers must convert the interface invocation of this method directly 
0629      * into a JavaScript invocation on its current string instance without changing the 
0630      * method name, but expanding variable arguments, if any, into comma-separated values. 
0631      */
0632     public final String replace(RegExpLike regexp, String newSubStr) {
0633         return call(replace, new Vars<Object>().add(regexp).add(newSubStr));
0634     }
0635 
0636     /**
0637      * <p>Performs a search-and-replace operation on the current string.</p>
0638      * <p>This invocation searches the current string for one or more substrings that 
0639      * match <tt>regexp</tt> and replaces them with the replacement string 
0640      * <tt>newSubStr</tt>.</p>
0641      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0642      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0643      * substring.</p>
0644      * <p>Note that the $ character has special meaning within the replacement string 
0645      * <tt>newSubStr</tt>. As shown in the following, it indicates that a string 
0646      * derived from the pattern match is used in the replacement.</p>
0647      * <ul>
0648      * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized 
0649      * subexpression within <tt>regexp</tt></li>
0650      * <li>$& The substring that matched <tt>regexp</tt></li>
0651      * <li>$' The text to the left of the matched substring</li>
0652      * <li>$' The text to the right of the matched substring</li>
0653      * <li>$$ A literal dollar sign</li>
0654      * </ul>
0655      * @param regexp The RegExp object that specifies the pattern to be replaced
0656      * @param newSubStr A string that specifies the replacement text
0657      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0658      * replaced with the replacement.
0659      * @see #replace(RegExpLike, String)
0660      * @see #replace(RegExpLike, JsFunction)
0661      * @see #match(RegExpLike)
0662      * @see #search(RegExpLike)
0663      * @see Js#re(String)
0664      * @see Js#re(String, String)
0665      * @see RegExpLike#exec(Object)
0666      * @see RegExpLike#test(Object)
0667      * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, StringLike)
0668      * @see jsx.core.StringLikes#replace(String, RegExpLike, StringLike)
0669      * @since 1.0
0670      * @javascript Re-compilers must convert the interface invocation of this method directly 
0671      * into a JavaScript invocation on its current string instance without changing the 
0672      * method name, but expanding variable arguments, if any, into comma-separated values. 
0673      */
0674     public final String replace(RegExpLike regexp, StringLike newSubStr) {
0675         return call(replace, new Vars<Object>().add(regexp).add(newSubStr));
0676     }
0677 
0678     /**
0679      * <p>Performs a search-and-replace operation on the current string.</p>
0680      * <p>This invocation searches the current string for one or more substrings that 
0681      * match <tt>regexp</tt> and replaces them with the replacement string generated by 
0682      * <tt>lambda</tt>.</p>
0683      * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation 
0684      * replaces all matching substrings. Otherwise, it replaces only the first matching 
0685      * substring.</p>
0686      * @param regexp The RegExp object that specifies the pattern to be replaced
0687      * @param lambda A function that is invoked to generate the replacement text
0688      * @return A new string, with the first match, or all matches, of <tt>regexp</tt> 
0689      * replaced with the replacement.
0690      * @see #replace(RegExpLike, String)
0691      * @see #replace(RegExpLike, StringLike)
0692      * @see #match(RegExpLike)
0693      * @see #search(RegExpLike)
0694      * @see Js#re(String)
0695      * @see Js#re(String, String)
0696      * @see RegExpLike#exec(Object)
0697      * @see RegExpLike#test(Object)
0698      * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, JsFunction)
0699      * @see jsx.core.StringLikes#replace(String, RegExpLike, JsFunction)
0700      * @since 1.0
0701      * @javascript Re-compilers must convert the interface invocation of this method directly 
0702      * into a JavaScript invocation on its current string instance without changing the 
0703      * method name, but expanding variable arguments, if any, into comma-separated values. 
0704      */
0705     public final String replace(RegExpLike regexp, JsFunction<String> lambda) {
0706         return call(replace, new Vars<Object>().add(regexp).add(lambda));
0707     }
0708 
0709     /**
0710      * <p>Looks for a substring matching <tt>regexp</tt> within the current string 
0711      * and returns the position of the first character of the matching substring, 
0712      * or -1 if no match was found.</p>
0713      * <p>This invocation does not do global matches; it ignores the "g" flag of 
0714      * <tt>regexp</tt>. It also ignores the <tt>lastIndex</tt> property 
0715      * (see {@link RegExpLike#lastIndex()} and {@link RegExpLike#lastIndex(Integer)}) of 
0716      * <tt>regexp</tt> and always searches from the beginning of the string, which 
0717      * means that it always returns the position of the first match in the string.</p>
0718      * @param regexp A RegExp object that specifies the pattern to be searched for in the current string.
0719      * @return The position of the start of the first substring of the current string 
0720      * that matches <tt>regexp</tt>, or -1 if no match is found.
0721      * @see #replace(RegExpLike, String)
0722      * @see #replace(RegExpLike, StringLike)
0723      * @see #replace(RegExpLike, JsFunction)
0724      * @see #match(RegExpLike)
0725      * @see Js#re(String)
0726      * @see Js#re(String, String)
0727      * @see RegExpLike#exec(Object)
0728      * @see RegExpLike#test(Object)
0729      * @see jsx.core.StringLikes#search(StringLike, RegExpLike)
0730      * @see jsx.core.StringLikes#search(String, RegExpLike)
0731      * @since 1.0
0732      * @javascript Re-compilers must convert the interface invocation of this method directly 
0733      * into a JavaScript invocation on its current string instance without changing the 
0734      * method name, but expanding variable arguments, if any, into comma-separated values. 
0735      */
0736     public final Integer search(RegExpLike regexp) {
0737         return call(search, regexp);
0738     }
0739 
0740     /**
0741      * <p>Returns a string containing a slice, or substring, of the current string without 
0742      * modify it.</p>
0743      * @param begin The string index where the slice is to begin. If negative, this argument 
0744      * specifies a position measured from the end of the string. That is, -1 indicates the 
0745      * last character, -2 indicates the second from last character, and so on.
0746      * @return A new string that contains all the characters of string from and including 
0747      * <tt>begin</tt>.
0748      * @see #slice(Object, Object)
0749      * @see #substr(Object)
0750      * @see #substr(Object, Object)
0751      * @see #substring(Object)
0752      * @see #substring(Object, Object)
0753      * @see ArrayLike#slice(Object)
0754      * @see ArrayLike#slice(Object, Object)
0755      * @see ArrayLike#slice(Vars)
0756      * @see jsx.core.StringLikes#slice(StringLike, Object)
0757      * @see jsx.core.StringLikes#slice(String, Object)
0758      * @since 1.0
0759      * @javascript Re-compilers must convert the interface invocation of this method directly 
0760      * into a JavaScript invocation on its current string instance without changing the 
0761      * method name, but expanding variable arguments, if any, into comma-separated values. 
0762      */
0763     public final String slice(Object begin) {
0764         return call(slice, begin);
0765     }
0766 
0767     /**
0768      * <p>Returns a string containing a slice, or substring, of the current string without 
0769      * modify it.</p>
0770      * @param begin The string index where the slice is to begin. If negative, this argument 
0771      * specifies a position measured from the end of the string. That is, -1 indicates the 
0772      * last character, -2 indicates the second from last character, and so on.
0773      * @param end The string index immediately after the end of the slice. If undefined, 
0774      * the slice includes all characters from <tt>begin</tt> to the end of the string. 
0775      * If this argument is negative, it specifies a position measured from the end of the 
0776      * string.
0777      * @return A new string that contains all the characters of string from and including 
0778      * <tt>begin</tt>, and up to but not including <tt>end</tt>.
0779      * @see #slice(Object, Object)
0780      * @see #substr(Object)
0781      * @see #substr(Object, Object)
0782      * @see #substring(Object)
0783      * @see #substring(Object, Object)
0784      * @see ArrayLike#slice(Object)
0785      * @see ArrayLike#slice(Object, Object)
0786      * @see ArrayLike#slice(Vars)
0787      * @see jsx.core.StringLikes#slice(StringLike, Object, Object)
0788      * @see jsx.core.StringLikes#slice(String, Object, Object)
0789      * @since 1.0
0790      * @javascript Re-compilers must convert the interface invocation of this method directly 
0791      * into a JavaScript invocation on its current string instance without changing the 
0792      * method name, but expanding variable arguments, if any, into comma-separated values. 
0793      */
0794     public final String slice(Object begin, Object end) {
0795         return call(slice, new Vars<Object>().add(begin).add(end));
0796     }
0797 
0798     /**
0799      * <p>Creates and returns an array of substrings of the current string. These 
0800      * substrings are created by searching the string from start to end for text that 
0801      * matches <tt>separator</tt> and breaking the string before and after that 
0802      * matching text. The <tt>separator</tt> text is not included in any of the 
0803      * returned substrings, except as noted at the end of this section. Note that if the 
0804      * <tt>separator</tt> matches the beginning of the string, the first element of 
0805      * the returned array will be an empty string, the text that appears before the 
0806      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
0807      * the string, the last element of the array will be the empty string.</p>
0808      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
0809      * and the returned array contains only a single, unbroken string element. If 
0810      * <tt>separator</tt> is the empty string or a regular expression that matches 
0811      * the empty string, the string is broken between each character, and the returned 
0812      * array has the same length as the string does. Note that this is a special case 
0813      * because the empty strings before the first character and after the last character 
0814      * are not matched.</p>
0815      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
0816      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
0817      * if <tt>separator</tt> is a regular expression that contains parenthesized 
0818      * subexpressions, the substrings that match those parenthesized subexpressions 
0819      * (but not the text that matches the regular expression as a whole) are included in 
0820      * the returned array.</p>
0821      * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or 
0822      * {@link ArrayLike#join(Object)} method.</p>
0823      * @param separator The string or regular expression at which the current string splits.
0824      * @return An array of strings, created by splitting string into substrings at the 
0825      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
0826      * array do not include <tt>separator</tt> itself, except in the case noted in the 
0827      * above description.
0828      * @see #split(Object, Object)
0829      * @see ArrayLike#join()
0830      * @see ArrayLike#join(Object)
0831      * @see jsx.core.StringLikes#split(StringLike, Object)
0832      * @see jsx.core.StringLikes#split(String, Object)
0833      * @since 1.0
0834      * @javascript Re-compilers must convert the interface invocation of this method directly 
0835      * into a JavaScript invocation on its current string instance without changing the 
0836      * method name, but expanding variable arguments, if any, into comma-separated values. 
0837      */
0838     public final JsArray split(Object separator) {
0839         return new JsArray(call(split, separator));
0840     }
0841 
0842     /**
0843      * <p>Creates and returns an array of as many as <tt>limit</tt> substrings of the 
0844      * current string. These substrings are created by searching the string from start to 
0845      * end for text that matches <tt>separator</tt> and breaking the string before and 
0846      * after that matching text. The <tt>separator</tt> text is not included in any of 
0847      * the returned substrings, except as noted at the end of this section. Note that if 
0848      * the <tt>separator</tt> matches the beginning of the string, the first element 
0849      * of the returned array will be an empty string, the text that appears before the 
0850      * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of 
0851      * the string, the last element of the array (assuming no conflicting <tt>limit</tt>) 
0852      * will be the empty string.</p>
0853      * <p>If <tt>separator</tt> is undefined, the current string is not split at all, 
0854      * and the returned array contains only a single, unbroken string element. If 
0855      * <tt>separator</tt> is the empty string or a regular expression that matches 
0856      * the empty string, the string is broken between each character, and the returned 
0857      * array has the same length as the string does, assuming no smaller <tt>limit</tt> 
0858      * is specified. Note that this is a special case because the empty strings before 
0859      * the first character and after the last character are not matched.</p>
0860      * <p>As noted earlier, the substrings in the array returned by this invocation do not 
0861      * contain the delimiting text <tt>separator</tt> used to split the string. However, 
0862      * if <tt>separator</tt> is a regular expression that contains parenthesized 
0863      * subexpressions, the substrings that match those parenthesized subexpressions 
0864      * (but not the text that matches the regular expression as a whole) are included in 
0865      * the returned array.</p>
0866      * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or 
0867      * {@link ArrayLike#join(Object)} method.</p>
0868      * @param separator The string or regular expression at which the current string splits.
0869      * @param limit This optional integer specifies the maximum length of the returned 
0870      * array. If defined, no more than this number of substrings will be returned. 
0871      * If undefined, the entire string will be split, regardless of its length.
0872      * @return An array of strings, created by splitting string into substrings at the 
0873      * boundaries specified by <tt>separator</tt>. The substrings in the returned 
0874      * array do not include <tt>separator</tt> itself, except in the case noted in the 
0875      * above description.
0876      * @see #split(Object)
0877      * @see ArrayLike#join()
0878      * @see ArrayLike#join(Object)
0879      * @see jsx.core.StringLikes#split(StringLike, Object, Object)
0880      * @see jsx.core.StringLikes#split(String, Object, Object)
0881      * @since 1.0
0882      * @javascript Re-compilers must convert the interface invocation of this method directly 
0883      * into a JavaScript invocation on its current string instance without changing the 
0884      * method name, but expanding variable arguments, if any, into comma-separated values. 
0885      */
0886     public final JsArray split(Object separator, Object limit) {
0887         return new JsArray(call(split, new Vars<Object>().add(separator).add(limit)));
0888     }
0889 
0890     /**
0891      * <p>Extracts and returns a substring of the current string without modifying it.</p>
0892      * <p>Note that this method has not been standardized by ECMAScript and is therefore 
0893      * deprecated</p>
0894      * @param start The start position of the substring. If this argument is negative, it 
0895      * specifies a position measured from the end of the string: -1 specifies the last character, 
0896      * -2 specifies the second-to-last character, and so on.
0897      * @return A copy of the portion of the current string starting at and including the character 
0898      * specified by <tt>start</tt> to the end of the string.
0899      * @see #substr(Object)
0900      * @see #slice(Object)
0901      * @see #slice(Object, Object)
0902      * @see #substring(Object)
0903      * @see #substring(Object, Object)
0904      * @see jsx.core.StringLikes#substr(StringLike, Object)
0905      * @see jsx.core.StringLikes#substr(String, Object)
0906      * @since 1.0
0907      * @javascript Re-compilers must convert the interface invocation of this method directly 
0908      * into a JavaScript invocation on its current string instance without changing the 
0909      * method name, but expanding variable arguments, if any, into comma-separated values. 
0910      */
0911     public final String substr(Object start) {
0912         return call(substr, start);
0913     }
0914 
0915     /**
0916      * <p>Extracts and returns a substring of the current string without modifying it.</p>
0917      * <p>Note this method specifies the desired substring with a character position and a 
0918      * <tt>length</tt>. This provides a useful alternative to 
0919      * {@link StringLike#substring(Object, Object)}, which specify a substring with two 
0920      * character positions. Note, however, that this method has not been standardized by 
0921      * ECMAScript and is therefore deprecated</p>
0922      * @param start The start position of the substring. If this argument is negative, it 
0923      * specifies a position measured from the end of the string: -1 specifies the last character, 
0924      * -2 specifies the second-to-last character, and so on.
0925      * @param length The number of characters in the substring. If this argument is undefined, 
0926      * the returned substring includes all characters from the starting position to the end of 
0927      * the string.
0928      * @return A copy of the portion of the current string starting at and including the character 
0929      * specified by <tt>start</tt> and continuing for <tt>length</tt> characters, 
0930      * or to the end of the string if <tt>length</tt> is undefined.
0931      * @see #substr(Object)
0932      * @see #slice(Object)
0933      * @see #slice(Object, Object)
0934      * @see #substring(Object)
0935      * @see #substring(Object, Object)
0936      * @see jsx.core.StringLikes#substr(StringLike, Object, Object)
0937      * @see jsx.core.StringLikes#substr(String, Object, Object)
0938      * @since 1.0
0939      * @javascript Re-compilers must convert the interface invocation of this method directly 
0940      * into a JavaScript invocation on its current string instance without changing the 
0941      * method name, but expanding variable arguments, if any, into comma-separated values. 
0942      */
0943     public final String substr(Object start, Object length) {
0944         return call(substr, new Vars<Object>().add(start).add(length));
0945     }
0946 
0947     /**
0948      * <p>Returns a substring of the current string consisting of the characters from 
0949      * position <tt>from</tt> to the end of the string. The character at position 
0950      * <tt>from</tt> is included.</p>
0951      * <p>It is important to remember that the character at position <tt>from</tt> is 
0952      * included in the substring.</p>
0953      * <p>Note that {@link StringLike#slice(Object)} and the nonstandard 
0954      * {@link StringLike#substr(Object)} can also extract substrings from a string. 
0955      * Unlike those methods, this method does not accept negative arguments.</p>
0956      * @param from A nonnegative integer that specifies the position within the current 
0957      * string of the first character of the desired substring.
0958      * @return  A substring of the current string containing characters copied from 
0959      * position <tt>from</tt> to the end of the current string.
0960      * @see #substring(Object, Object)
0961      * @see #charAt(Object)
0962      * @see #indexOf(Object)
0963      * @see #indexOf(Object, Object)
0964      * @see #lastIndexOf(Object)
0965      * @see #lastIndexOf(Object, Object)
0966      * @see #slice(Object)
0967      * @see #slice(Object, Object)
0968      * @see #substr(Object)
0969      * @see #substr(Object, Object)
0970      * @see jsx.core.StringLikes#substring(StringLike, Object)
0971      * @see jsx.core.StringLikes#substring(String, Object)
0972      * @since 1.0
0973      * @javascript Re-compilers must convert the interface invocation of this method directly 
0974      * into a JavaScript invocation on its current string instance without changing the 
0975      * method name, but expanding variable arguments, if any, into comma-separated values. 
0976      */
0977     public final String substring(Object from) {
0978         return call(substring, from);
0979     }
0980 
0981     /**
0982      * <p>Returns a substring of the current string consisting of the characters between 
0983      * positions <tt>from</tt> and <tt>to</tt>. The character at position <tt>from</tt> 
0984      * is included, but the character at position <tt>to</tt> is not included.</p>
0985      * <p>If <tt>from</tt> equals <tt>to</tt>, this method returns an empty 
0986      * (length 0) string. If <tt>from</tt> is greater than <tt>to</tt>, this method 
0987      * first swaps the two arguments and then returns the substring between them.</p>
0988      * <p>It is important to remember that the character at position <tt>from</tt> is 
0989      * included in the substring but that the character at position <tt>to</tt> is 
0990      * not included in the substring. While this may seem arbitrary or counter-intuitive, 
0991      * a notable feature of this system is that the length of the returned substring is 
0992      * always equal to <tt>to - from</tt>.</p>
0993      * <p>Note that {@link StringLike#slice(Object, Object)} and the nonstandard 
0994      * {@link StringLike#substr(Object, Object)} can also extract substrings from a string. 
0995      * Unlike those methods, this method does not accept negative arguments.</p>
0996      * @param from A nonnegative integer that specifies the position within the current 
0997      * string of the first character of the desired substring.
0998      * @param to A nonnegative optional integer that is one greater than the position of 
0999      * the last character of the desired substring. If this argument is undefined, the 
1000      * returned substring runs to the end of the string.
1001      * @return A new string, of length <tt>to - from</tt>, which contains a substring 
1002      * of the current string. The new string contains characters copied from positions 
1003      * <tt>from</tt> to <tt>to</tt> - 1 of the string.
1004      * @see #substring(Object)
1005      * @see #charAt(Object)
1006      * @see #indexOf(Object)
1007      * @see #indexOf(Object, Object)
1008      * @see #lastIndexOf(Object)
1009      * @see #lastIndexOf(Object, Object)
1010      * @see #slice(Object)
1011      * @see #slice(Object, Object)
1012      * @see #substr(Object)
1013      * @see #substr(Object, Object)
1014      * @see jsx.core.StringLikes#substring(StringLike, Object, Object)
1015      * @see jsx.core.StringLikes#substring(String, Object, Object)
1016      * @since 1.0
1017      * @javascript Re-compilers must convert the interface invocation of this method directly 
1018      * into a JavaScript invocation on its current string instance without changing the 
1019      * method name, but expanding variable arguments, if any, into comma-separated values. 
1020      */
1021     public final String substring(Object from, Object to) {
1022         return call(substring, new Vars<Object>().add(from).add(to));
1023     }
1024 
1025     /**
1026      * <p>Returns a copy of string, with each upper-case letter converted to its lower-case 
1027      * equivalent, if it has one.</p>
1028      * @return A copy of string, with each upper-case letter converted to its lower-case 
1029      * equivalent, if it has one.
1030      * @see #toLocaleLowerCase()
1031      * @see #toLocaleUpperCase()
1032      * @see #toUpperCase()
1033      * @see jsx.core.StringLikes#toLowerCase(StringLike)
1034      * @see jsx.core.StringLikes#toLowerCase(String)
1035      * @since 1.0
1036      * @javascript Re-compilers must convert the interface invocation of this method directly 
1037      * into a JavaScript invocation on its current string instance without changing the 
1038      * method name, but expanding variable arguments, if any, into comma-separated values. 
1039      */
1040     public final String toLowerCase() {
1041         return call(toLowerCase);
1042     }
1043 
1044     /**
1045      * <p>Returns a copy of string, with each lower-case letter converted to its upper-case 
1046      * equivalent, if it has one.</p>
1047      * @return A copy of string, with each lower-case letter converted to its upper-case 
1048      * equivalent, if it has one.
1049      * @see #toLocaleLowerCase()
1050      * @see #toLocaleUpperCase()
1051      * @see #toLowerCase()
1052      * @see jsx.core.StringLikes#toUpperCase(StringLike)
1053      * @see jsx.core.StringLikes#toUpperCase(String)
1054      * @since 1.0
1055      * @javascript Re-compilers must convert the interface invocation of this method directly 
1056      * into a JavaScript invocation on its current string instance without changing the 
1057      * method name, but expanding variable arguments, if any, into comma-separated values. 
1058      */
1059     public final String toUpperCase() {
1060         return call(toUpperCase);
1061     }
1062 
1063     /**
1064      * <p>Returns a copy of the current string, converted to lower-case letters in a 
1065      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1066      * case mappings, so this method usually returns the same value as 
1067      * {@link #toLowerCase()}.</p>
1068      * @return A copy of the current string, converted to lower-case letters in a 
1069      * locale-specific way.
1070      * @see #toLocaleUpperCase()
1071      * @see #toLowerCase()
1072      * @see #toUpperCase()
1073      * @see jsx.core.StringLikes#toLocaleLowerCase(StringLike)
1074      * @see jsx.core.StringLikes#toLocaleLowerCase(String)
1075      * @since 1.0
1076      * @javascript Re-compilers must convert the interface invocation of this method directly 
1077      * into a JavaScript invocation on its current string instance without changing the 
1078      * method name, but expanding variable arguments, if any, into comma-separated values. 
1079      */
1080     public final String toLocaleLowerCase() {
1081         return call(toLocaleLowerCase);
1082     }
1083 
1084     /**
1085      * <p>Returns a copy of the current string, converted to upper-case letters in a 
1086      * locale-specific way. Only a few languages, such as Turkish, have locale-specific 
1087      * case mappings, so this method usually returns the same value as 
1088      * {@link #toUpperCase()}.</p>
1089      * @return A copy of the current string, converted to upper-case letters in a 
1090      * locale-specific way.
1091      * @see #toLocaleLowerCase()
1092      * @see #toLowerCase()
1093      * @see #toUpperCase()
1094      * @see jsx.core.StringLikes#toLocaleUpperCase(StringLike)
1095      * @see jsx.core.StringLikes#toLocaleUpperCase(String)
1096      * @since 1.0
1097      * @javascript Re-compilers must convert the interface invocation of this method directly 
1098      * into a JavaScript invocation on its current string instance without changing the 
1099      * method name, but expanding variable arguments, if any, into comma-separated values. 
1100      */
1101     public final String toLocaleUpperCase() {
1102         return call(toLocaleUpperCase);
1103     }
1104 
1105     /**
1106      * <p>Returns the primitive value associated with the current instance, if there is one. 
1107      * This invocation returns the same thing as {@link #toString()}.</p>
1108      * @return The primitive string value associated with the current instance.
1109      * @see #toString()
1110      * @since 1.0
1111      * @javascript Re-compilers must convert the interface invocation of this method directly 
1112      * into a JavaScript invocation on its current string instance without changing the 
1113      * method name, but expanding variable arguments, if any, into comma-separated values. 
1114      */
1115     @Override
1116     public String valueOf() {
1117         return var().valueOf();
1118     }
1119 
1120     /**
1121      * <p>Checks if the current string instance is the name of a property of the second 
1122      * operand, resembling the <tt>in</tt> operator in JavaScript.</p>
1123      * <p>This operation converts the current string instance to a string and expects 
1124      * the second operand be an object (or array).</p>
1125      * @param other Any object or array.
1126      * @return <tt>true</tt> if the current string instance is the name of a property of 
1127      * the second operand; <tt>false</tt>, otherwise;
1128      * @since 1.0
1129      * @javascript Re-compilers must replace the instance invocation of this method with the 
1130      * JavaScript expression:
1131      * <pre>p in other</pre>
1132      * where <tt>p</tt> is the current string instance of the invocation of this method.
1133      */
1134     public boolean in(Object other) {
1135         return var().in(other);
1136     }
1137 
1138     /**
1139      * <p>Checks if the current string instance is an instance of the second operand, 
1140      * resembling the <tt>instanceof</tt> operator in JavaScript.</p>
1141      * <p>This operation expects the first operand be an object and the second be a class 
1142      * of objects. In JavaScript, classes of objects are defined by the constructor function 
1143      * that initializes them.</p>
1144      * @param other A constructor function.
1145      * @return <tt>true</tt> if the current string instance is an instance of the second 
1146      * operand; <tt>false</tt>, otherwise;
1147      * @since 1.0
1148      * @javascript Re-compilers must replace the instance invocation of this method with the 
1149      * JavaScript expression:
1150      * <pre>p instanceof other</pre>
1151      * where <tt>p</tt> is the current string instance of the invocation of this method.
1152      */
1153     public final boolean instanceOf(Object other) {
1154         return Js.instanceOf(this, other);
1155     }
1156 
1157     /**
1158      * <p>Adds the current string instance to a numeric operand or concatenates it with 
1159      * a string operand, resembling the addition operator in JavaScript.</p>
1160      * <p>If one value is a string, the other is converted to a string, and the two 
1161      * strings are then concatenated. Object operands are converted to numbers or strings 
1162      * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}  
1163      * method and/or the {@link Js#toString(Object)} method on the object.</p>
1164      * @param other A value or object.
1165      * @return The sum or concatenation of the values.
1166      * @since 1.0
1167      * @javascript Re-compilers must replace the instance invocation of this method with the 
1168      * JavaScript expression:
1169      * <pre>p + other</pre>
1170      * where <tt>p</tt> is the current string instance of the invocation of this method.
1171      */
1172     public final String add(Object other) {
1173         return Js.add(this, other);
1174     }
1175 
1176     /**
1177      * <p>Logically evaluates the current string instance.</p>
1178      * @return The logical value of the current string instance.
1179      * @since 1.0
1180      * @javascript Re-compilers must ignore the instance invocation of this method, that is, 
1181      * replacing it with its current primitive instance.
1182      */
1183     public final boolean be() {
1184         return Js.be(var());
1185     }
1186 
1187     /**
1188      * <p>Inverts the boolean value of the current string instance, resembling the 
1189      * logical NOT operator in JavaScript.</p>
1190      * <p>This operation converts the current string instance to a boolean value using 
1191      * the following rules if necessary before inverting the converted value.</p>
1192      * <ul>
1193      * <li>If a number is used where a boolean value is expected, the number is converted 
1194      * to <tt>true</tt> unless the number is 0 or NaN, which are converted to <tt>false</tt>.</li>
1195      * <li>If a string is used where a boolean value is expected, it is converted to <tt>true</tt> 
1196      * except for the empty string, which is converted to <tt>false</tt>.</li>
1197      * <li><tt>null</tt> and the undefined value convert to <tt>false</tt>, and any 
1198      * non-null object, array, or function converts to <tt>true</tt>.
1199      * </ul>
1200      * <p>You can convert any value <tt>x</tt> to its equivalent boolean value by applying 
1201      * this operation twice: <tt>Js.not(Js.not(x))</tt></p>
1202      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1203      * re-compilations. However, in most cases you can use the logical NOT operator of the 
1204      * Java language like this:
1205      * <pre>!Js.be(var)</pre>
1206      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1207      * JavaScript expression since the Java compilers generally used are free to compile 
1208      * the expression into any byte codes they think efficient, making it too hard for the 
1209      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1210      * @return The inverted boolean value.
1211      * @since 1.0
1212      * @javascript Re-compilers must replace the instance invocation of this method with the 
1213      * JavaScript expression:
1214      * <pre>!p</pre>
1215      * where <tt>p</tt> is the current string instance of the invocation of this method.
1216      */
1217     public final boolean not() {
1218         return Js.not(var());
1219     }
1220 
1221     /**
1222      * <p>Checks whether the two operands are "equal" using a more relaxed definition of 
1223      * sameness that allows type conversions, resembling the equality operator in 
1224      * JavaScript.</p>
1225      * <p>The equality and identity operations check whether two values are the same, using 
1226      * two different definitions of sameness. Both operations accept operands of any type, 
1227      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
1228      * if they are different. The identity operation checks whether its two operands are 
1229      * "identical" using a strict definition of sameness. The equality operation checks 
1230      * whether its two operands are "equal" using a more relaxed definition of sameness 
1231      * that allows type conversions.</p>
1232      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
1233      * JavaScript 1.3 and later. Be sure you understand the differences between the 
1234      * assignment, equality, and identity operations, and be careful to use the correct one 
1235      * when coding! Although it is tempting to call all three operations "equals," it may 
1236      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
1237      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
1238      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
1239      * case, two separate values are involved, and the equality and identity operations 
1240      * check that these two values are identical. This means that two variables are equal 
1241      * or identical only if they contain the same value. For example, two strings are equal 
1242      * only if they each contain exactly the same characters.</p>
1243      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
1244      * means that two variables are equal only if they refer to the same object. Two 
1245      * separate arrays are never equal or identical, even if they contain equal or identical 
1246      * elements. Two variables that contain references to objects, arrays, or functions are 
1247      * equal only if they refer to the same object, array, or function. If you want to test 
1248      * that two distinct objects contain the same properties or that two distinct arrays 
1249      * contain the same elements, you'll have to check the properties or elements individually 
1250      * for equality or identity. And, if any of the properties or elements are themselves 
1251      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
1252      * <p>The following rules determine whether two values are equal according to the 
1253      * equality operation:
1254      * <ul>
1255      * <li>If the two values have the same type, test them for identity. If the values are 
1256      * identical, they are equal; if they are not identical, they are not equal.</li>
1257      * <li>If the two values do not have the same type, they may still be equal. Use the 
1258      * following rules and type conversions to check for equality:</li>
1259      * <ul>
1260      * <li>If one value is null and the other is undefined, they are equal.</li>
1261      * <li>If one value is a number and the other is a string, convert the string to a 
1262      * number and try the comparison again, using the converted value.</li>
1263      * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison 
1264      * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison 
1265      * again.</li>
1266      * <li>If one value is an object and the other is a number or string, convert the 
1267      * object to a primitive and try the comparison again. An object is converted to a 
1268      * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt> 
1269      * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt> 
1270      * conversion before <tt>toString()</tt> conversion, except for the Date class, 
1271      * which performs <tt>toString()</tt> conversion. Objects that are not part of core 
1272      * JavaScript may convert themselves to primitive values in an implementation-defined 
1273      * way.</li>
1274      * <li>Any other combinations of values are not equal.</li>
1275      * </ul>
1276      * </ul>
1277      * @param other Any value or object.
1278      * @return <tt>true</tt> if the first operand equals the second; <tt>false</tt>, 
1279      * otherwise;
1280      * @since 1.0
1281      * @javascript Re-compilers must replace the instance invocation of this method with the 
1282      * JavaScript expression:
1283      * <pre>p == other</pre>
1284      * where <tt>p</tt> is the current string instance of the invocation of this method.
1285      */
1286     public final boolean eq(Object other) {
1287         return Js.eq(var(), other);
1288     }
1289 
1290     /**
1291      * <p>Checks whether the two operands are "identical" using a strict definition of 
1292      * sameness, resembling the identity operator in JavaScript.</p>
1293      * <p>The equality and identity operations check whether two values are the same, using 
1294      * two different definitions of sameness. Both operations accept operands of any type, 
1295      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
1296      * if they are different. The identity operation checks whether its two operands are 
1297      * "identical" using a strict definition of sameness. The equality operation checks 
1298      * whether its two operands are "equal" using a more relaxed definition of sameness 
1299      * that allows type conversions.</p>
1300      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
1301      * JavaScript 1.3 and later. Be sure you understand the differences between the 
1302      * assignment, equality, and identity operations, and be careful to use the correct one 
1303      * when coding! Although it is tempting to call all three operations "equals," it may 
1304      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
1305      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
1306      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
1307      * case, two separate values are involved, and the equality and identity operations 
1308      * check that these two values are identical. This means that two variables are equal 
1309      * or identical only if they contain the same value. For example, two strings are equal 
1310      * only if they each contain exactly the same characters.</p>
1311      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
1312      * means that two variables are equal only if they refer to the same object. Two 
1313      * separate arrays are never equal or identical, even if they contain equal or identical 
1314      * elements. Two variables that contain references to objects, arrays, or functions are 
1315      * equal only if they refer to the same object, array, or function. If you want to test 
1316      * that two distinct objects contain the same properties or that two distinct arrays 
1317      * contain the same elements, you'll have to check the properties or elements individually 
1318      * for equality or identity. And, if any of the properties or elements are themselves 
1319      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
1320      * <p>The following rules determine whether two values are identical according to the identity operation:
1321      * <ul>
1322      * <li>If the two values have different types, they are not identical.</li>
1323      * <li>If both values are numbers and have the same value, they are identical, unless 
1324      * either or both values are <tt>NaN</tt>, in which case they are not identical. 
1325      * The <tt>NaN</tt> value is never identical to any other value, including itself! 
1326      * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)} 
1327      * function.</li>
1328      * <li>If both values are strings and contain exactly the same characters in the same 
1329      * positions, they are identical. If the strings differ in length or content, they are 
1330      * not identical. Note that in some cases, the Unicode standard allows more than one 
1331      * way to encode the same string. For efficiency, however, JavaScript's string 
1332      * comparison compares strictly on a character-by-character basis, and it assumes that 
1333      * all strings have been converted to a "normalized form" before they are compared. 
1334      * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
1335      * <li>If both values are the boolean value <tt>true</tt> or both are the boolean 
1336      * value <tt>false</tt>, they are identical.</li>
1337      * <li>If both values refer to the same object, array, or function, they are identical. 
1338      * If they refer to different objects (or arrays or functions) they are not identical, 
1339      * even if both objects have identical properties or both arrays have identical elements.</li>
1340      * <li>If both values are null or both values are undefined, they are identical.</li>
1341      * </ul>
1342      * @param other Any value or object.
1343      * @return <tt>true</tt> if the first operand is identical to the second; 
1344      * <tt>false</tt>, otherwise;
1345      * @since 1.0
1346      * @javascript Re-compilers must replace the instance invocation of this method with the 
1347      * JavaScript expression:
1348      * <pre>p === other</pre>
1349      * where <tt>p</tt> is the current string instance of the invocation of this method.
1350      */
1351     public final boolean eqs(Object other) {
1352         return Js.eqs(this, other);
1353     }
1354 
1355     /**
1356      * <p>Checks whether the two operands are not "equal" using a more relaxed definition of 
1357      * sameness that allows type conversions, resembling the equality operator in 
1358      * JavaScript.</p>
1359      * <p>The equality and identity operations check whether two values are the same, using 
1360      * two different definitions of sameness. Both operations accept operands of any type, 
1361      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
1362      * if they are different. The identity operation checks whether its two operands are 
1363      * "identical" using a strict definition of sameness. The equality operation checks 
1364      * whether its two operands are "equal" using a more relaxed definition of sameness 
1365      * that allows type conversions.</p>
1366      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
1367      * JavaScript 1.3 and later. Be sure you understand the differences between the 
1368      * assignment, equality, and identity operations, and be careful to use the correct one 
1369      * when coding! Although it is tempting to call all three operations "equals," it may 
1370      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
1371      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
1372      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
1373      * case, two separate values are involved, and the equality and identity operations 
1374      * check that these two values are identical. This means that two variables are equal 
1375      * or identical only if they contain the same value. For example, two strings are equal 
1376      * only if they each contain exactly the same characters.</p>
1377      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
1378      * means that two variables are equal only if they refer to the same object. Two 
1379      * separate arrays are never equal or identical, even if they contain equal or identical 
1380      * elements. Two variables that contain references to objects, arrays, or functions are 
1381      * equal only if they refer to the same object, array, or function. If you want to test 
1382      * that two distinct objects contain the same properties or that two distinct arrays 
1383      * contain the same elements, you'll have to check the properties or elements individually 
1384      * for equality or identity. And, if any of the properties or elements are themselves 
1385      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
1386      * <p>The following rules determine whether two values are equal according to the 
1387      * equality operation:
1388      * <ul>
1389      * <li>If the two values have the same type, test them for identity. If the values are 
1390      * identical, they are equal; if they are not identical, they are not equal.</li>
1391      * <li>If the two values do not have the same type, they may still be equal. Use the 
1392      * following rules and type conversions to check for equality:</li>
1393      * <ul>
1394      * <li>If one value is null and the other is undefined, they are equal.</li>
1395      * <li>If one value is a number and the other is a string, convert the string to a 
1396      * number and try the comparison again, using the converted value.</li>
1397      * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison 
1398      * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison 
1399      * again.</li>
1400      * <li>If one value is an object and the other is a number or string, convert the 
1401      * object to a primitive and try the comparison again. An object is converted to a 
1402      * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt> 
1403      * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt> 
1404      * conversion before <tt>toString()</tt> conversion, except for the Date class, 
1405      * which performs <tt>toString()</tt> conversion. Objects that are not part of core 
1406      * JavaScript may convert themselves to primitive values in an implementation-defined 
1407      * way.</li>
1408      * <li>Any other combinations of values are not equal.</li>
1409      * </ul>
1410      * </ul>
1411      * @param other Any value or object.
1412      * @return <tt>false</tt> if the first operand equals the second; <tt>true</tt>, 
1413      * otherwise;
1414      * @since 1.0
1415      * @javascript Re-compilers must replace the instance invocation of this method with the 
1416      * JavaScript expression:
1417      * <pre>p != other</pre>
1418      * where <tt>p</tt> is the current string instance of the invocation of this method.
1419      */
1420     public final boolean neq(Object other) {
1421         return Js.neq(var(), other);
1422     }
1423 
1424     /**
1425      * <p>Checks whether the two operands are not "identical" using a strict definition of 
1426      * sameness, resembling the identity operator in JavaScript.</p>
1427      * <p>The equality and identity operations check whether two values are the same, using 
1428      * two different definitions of sameness. Both operations accept operands of any type, 
1429      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
1430      * if they are different. The identity operation checks whether its two operands are 
1431      * "identical" using a strict definition of sameness. The equality operation checks 
1432      * whether its two operands are "equal" using a more relaxed definition of sameness 
1433      * that allows type conversions.</p>
1434      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
1435      * JavaScript 1.3 and later. Be sure you understand the differences between the 
1436      * assignment, equality, and identity operations, and be careful to use the correct one 
1437      * when coding! Although it is tempting to call all three operations "equals," it may 
1438      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
1439      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
1440      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
1441      * case, two separate values are involved, and the equality and identity operations 
1442      * check that these two values are identical. This means that two variables are equal 
1443      * or identical only if they contain the same value. For example, two strings are equal 
1444      * only if they each contain exactly the same characters.</p>
1445      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
1446      * means that two variables are equal only if they refer to the same object. Two 
1447      * separate arrays are never equal or identical, even if they contain equal or identical 
1448      * elements. Two variables that contain references to objects, arrays, or functions are 
1449      * equal only if they refer to the same object, array, or function. If you want to test 
1450      * that two distinct objects contain the same properties or that two distinct arrays 
1451      * contain the same elements, you'll have to check the properties or elements individually 
1452      * for equality or identity. And, if any of the properties or elements are themselves 
1453      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
1454      * <p>The following rules determine whether two values are identical according to the identity operation:
1455      * <ul>
1456      * <li>If the two values have different types, they are not identical.</li>
1457      * <li>If both values are numbers and have the same value, they are identical, unless 
1458      * either or both values are <tt>NaN</tt>, in which case they are not identical. 
1459      * The <tt>NaN</tt> value is never identical to any other value, including itself! 
1460      * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)} 
1461      * function.</li>
1462      * <li>If both values are strings and contain exactly the same characters in the same 
1463      * positions, they are identical. If the strings differ in length or content, they are 
1464      * not identical. Note that in some cases, the Unicode standard allows more than one 
1465      * way to encode the same string. For efficiency, however, JavaScript's string 
1466      * comparison compares strictly on a character-by-character basis, and it assumes that 
1467      * all strings have been converted to a "normalized form" before they are compared. 
1468      * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
1469      * <li>If both values are the boolean value <tt>true</tt> or both are the boolean 
1470      * value <tt>false</tt>, they are identical.</li>
1471      * <li>If both values refer to the same object, array, or function, they are identical. 
1472      * If they refer to different objects (or arrays or functions) they are not identical, 
1473      * even if both objects have identical properties or both arrays have identical elements.</li>
1474      * <li>If both values are null or both values are undefined, they are identical.</li>
1475      * </ul>
1476      * @param other Any value or object.
1477      * @return <tt>false</tt> if the first operand is identical to the second; 
1478      * <tt>true</tt>, otherwise;
1479      * @since 1.0
1480      * @javascript Re-compilers must replace the instance invocation of this method with the 
1481      * JavaScript expression:
1482      * <pre>p !== other</pre>
1483      * where <tt>p</tt> is the current string instance of the invocation of this method.
1484      */
1485     public final boolean neqs(Object other) {
1486         return Js.neqs(this, other);
1487     }
1488 
1489     /**
1490      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
1491      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
1492      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
1493      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
1494      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
1495      * may or may not evaluate the right-side expression. The actual behavior of the operator 
1496      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
1497      * on its left. If the value of this expression can be converted to <tt>false</tt> 
1498      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
1499      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
1500      * its second operand, the expression on its right, and returns the value of that 
1501      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
1502      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
1503      * returning the unconverted value of the left-side expression.</p>
1504      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1505      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1506      * anonymously, returning the actual expression in the method overriding 
1507      * {@link Var#var()}.</p>
1508      * <p>Sometimes, this operation probably does not do what the programmers intended. 
1509      * To avoid problems, do not use expressions with side effects (assignments, increments, 
1510      * decrements, and function calls) for the second operand unless you are quite sure 
1511      * you know exactly what you are doing.</p>
1512      * <p>Despite the fairly confusing way that this operation actually works, it is 
1513      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
1514      * Although it does not actually return a boolean value, the value it returns can always 
1515      * be converted to a boolean value.</p>
1516      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1517      * re-compilations. However, in most cases you can use the logical AND operator of the 
1518      * Java language like this:
1519      * <pre>Js.be(var) && Js.be(other)</pre>
1520      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1521      * JavaScript expression since the Java compilers generally used are free to compile 
1522      * the expression into any byte codes they think efficient, making it too hard for the 
1523      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1524      * @param other A value or object.
1525      * @return The logical AND of the two operands.
1526      * @since 1.0
1527      * @javascript Re-compilers must replace the instance invocation of this method with the 
1528      * JavaScript expression:
1529      * <pre>p && other</pre>
1530      * where <tt>p</tt> is the current string instance of the invocation of this method.
1531      */
1532     public final Object and(Object other) {
1533         return Js.and(this, other);
1534     }
1535 
1536     /**
1537      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
1538      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
1539      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
1540      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
1541      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
1542      * may or may not evaluate the right-side expression. The actual behavior of the operator 
1543      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
1544      * on its left. If the value of this expression can be converted to <tt>false</tt> 
1545      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
1546      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
1547      * its second operand, the expression on its right, and returns the value of that 
1548      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
1549      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
1550      * returning the unconverted value of the left-side expression.</p>
1551      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1552      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1553      * anonymously, returning the actual expression in the method overriding 
1554      * {@link Var#var()}.</p>
1555      * <p>Sometimes, this operation probably does not do what the programmers intended. 
1556      * To avoid problems, do not use expressions with side effects (assignments, increments, 
1557      * decrements, and function calls) for the second operand unless you are quite sure 
1558      * you know exactly what you are doing.</p>
1559      * <p>Despite the fairly confusing way that this operation actually works, it is 
1560      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
1561      * Although it does not actually return a boolean value, the value it returns can always 
1562      * be converted to a boolean value.</p>
1563      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1564      * re-compilations. However, in most cases you can use the logical AND operator of the 
1565      * Java language like this:
1566      * <pre>Js.be(var) && Js.be(other)</pre>
1567      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1568      * JavaScript expression since the Java compilers generally used are free to compile 
1569      * the expression into any byte codes they think efficient, making it too hard for the 
1570      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1571      * @param other A value or object.
1572      * @return The logical AND of the two operands.
1573      * @since 1.0
1574      * @javascript Re-compilers must replace the instance invocation of this method with the 
1575      * JavaScript expression:
1576      * <pre>p && other</pre>
1577      * where <tt>p</tt> is the current string instance of the invocation of this method.
1578      */
1579     public final String and(String other) {
1580         return Js.and(this, other);
1581     }
1582 
1583     /**
1584      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
1585      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
1586      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
1587      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
1588      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
1589      * may or may not evaluate the right-side expression. The actual behavior of the operator 
1590      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
1591      * on its left. If the value of this expression can be converted to <tt>false</tt> 
1592      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
1593      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
1594      * its second operand, the expression on its right, and returns the value of that 
1595      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
1596      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
1597      * returning the unconverted value of the left-side expression.</p>
1598      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1599      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1600      * anonymously, returning the actual expression in the method overriding 
1601      * {@link Var#var()}.</p>
1602      * <p>Sometimes, this operation probably does not do what the programmers intended. 
1603      * To avoid problems, do not use expressions with side effects (assignments, increments, 
1604      * decrements, and function calls) for the second operand unless you are quite sure 
1605      * you know exactly what you are doing.</p>
1606      * <p>Despite the fairly confusing way that this operation actually works, it is 
1607      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
1608      * Although it does not actually return a boolean value, the value it returns can always 
1609      * be converted to a boolean value.</p>
1610      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1611      * re-compilations. However, in most cases you can use the logical AND operator of the 
1612      * Java language like this:
1613      * <pre>Js.be(var) && Js.be(other)</pre>
1614      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1615      * JavaScript expression since the Java compilers generally used are free to compile 
1616      * the expression into any byte codes they think efficient, making it too hard for the 
1617      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1618      * @param other A value or object.
1619      * @return The logical AND of the two operands.
1620      * @since 1.0
1621      * @javascript Re-compilers must replace the instance invocation of this method with the 
1622      * JavaScript expression:
1623      * <pre>p && other</pre>
1624      * where <tt>p</tt> is the current string instance of the invocation of this method.
1625      */
1626     public final String and(Value<String> other) {
1627         return Js.and(this, other);
1628     }
1629 
1630     /**
1631      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
1632      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
1633      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
1634      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
1635      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
1636      * may or may not evaluate the right-side expression. The actual behavior of the operator 
1637      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
1638      * on its left. If the value of this expression can be converted to <tt>false</tt> 
1639      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
1640      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
1641      * its second operand, the expression on its right, and returns the value of that 
1642      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
1643      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
1644      * returning the unconverted value of the left-side expression.</p>
1645      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1646      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1647      * anonymously, returning the actual expression in the method overriding 
1648      * {@link Var#var()}.</p>
1649      * <p>Sometimes, this operation probably does not do what the programmers intended. 
1650      * To avoid problems, do not use expressions with side effects (assignments, increments, 
1651      * decrements, and function calls) for the second operand unless you are quite sure 
1652      * you know exactly what you are doing.</p>
1653      * <p>Despite the fairly confusing way that this operation actually works, it is 
1654      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
1655      * Although it does not actually return a boolean value, the value it returns can always 
1656      * be converted to a boolean value.</p>
1657      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1658      * re-compilations. However, in most cases you can use the logical AND operator of the 
1659      * Java language like this:
1660      * <pre>Js.be(var) && Js.be(other)</pre>
1661      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1662      * JavaScript expression since the Java compilers generally used are free to compile 
1663      * the expression into any byte codes they think efficient, making it too hard for the 
1664      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1665      * @param other A value or object.
1666      * @return The logical AND of the two operands.
1667      * @since 1.0
1668      * @javascript Re-compilers must replace the instance invocation of this method with the 
1669      * JavaScript expression:
1670      * <pre>p && other</pre>
1671      * where <tt>p</tt> is the current string instance of the invocation of this method.
1672      */
1673     public final JsObject and(Var<? extends JsObject> other) {
1674         return Js.and(this, other);
1675     }
1676 
1677     /**
1678      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
1679      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
1680      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
1681      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
1682      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
1683      * may or may not evaluate the right-side expression. The actual behavior of the operator 
1684      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
1685      * on its left. If the value of this expression can be converted to <tt>false</tt> 
1686      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
1687      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
1688      * its second operand, the expression on its right, and returns the value of that 
1689      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
1690      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
1691      * returning the unconverted value of the left-side expression.</p>
1692      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1693      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1694      * anonymously, returning the actual expression in the method overriding 
1695      * {@link Var#var()}.</p>
1696      * <p>Sometimes, this operation probably does not do what the programmers intended. 
1697      * To avoid problems, do not use expressions with side effects (assignments, increments, 
1698      * decrements, and function calls) for the second operand unless you are quite sure 
1699      * you know exactly what you are doing.</p>
1700      * <p>Despite the fairly confusing way that this operation actually works, it is 
1701      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
1702      * Although it does not actually return a boolean value, the value it returns can always 
1703      * be converted to a boolean value.</p>
1704      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1705      * re-compilations. However, in most cases you can use the logical AND operator of the 
1706      * Java language like this:
1707      * <pre>Js.be(var) && Js.be(other)</pre>
1708      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1709      * JavaScript expression since the Java compilers generally used are free to compile 
1710      * the expression into any byte codes they think efficient, making it too hard for the 
1711      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1712      * @param other A value or object.
1713      * @return The logical AND of the two operands.
1714      * @since 1.0
1715      * @javascript Re-compilers must replace the instance invocation of this method with the 
1716      * JavaScript expression:
1717      * <pre>p && other</pre>
1718      * where <tt>p</tt> is the current string instance of the invocation of this method.
1719      */
1720     public final JsString and(JsString other) {
1721         return Js.and(this, other);
1722     }
1723 
1724     /**
1725      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
1726      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
1727      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
1728      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
1729      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
1730      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
1731      * its first operand, the expression on its left. If the value of this expression can 
1732      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
1733      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
1734      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
1735      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
1736      * and doesn't return the unconverted value of the left-side expression.</p>
1737      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1738      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1739      * anonymously, returning the actual expression in the method overriding 
1740      * {@link Var#var()}.</p>
1741      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
1742      * operands that include side effects, unless you purposely want to use the fact that 
1743      * the right-side expression may not be evaluated in JavaScript.</p>
1744      * <p>Even when this operation is used with operands that are not boolean values, it 
1745      * can still be considered a Boolean OR operator because its return value, whatever the 
1746      * type, can be converted to a boolean value.</p>
1747      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1748      * re-compilations. However, in most cases you can use the logical OR operator of the 
1749      * Java language like this:
1750      * <pre>Js.be(var) || Js.be(other)</pre>
1751      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1752      * JavaScript expression since the Java compilers generally used are free to compile 
1753      * the expression into any byte codes they think efficient, making it too hard for the 
1754      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1755      * @param other A value or object.
1756      * @return The logical OR of the two operands.
1757      * @since 1.0
1758      * @javascript Re-compilers must replace the instance invocation of this method with the 
1759      * JavaScript expression:
1760      * <pre>p || other</pre>
1761      * where <tt>p</tt> is the current string instance of the invocation of this method.
1762      */
1763     public final Object or(Object other) {
1764         return Js.or(this, other);
1765     }
1766 
1767     /**
1768      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
1769      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
1770      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
1771      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
1772      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
1773      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
1774      * its first operand, the expression on its left. If the value of this expression can 
1775      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
1776      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
1777      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
1778      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
1779      * and doesn't return the unconverted value of the left-side expression.</p>
1780      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1781      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1782      * anonymously, returning the actual expression in the method overriding 
1783      * {@link Var#var()}.</p>
1784      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
1785      * operands that include side effects, unless you purposely want to use the fact that 
1786      * the right-side expression may not be evaluated in JavaScript.</p>
1787      * <p>Even when this operation is used with operands that are not boolean values, it 
1788      * can still be considered a Boolean OR operator because its return value, whatever the 
1789      * type, can be converted to a boolean value.</p>
1790      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1791      * re-compilations. However, in most cases you can use the logical OR operator of the 
1792      * Java language like this:
1793      * <pre>Js.be(var) || Js.be(other)</pre>
1794      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1795      * JavaScript expression since the Java compilers generally used are free to compile 
1796      * the expression into any byte codes they think efficient, making it too hard for the 
1797      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1798      * @param other A value or object.
1799      * @return The logical OR of the two operands.
1800      * @since 1.0
1801      * @javascript Re-compilers must replace the instance invocation of this method with the 
1802      * JavaScript expression:
1803      * <pre>p || other</pre>
1804      * where <tt>p</tt> is the current string instance of the invocation of this method.
1805      */
1806     public final JsString or(String other) {
1807         return Js.or(this, other);
1808     }
1809 
1810     /**
1811      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
1812      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
1813      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
1814      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
1815      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
1816      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
1817      * its first operand, the expression on its left. If the value of this expression can 
1818      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
1819      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
1820      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
1821      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
1822      * and doesn't return the unconverted value of the left-side expression.</p>
1823      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1824      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1825      * anonymously, returning the actual expression in the method overriding 
1826      * {@link Var#var()}.</p>
1827      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
1828      * operands that include side effects, unless you purposely want to use the fact that 
1829      * the right-side expression may not be evaluated in JavaScript.</p>
1830      * <p>Even when this operation is used with operands that are not boolean values, it 
1831      * can still be considered a Boolean OR operator because its return value, whatever the 
1832      * type, can be converted to a boolean value.</p>
1833      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1834      * re-compilations. However, in most cases you can use the logical OR operator of the 
1835      * Java language like this:
1836      * <pre>Js.be(var) || Js.be(other)</pre>
1837      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1838      * JavaScript expression since the Java compilers generally used are free to compile 
1839      * the expression into any byte codes they think efficient, making it too hard for the 
1840      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1841      * @param other A value or object.
1842      * @return The logical OR of the two operands.
1843      * @since 1.0
1844      * @javascript Re-compilers must replace the instance invocation of this method with the 
1845      * JavaScript expression:
1846      * <pre>p || other</pre>
1847      * where <tt>p</tt> is the current string instance of the invocation of this method.
1848      */
1849     public final JsString or(Value<String> other) {
1850         return Js.or(this, other);
1851     }
1852 
1853     /**
1854      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
1855      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
1856      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
1857      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
1858      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
1859      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
1860      * its first operand, the expression on its left. If the value of this expression can 
1861      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
1862      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
1863      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
1864      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
1865      * and doesn't return the unconverted value of the left-side expression.</p>
1866      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1867      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1868      * anonymously, returning the actual expression in the method overriding 
1869      * {@link Var#var()}.</p>
1870      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
1871      * operands that include side effects, unless you purposely want to use the fact that 
1872      * the right-side expression may not be evaluated in JavaScript.</p>
1873      * <p>Even when this operation is used with operands that are not boolean values, it 
1874      * can still be considered a Boolean OR operator because its return value, whatever the 
1875      * type, can be converted to a boolean value.</p>
1876      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1877      * re-compilations. However, in most cases you can use the logical OR operator of the 
1878      * Java language like this:
1879      * <pre>Js.be(var) || Js.be(other)</pre>
1880      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1881      * JavaScript expression since the Java compilers generally used are free to compile 
1882      * the expression into any byte codes they think efficient, making it too hard for the 
1883      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1884      * @param other A value or object.
1885      * @return The logical OR of the two operands.
1886      * @since 1.0
1887      * @javascript Re-compilers must replace the instance invocation of this method with the 
1888      * JavaScript expression:
1889      * <pre>p || other</pre>
1890      * where <tt>p</tt> is the current string instance of the invocation of this method.
1891      */
1892     public final JsObject or(Var<? extends JsObject> other) {
1893         return Js.or(this, other);
1894     }
1895 
1896     /**
1897      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
1898      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
1899      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
1900      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
1901      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
1902      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
1903      * its first operand, the expression on its left. If the value of this expression can 
1904      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
1905      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
1906      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
1907      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
1908      * and doesn't return the unconverted value of the left-side expression.</p>
1909      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
1910      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
1911      * anonymously, returning the actual expression in the method overriding 
1912      * {@link Var#var()}.</p>
1913      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
1914      * operands that include side effects, unless you purposely want to use the fact that 
1915      * the right-side expression may not be evaluated in JavaScript.</p>
1916      * <p>Even when this operation is used with operands that are not boolean values, it 
1917      * can still be considered a Boolean OR operator because its return value, whatever the 
1918      * type, can be converted to a boolean value.</p>
1919      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1920      * re-compilations. However, in most cases you can use the logical OR operator of the 
1921      * Java language like this:
1922      * <pre>Js.be(var) || Js.be(other)</pre>
1923      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1924      * JavaScript expression since the Java compilers generally used are free to compile 
1925      * the expression into any byte codes they think efficient, making it too hard for the 
1926      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1927      * @param other A value or object.
1928      * @return The logical OR of the two operands.
1929      * @since 1.0
1930      * @javascript Re-compilers must replace the instance invocation of this method with the 
1931      * JavaScript expression:
1932      * <pre>p || other</pre>
1933      * where <tt>p</tt> is the current string instance of the invocation of this method.
1934      */
1935     public final JsString or(JsString other) {
1936         return Js.or(this, other);
1937     }
1938 
1939     /**
1940      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
1941      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
1942      * operand, otherwise.</p>
1943      * <p>The first operand of the conditional operation must be (or be convertible to) a 
1944      * boolean value. Usually this is the result of a comparison operation. The second and 
1945      * third operands may have any value. The value returned by the conditional operation 
1946      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
1947      * the value of the conditional expression is the value of the second operand. If the 
1948      * first operand is <tt>false</tt>, the value of the conditional expression is the 
1949      * value of the third operand.</p>
1950      * <p>To make the second and third operands really late-evaluated or not evaluated in 
1951      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
1952      * {@link Var} anonymously, returning the actual expression in the method overriding 
1953      * {@link Var#var()}.</p>
1954      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1955      * re-compilations. However, in most cases you can use the conditional operator of the 
1956      * Java language like this:
1957      * <pre>Js.be(test) ? var : other</pre>
1958      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1959      * JavaScript expression since the Java compilers generally used are free to compile 
1960      * the expression into any byte codes they think efficient, making it too hard for the 
1961      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1962      * @param other A value or object.
1963      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
1964      * the third operand.
1965      * @since 1.0
1966      * @javascript Re-compilers must replace the instance invocation of this method with the 
1967      * JavaScript expression:
1968      * <pre>test ? p : other</pre>
1969      * where <tt>p</tt> is the current string instance of the invocation of this method.
1970      */
1971     public final Object cond(Object test, Object other) {
1972         return Js.cond(test, this, other);
1973     }
1974 
1975     /**
1976      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
1977      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
1978      * operand, otherwise.</p>
1979      * <p>The first operand of the conditional operation must be (or be convertible to) a 
1980      * boolean value. Usually this is the result of a comparison operation. The second and 
1981      * third operands may have any value. The value returned by the conditional operation 
1982      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
1983      * the value of the conditional expression is the value of the second operand. If the 
1984      * first operand is <tt>false</tt>, the value of the conditional expression is the 
1985      * value of the third operand.</p>
1986      * <p>To make the second and third operands really late-evaluated or not evaluated in 
1987      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
1988      * {@link Var} anonymously, returning the actual expression in the method overriding 
1989      * {@link Var#var()}.</p>
1990      * <p>Note that, this method is probably useful in emulation codes just for perfect 
1991      * re-compilations. However, in most cases you can use the conditional operator of the 
1992      * Java language like this:
1993      * <pre>Js.be(test) ? var : other</pre>
1994      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
1995      * JavaScript expression since the Java compilers generally used are free to compile 
1996      * the expression into any byte codes they think efficient, making it too hard for the 
1997      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
1998      * @param other A value or object.
1999      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
2000      * the third operand.
2001      * @since 1.0
2002      * @javascript Re-compilers must replace the instance invocation of this method with the 
2003      * JavaScript expression:
2004      * <pre>test ? p : other</pre>
2005      * where <tt>p</tt> is the current string instance of the invocation of this method.
2006      */
2007     public final JsObject cond(Object test, Var<? extends JsObject> other) {
2008         return Js.cond(test, this, other);
2009     }
2010 
2011     /**
2012      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
2013      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
2014      * operand, otherwise.</p>
2015      * <p>The first operand of the conditional operation must be (or be convertible to) a 
2016      * boolean value. Usually this is the result of a comparison operation. The second and 
2017      * third operands may have any value. The value returned by the conditional operation 
2018      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
2019      * the value of the conditional expression is the value of the second operand. If the 
2020      * first operand is <tt>false</tt>, the value of the conditional expression is the 
2021      * value of the third operand.</p>
2022      * <p>To make the second and third operands really late-evaluated or not evaluated in 
2023      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
2024      * {@link Var} anonymously, returning the actual expression in the method overriding 
2025      * {@link Var#var()}.</p>
2026      * <p>Note that, this method is probably useful in emulation codes just for perfect 
2027      * re-compilations. However, in most cases you can use the conditional operator of the 
2028      * Java language like this:
2029      * <pre>Js.be(test) ? var : other</pre>
2030      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
2031      * JavaScript expression since the Java compilers generally used are free to compile 
2032      * the expression into any byte codes they think efficient, making it too hard for the 
2033      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
2034      * @param other A value or object.
2035      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
2036      * the third operand.
2037      * @since 1.0
2038      * @javascript Re-compilers must replace the instance invocation of this method with the 
2039      * JavaScript expression:
2040      * <pre>test ? p : other</pre>
2041      * where <tt>p</tt> is the current string instance of the invocation of this method.
2042      */
2043     public final JsString cond(Object test, JsString other) {
2044         return Js.cond(test, this, other);
2045     }
2046 
2047     /**
2048      * <p>Evaluates the current primitive string instance as JavaScript code and 
2049      * returns the result.</p>
2050      * <p>In JavaScript, <tt>eval()</tt> is a global method that evaluates a string of 
2051      * JavaScript code in the current lexical scope. If the code contains an expression, 
2052      * eval evaluates the expression and returns its value. If the code contains a 
2053      * JavaScript statement or statements, it executes those statements and returns the 
2054      * value, if any, returned by the last statement. If the code does not return any 
2055      * value, <tt>eval()</tt> returns undefined. Finally, if code throws an exception, 
2056      * <tt>eval()</tt> passes that exception on to the caller.</p>
2057      * <p>The global function <tt>eval()</tt> provides a very powerful capability to 
2058      * the JavaScript language, but its use is infrequent in real-world programs. 
2059      * Obvious uses are to write programs that act as recursive JavaScript interpreters 
2060      * and to write programs that dynamically generate and evaluate JavaScript code.</p>
2061      * <p>Most JavaScript functions and methods that expect string arguments accept 
2062      * arguments of other types as well and simply convert those argument values to 
2063      * strings before proceeding. <tt>eval()</tt> does not behave like this. If the 
2064      * code argument is not a primitive string, it is simply returned unchanged. Be 
2065      * careful, therefore, that you do not inadvertently pass a String object to 
2066      * <tt>eval()</tt> when you intended to pass a primitive string value.</p>
2067      * <p>For purposes of implementation efficiency, the ECMAScript v3 standard places 
2068      * an unusual restriction on the use of <tt>eval()</tt>. An ECMAScript implementation 
2069      * is allowed to throw an <tt>EvalError</tt> exception if you attempt to overwrite 
2070      * the <tt>eval</tt> property or if you assign the <tt>eval()</tt> method to another 
2071      * property and attempt to invoke it through that property.</p>
2072      * @return The return value of the evaluated code, if any.
2073      * @throws RuntimeException JavaScript throws a <tt>SyntaxError</tt> if the current 
2074      * primitive instance does not contain legal JavaScript, a <tt>EvalError</tt> if 
2075      * the <tt>eval</tt> function was called illegally, through an identifier other 
2076      * than "eval", or other JavaScript error generated by the code passed. See 
2077      * {@link Js#err(Object)}, {@link js.core.JsSyntaxError}, {@link js.core.JsEvalError}, 
2078      * and {@link js.core.JsError} for JS Simulation.
2079      * @since 1.0
2080      * @javascript Re-compilers must replace the instance invocation of this method with the 
2081      * JavaScript expression:
2082      * <pre>eval(p)</pre>
2083      * where <tt>p</tt> is the current string instance of the invocation of this method.
2084      */
2085     public final Object eval() {
2086         return Js.core().eval(this);
2087     }
2088 }