001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.core;
021 
022 import js.*;
023 
024 /**
025  * <p>An <b>opaque</b> class representing JavaScript class.</p>
026  *
027  * @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>
028  * 
029  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be 
030  * generated into the target codes. Re-compilers must exit with error on the operations of 
031  * accessing that kind of class objects.
032  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored 
033  * and <tt>instanceof</tt> to it always <tt>true</tt>.
034  */
035 public class JsClass extends JsObject
036 {
037     /**
038      * <p>An <b>internal</b> class containing membership data for its enclosing 
039      * opaque class.</p>
040      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or 
041      * class members.</p>
042      *
043      * @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>
044      * 
045      * @javascript Re-compilers must report error on resolving an <b>internal</b> class. 
046      */
047     protected static abstract class Members extends JsObject.Members
048     {
049         /**
050          * <p>An <b>internal</b> static field defining a member ID of the field name and 
051          * used internally to define a member of the same name.</p>
052          * @since 1.0
053          * @see JsClass#prototype
054          * @see Member#prototype
055          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
056          */
057         public final static Mid prototype = id("prototype");
058     }
059 
060     /**
061      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
062      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
063      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
064      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
065      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
066      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
067      * either circumstance, the field names must be exactly same as the member names, as 
068      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
069      * based on the field names.</p>
070      *
071      * @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>
072      * 
073      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created 
074      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
075      * of class objects.
076      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in 
077      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
078      * <pre>q.m</pre>
079      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier 
080      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
081      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
082      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
083      * <pre>m</pre>
084      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report 
085      * error on the access to <b>opaque</b> fields declared by this class under any other 
086      * circumstances.
087      */
088     public static class Member extends JsObject.Member
089     {
090         /**
091          * <p>Internally constructs a member based on a qualifying member.</p>
092          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
093          * or <b>internal</b> classes or class members.</p>
094          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
095          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
096          * declared in the declaring class of this constructor itself or its subclasses. 
097          * Under this circumstance, the field names must be exactly same as the member 
098          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
099          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly 
100          * to their names appending to the name resolved from the specified qualifying 
101          * member with a dot in between.</p>
102          * @param q A qualifying member
103          * @param mid The ID of the member to construct
104          * @since 1.0
105          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
106          */
107         public Member(JsObject.Member q, Mid mid) {
108             super(q, mid);
109         }
110         /**
111          * <p>Internally constructs a member without a qualifying member.</p>
112          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
113          * or <b>internal</b> classes or class members.</p>
114          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
115          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
116          * declared in <b>opaque</b> types other than the declaring class of this constructor 
117          * itself and its subclasses. Under this circumstance, the field names must be 
118          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b> 
119          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
120          * @param mid The ID of the member to construct
121          * @since 1.0
122          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
123          */
124         public Member(Mid mid) {
125             super(mid);
126         }
127 
128         /**
129          * <p>Evaluates the property, represented by the current member instance, of the 
130          * argument object.</p>
131          * @param o The argument object
132          * @return The value of the current member based on the object argument.
133          * @since 1.0
134          * @javascript Re-compilers must convert the instance invocation of this method into 
135          * the JavaScript expression: 
136          * <pre>o.m</pre>
137          * where <tt>m</tt> is the identifier name resolved from the current member 
138          * instance of the invocation.
139          */
140         @Override
141         public JsClass with(ObjectLike o) {
142             return new JsClass((JsObject)var(o).var(mid()));
143         }
144         /**
145          * <p>Evaluates a property, represented by the current member instance, of the 
146          * JavaScript global object, that is, evaluates the member to a global identifier.</p>
147          * @return The value of the current member based on the JavaScript global object.
148          * @since 1.0
149          * @javascript Re-compilers must convert the instance invocation of this method into 
150          * the JavaScript expression: 
151          * <pre>m</pre>
152          * where <tt>m</tt> is the identifier name resolved from the current member 
153          * instance of the invocation.
154          */
155         public JsClass with() {
156             return with(Js.core());
157         }
158 
159         /**
160          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the 
161          * name of this field, qualified by the current member instance of the field, and 
162          * to access the property of the name on an object.</p>
163          * <p>The <tt>prototype</tt> property is used when a function is used as a 
164          * constructor. It refers to an object that serves as the prototype for an entire 
165          * class of objects. Any object created by the constructor inherits all properties 
166          * of the object referred to by the <tt>prototype</tt> property.</p>
167          * @since 1.0
168          * @javascript Re-compilers must resolve the member of this instance field to the 
169          * identifier of the field name appending to the identifier resolved from its 
170          * qualifying member with a dot in between.
171          */
172         public final JsObject.Member prototype = new JsObject.Member(this, Members.prototype);
173     }
174 
175     /**
176      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
177      * without a qualifying member and to access the property of the name on an object.</p>
178      * <p>The <tt>constructor</tt> property of an object is a reference to the function 
179      * that was the constructor for that object.</p>
180      * <p>A common use of the <tt>constructor</tt> property is to determine the type of unknown 
181      * objects. Given an unknown value, you can use the {@link js.Js#typeof(Object)} operation 
182      * to determine whether it is a primitive value or an object. If it is an object, you can 
183      * use the <tt>constructor</tt> property to determine what type of object it is.</p>
184      * <p>Note, however, that while this technique works for the objects built into core 
185      * JavaScript, it is not guaranteed to work with host objects such as the <tt>window</tt> 
186      * object of client-side JavaScript. The default implementation of the <tt>toString()</tt> 
187      * method provides another way to determine the type of an unknown object.</p>
188      * @since 1.0
189      * @javascript Re-compilers must resolve the member of this static field to the 
190      * identifier of the field name.
191      */
192     public static final JsFunction.Member<JsClass> constructor = new JsFunction.Member<JsClass>(Members.constructor, Generic.get(JsClass.class));
193     /**
194      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
195      * without a qualifying member and to access the property of the name on an object.</p>
196      * @since 1.0
197      * @see JsFunction#valueOf()
198      * @javascript Re-compilers must resolve the member of this static field to the 
199      * identifier of the field name.
200      */
201     public static final JsFunction.Member<JsClass> valueOf = new JsFunction.Member<JsClass>(Members.valueOf, Generic.get(JsClass.class));
202     /**
203      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
204      * without a qualifying member and to access the property of the name on an object.</p>
205      * <p>The <tt>prototype</tt> property is used when a function is used as a 
206      * constructor. It refers to an object that serves as the prototype for an entire 
207      * class of objects. Any object created by the constructor inherits all properties 
208      * of the object referred to by the <tt>prototype</tt> property.</p>
209      * @since 1.0
210      * @javascript Re-compilers must resolve the member of this static field to the 
211      * identifier of the field name.
212      */
213     public static final JsObject.Member prototype = new JsObject.Member(Members.prototype);
214 
215     /**
216      * <p>Internally constructs a function object.</p>
217      * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> or 
218      * <b>internal</b> classes or class members.</p>
219      * @since 1.0
220      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
221      */
222     protected JsClass(Object var) {
223         super((JsObject)var);
224     }
225     /**
226      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it 
227      * with the wrapping constructor.</p>
228      * @param var The argument of an <b>opaque</b> object.
229      * @since 1.0
230      * @javascript Re-compilers must ignore the construction operation of this constructor, 
231      * that is, replacing it with its only argument.
232      */
233     protected JsClass(JsObject var) {
234         super(var);
235     }
236 
237     /**
238      * <p>Simply returns the current boolean instance.</p>
239      * <p>This method is useful for JS Simulation to implement opaque types.</p>
240      * <p>If the current instance is a Java simulated array and the method runs in JS 
241      * Embed Simulation mode, the invocation creates and returns a JavaScript Array object 
242      * as a runtime copy of the current array.</p>
243      * @return The current boolean instance.
244      * @since 1.0
245      * @javascript Re-compilers must ignore the instance invocation of this method, that is, 
246      * replacing it with its current instance.
247      */
248     @Override
249     public JsClass var() {
250         return (JsClass)super.var();
251     }
252 
253     /**
254      * <p>Returns the primitive value associated with the current instance, if there is one. 
255      * This invocation simply returns the instance itself for the current instance is an 
256      * object and there is no primitive value for it.</p>
257      * @return The current object itself.
258      * @since 1.0
259      * @javascript Re-compilers must convert the instance invocation of this method directly 
260      * into a JavaScript invocation on its current object instance without changing the 
261      * method name, but expanding variable arguments, if any, into comma-separated values. 
262      */
263     @Override
264     public JsClass valueOf() {
265         return var().valueOf();
266     }
267 
268     /**
269      * <p>Logically evaluates the current function instance.</p>
270      * @return The logical value of the current function instance.
271      * @since 1.0
272      * @javascript Re-compilers must ignore the instance invocation of this method, that is, 
273      * replacing it with its current date instance.
274      */
275     public final boolean be() {
276         return Js.be(var());
277     }
278 
279     /**
280      * <p>Inverts the boolean value of the current function instance, resembling the logical 
281      * NOT operator in JavaScript.</p>
282      * <p>This operation converts the current function instance to a boolean value using 
283      * the following rules if necessary before inverting the converted value.</p>
284      * <ul>
285      * <li>If a number is used where a boolean value is expected, the number is converted 
286      * to <tt>true</tt> unless the number is 0 or NaN, which are converted to <tt>false</tt>.</li>
287      * <li>If a string is used where a boolean value is expected, it is converted to <tt>true</tt> 
288      * except for the empty string, which is converted to <tt>false</tt>.</li>
289      * <li><tt>null</tt> and the undefined value convert to <tt>false</tt>, and any 
290      * non-null object, array, or function converts to <tt>true</tt>.
291      * </ul>
292      * <p>You can convert any value <tt>x</tt> to its equivalent boolean value by applying 
293      * this operation twice: <tt>Js.not(Js.not(x))</tt></p>
294      * <p>Note that, this method is probably useful in emulation codes just for perfect 
295      * re-compilations. However, in most cases you can use the logical NOT operator of the 
296      * Java language like this:
297      * <pre>!Js.be(var)</pre>
298      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
299      * JavaScript expression since the Java compilers generally used are free to compile 
300      * the expression into any byte codes they think efficient, making it too hard for the 
301      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
302      * @return The inverted boolean value.
303      * @since 1.0
304      * @javascript Re-compilers must replace the instance invocation of this method with the 
305      * JavaScript expression:
306      * <pre>!d</pre>
307      * where <tt>d</tt> is the current function instance of the invocation of this method.
308      */
309     public final boolean not() {
310         return Js.not(var());
311     }
312 
313     /**
314      * <p>Checks if the current function instance is an instance of the second operand, 
315      * resembling the <tt>instanceof</tt> operator in JavaScript.</p>
316      * <p>This operation expects the first operand be an object and the second be a class 
317      * of objects. In JavaScript, classes of objects are defined by the constructor function 
318      * that initializes them.</p>
319      * @param other A constructor function.
320      * @return <tt>true</tt> if the current function instance is an instance of the second 
321      * operand; <tt>false</tt>, otherwise;
322      * @since 1.0
323      * @javascript Re-compilers must replace the instance invocation of this method with the 
324      * JavaScript expression:
325      * <pre>p instanceof other</pre>
326      * where <tt>p</tt> is the current function instance of the invocation of this method.
327      */
328     public final boolean instanceOf(Object other) {
329         return Js.instanceOf(this, other);
330     }
331 
332     /**
333      * <p>Checks whether the two operands are "equal" using a more relaxed definition of 
334      * sameness that allows type conversions, resembling the equality operator in 
335      * JavaScript.</p>
336      * <p>The equality and identity operations check whether two values are the same, using 
337      * two different definitions of sameness. Both operations accept operands of any type, 
338      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
339      * if they are different. The identity operation checks whether its two operands are 
340      * "identical" using a strict definition of sameness. The equality operation checks 
341      * whether its two operands are "equal" using a more relaxed definition of sameness 
342      * that allows type conversions.</p>
343      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
344      * JavaScript 1.3 and later. Be sure you understand the differences between the 
345      * assignment, equality, and identity operations, and be careful to use the correct one 
346      * when coding! Although it is tempting to call all three operations "equals," it may 
347      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
348      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
349      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
350      * case, two separate values are involved, and the equality and identity operations 
351      * check that these two values are identical. This means that two variables are equal 
352      * or identical only if they contain the same value. For example, two strings are equal 
353      * only if they each contain exactly the same characters.</p>
354      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
355      * means that two variables are equal only if they refer to the same object. Two 
356      * separate arrays are never equal or identical, even if they contain equal or identical 
357      * elements. Two variables that contain references to objects, arrays, or functions are 
358      * equal only if they refer to the same object, array, or function. If you want to test 
359      * that two distinct objects contain the same properties or that two distinct arrays 
360      * contain the same elements, you'll have to check the properties or elements individually 
361      * for equality or identity. And, if any of the properties or elements are themselves 
362      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
363      * <p>The following rules determine whether two values are equal according to the 
364      * equality operation:
365      * <ul>
366      * <li>If the two values have the same type, test them for identity. If the values are 
367      * identical, they are equal; if they are not identical, they are not equal.</li>
368      * <li>If the two values do not have the same type, they may still be equal. Use the 
369      * following rules and type conversions to check for equality:</li>
370      * <ul>
371      * <li>If one value is null and the other is undefined, they are equal.</li>
372      * <li>If one value is a number and the other is a string, convert the string to a 
373      * number and try the comparison again, using the converted value.</li>
374      * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison 
375      * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison 
376      * again.</li>
377      * <li>If one value is an object and the other is a number or string, convert the 
378      * object to a primitive and try the comparison again. An object is converted to a 
379      * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt> 
380      * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt> 
381      * conversion before <tt>toString()</tt> conversion, except for the Date class, 
382      * which performs <tt>toString()</tt> conversion. Objects that are not part of core 
383      * JavaScript may convert themselves to primitive values in an implementation-defined 
384      * way.</li>
385      * <li>Any other combinations of values are not equal.</li>
386      * </ul>
387      * </ul>
388      * @param other Any value or object.
389      * @return <tt>true</tt> if the first operand equals the second; <tt>false</tt>, 
390      * otherwise;
391      * @since 1.0
392      * @javascript Re-compilers must replace the instance invocation of this method with the 
393      * JavaScript expression:
394      * <pre>p == other</pre>
395      * where <tt>p</tt> is the current function instance of the invocation of this method.
396      */
397     public final boolean eq(Object other) {
398         return Js.eq(var(), other);
399     }
400 
401     /**
402      * <p>Checks whether the two operands are "identical" using a strict definition of 
403      * sameness, resembling the identity operator in JavaScript.</p>
404      * <p>The equality and identity operations check whether two values are the same, using 
405      * two different definitions of sameness. Both operations accept operands of any type, 
406      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
407      * if they are different. The identity operation checks whether its two operands are 
408      * "identical" using a strict definition of sameness. The equality operation checks 
409      * whether its two operands are "equal" using a more relaxed definition of sameness 
410      * that allows type conversions.</p>
411      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
412      * JavaScript 1.3 and later. Be sure you understand the differences between the 
413      * assignment, equality, and identity operations, and be careful to use the correct one 
414      * when coding! Although it is tempting to call all three operations "equals," it may 
415      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
416      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
417      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
418      * case, two separate values are involved, and the equality and identity operations 
419      * check that these two values are identical. This means that two variables are equal 
420      * or identical only if they contain the same value. For example, two strings are equal 
421      * only if they each contain exactly the same characters.</p>
422      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
423      * means that two variables are equal only if they refer to the same object. Two 
424      * separate arrays are never equal or identical, even if they contain equal or identical 
425      * elements. Two variables that contain references to objects, arrays, or functions are 
426      * equal only if they refer to the same object, array, or function. If you want to test 
427      * that two distinct objects contain the same properties or that two distinct arrays 
428      * contain the same elements, you'll have to check the properties or elements individually 
429      * for equality or identity. And, if any of the properties or elements are themselves 
430      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
431      * <p>The following rules determine whether two values are identical according to the identity operation:
432      * <ul>
433      * <li>If the two values have different types, they are not identical.</li>
434      * <li>If both values are numbers and have the same value, they are identical, unless 
435      * either or both values are <tt>NaN</tt>, in which case they are not identical. 
436      * The <tt>NaN</tt> value is never identical to any other value, including itself! 
437      * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)} 
438      * function.</li>
439      * <li>If both values are strings and contain exactly the same characters in the same 
440      * positions, they are identical. If the strings differ in length or content, they are 
441      * not identical. Note that in some cases, the Unicode standard allows more than one 
442      * way to encode the same string. For efficiency, however, JavaScript's string 
443      * comparison compares strictly on a character-by-character basis, and it assumes that 
444      * all strings have been converted to a "normalized form" before they are compared. 
445      * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
446      * <li>If both values are the boolean value <tt>true</tt> or both are the boolean 
447      * value <tt>false</tt>, they are identical.</li>
448      * <li>If both values refer to the same object, array, or function, they are identical. 
449      * If they refer to different objects (or arrays or functions) they are not identical, 
450      * even if both objects have identical properties or both arrays have identical elements.</li>
451      * <li>If both values are null or both values are undefined, they are identical.</li>
452      * </ul>
453      * @param other Any value or object.
454      * @return <tt>true</tt> if the first operand is identical to the second; 
455      * <tt>false</tt>, otherwise;
456      * @since 1.0
457      * @javascript Re-compilers must replace the instance invocation of this method with the 
458      * JavaScript expression:
459      * <pre>p === other</pre>
460      * where <tt>p</tt> is the current function instance of the invocation of this method.
461      */
462     public final boolean eqs(Object other) {
463         return Js.eqs(this, other);
464     }
465 
466     /**
467      * <p>Checks whether the two operands are not "equal" using a more relaxed definition of 
468      * sameness that allows type conversions, resembling the equality operator in 
469      * JavaScript.</p>
470      * <p>The equality and identity operations check whether two values are the same, using 
471      * two different definitions of sameness. Both operations accept operands of any type, 
472      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
473      * if they are different. The identity operation checks whether its two operands are 
474      * "identical" using a strict definition of sameness. The equality operation checks 
475      * whether its two operands are "equal" using a more relaxed definition of sameness 
476      * that allows type conversions.</p>
477      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
478      * JavaScript 1.3 and later. Be sure you understand the differences between the 
479      * assignment, equality, and identity operations, and be careful to use the correct one 
480      * when coding! Although it is tempting to call all three operations "equals," it may 
481      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
482      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
483      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
484      * case, two separate values are involved, and the equality and identity operations 
485      * check that these two values are identical. This means that two variables are equal 
486      * or identical only if they contain the same value. For example, two strings are equal 
487      * only if they each contain exactly the same characters.</p>
488      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
489      * means that two variables are equal only if they refer to the same object. Two 
490      * separate arrays are never equal or identical, even if they contain equal or identical 
491      * elements. Two variables that contain references to objects, arrays, or functions are 
492      * equal only if they refer to the same object, array, or function. If you want to test 
493      * that two distinct objects contain the same properties or that two distinct arrays 
494      * contain the same elements, you'll have to check the properties or elements individually 
495      * for equality or identity. And, if any of the properties or elements are themselves 
496      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
497      * <p>The following rules determine whether two values are equal according to the 
498      * equality operation:
499      * <ul>
500      * <li>If the two values have the same type, test them for identity. If the values are 
501      * identical, they are equal; if they are not identical, they are not equal.</li>
502      * <li>If the two values do not have the same type, they may still be equal. Use the 
503      * following rules and type conversions to check for equality:</li>
504      * <ul>
505      * <li>If one value is null and the other is undefined, they are equal.</li>
506      * <li>If one value is a number and the other is a string, convert the string to a 
507      * number and try the comparison again, using the converted value.</li>
508      * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison 
509      * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison 
510      * again.</li>
511      * <li>If one value is an object and the other is a number or string, convert the 
512      * object to a primitive and try the comparison again. An object is converted to a 
513      * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt> 
514      * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt> 
515      * conversion before <tt>toString()</tt> conversion, except for the Date class, 
516      * which performs <tt>toString()</tt> conversion. Objects that are not part of core 
517      * JavaScript may convert themselves to primitive values in an implementation-defined 
518      * way.</li>
519      * <li>Any other combinations of values are not equal.</li>
520      * </ul>
521      * </ul>
522      * @param other Any value or object.
523      * @return <tt>false</tt> if the first operand equals the second; <tt>true</tt>, 
524      * otherwise;
525      * @since 1.0
526      * @javascript Re-compilers must replace the instance invocation of this method with the 
527      * JavaScript expression:
528      * <pre>p != other</pre>
529      * where <tt>p</tt> is the current function instance of the invocation of this method.
530      */
531     public final boolean neq(Object other) {
532         return Js.neq(var(), other);
533     }
534 
535     /**
536      * <p>Checks whether the two operands are not "identical" using a strict definition of 
537      * sameness, resembling the identity operator in JavaScript.</p>
538      * <p>The equality and identity operations check whether two values are the same, using 
539      * two different definitions of sameness. Both operations accept operands of any type, 
540      * and both return <tt>true</tt> if their operands are the same and <tt>false</tt> 
541      * if they are different. The identity operation checks whether its two operands are 
542      * "identical" using a strict definition of sameness. The equality operation checks 
543      * whether its two operands are "equal" using a more relaxed definition of sameness 
544      * that allows type conversions.</p>
545      * <p>The identity operation is standardized by ECMAScript v3 and implemented in 
546      * JavaScript 1.3 and later. Be sure you understand the differences between the 
547      * assignment, equality, and identity operations, and be careful to use the correct one 
548      * when coding! Although it is tempting to call all three operations "equals," it may 
549      * help to reduce confusion if you read "gets or is assigned" for assignment operation, 
550      * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
551      * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this 
552      * case, two separate values are involved, and the equality and identity operations 
553      * check that these two values are identical. This means that two variables are equal 
554      * or identical only if they contain the same value. For example, two strings are equal 
555      * only if they each contain exactly the same characters.</p>
556      * <p>On the other hand, objects, arrays, and functions are compared by reference. This 
557      * means that two variables are equal only if they refer to the same object. Two 
558      * separate arrays are never equal or identical, even if they contain equal or identical 
559      * elements. Two variables that contain references to objects, arrays, or functions are 
560      * equal only if they refer to the same object, array, or function. If you want to test 
561      * that two distinct objects contain the same properties or that two distinct arrays 
562      * contain the same elements, you'll have to check the properties or elements individually 
563      * for equality or identity. And, if any of the properties or elements are themselves 
564      * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
565      * <p>The following rules determine whether two values are identical according to the identity operation:
566      * <ul>
567      * <li>If the two values have different types, they are not identical.</li>
568      * <li>If both values are numbers and have the same value, they are identical, unless 
569      * either or both values are <tt>NaN</tt>, in which case they are not identical. 
570      * The <tt>NaN</tt> value is never identical to any other value, including itself! 
571      * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)} 
572      * function.</li>
573      * <li>If both values are strings and contain exactly the same characters in the same 
574      * positions, they are identical. If the strings differ in length or content, they are 
575      * not identical. Note that in some cases, the Unicode standard allows more than one 
576      * way to encode the same string. For efficiency, however, JavaScript's string 
577      * comparison compares strictly on a character-by-character basis, and it assumes that 
578      * all strings have been converted to a "normalized form" before they are compared. 
579      * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
580      * <li>If both values are the boolean value <tt>true</tt> or both are the boolean 
581      * value <tt>false</tt>, they are identical.</li>
582      * <li>If both values refer to the same object, array, or function, they are identical. 
583      * If they refer to different objects (or arrays or functions) they are not identical, 
584      * even if both objects have identical properties or both arrays have identical elements.</li>
585      * <li>If both values are null or both values are undefined, they are identical.</li>
586      * </ul>
587      * @param other Any value or object.
588      * @return <tt>false</tt> if the first operand is identical to the second; 
589      * <tt>true</tt>, otherwise;
590      * @since 1.0
591      * @javascript Re-compilers must replace the instance invocation of this method with the 
592      * JavaScript expression:
593      * <pre>p !== other</pre>
594      * where <tt>p</tt> is the current function instance of the invocation of this method.
595      */
596     public final boolean neqs(Object other) {
597         return Js.neqs(this, other);
598     }
599 
600     /**
601      * <p>Adds the current function instance to a numeric operand or concatenates it with 
602      * a string operand, resembling the addition operator in JavaScript.</p>
603      * <p>If one value is a string, the other is converted to a string, and the two 
604      * strings are then concatenated. Object operands are converted to numbers or strings 
605      * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}  
606      * method and/or the {@link Js#toString(Object)} method on the object.</p>
607      * @param other A value or object.
608      * @return The sum or concatenation of the values.
609      * @since 1.0
610      * @javascript Re-compilers must replace the instance invocation of this method with the 
611      * JavaScript expression:
612      * <pre>d + other</pre>
613      * where <tt>d</tt> is the current function instance of the invocation of this method.
614      */
615     public final String add(Object other) {
616         return Js.add(toString(), other);
617     }
618 
619     /**
620      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
621      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
622      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
623      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
624      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
625      * may or may not evaluate the right-side expression. The actual behavior of the operator 
626      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
627      * on its left. If the value of this expression can be converted to <tt>false</tt> 
628      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
629      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
630      * its second operand, the expression on its right, and returns the value of that 
631      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
632      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
633      * returning the unconverted value of the left-side expression.</p>
634      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
635      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
636      * anonymously, returning the actual expression in the method overriding 
637      * {@link Var#var()}.</p>
638      * <p>Sometimes, this operation probably does not do what the programmers intended. 
639      * To avoid problems, do not use expressions with side effects (assignments, increments, 
640      * decrements, and function calls) for the second operand unless you are quite sure 
641      * you know exactly what you are doing.</p>
642      * <p>Despite the fairly confusing way that this operation actually works, it is 
643      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
644      * Although it does not actually return a boolean value, the value it returns can always 
645      * be converted to a boolean value.</p>
646      * <p>Note that, this method is probably useful in emulation codes just for perfect 
647      * re-compilations. However, in most cases you can use the logical AND operator of the 
648      * Java language like this:
649      * <pre>Js.be(var) && Js.be(other)</pre>
650      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
651      * JavaScript expression since the Java compilers generally used are free to compile 
652      * the expression into any byte codes they think efficient, making it too hard for the 
653      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
654      * @param other A value or object.
655      * @return The logical AND of the two operands.
656      * @since 1.0
657      * @javascript Re-compilers must replace the instance invocation of this method with the 
658      * JavaScript expression:
659      * <pre>p && other</pre>
660      * where <tt>p</tt> is the current function instance of the invocation of this method.
661      */
662     public final Object and(Object other) {
663         return Js.and(this, other);
664     }
665 
666     /**
667      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
668      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
669      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
670      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
671      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
672      * may or may not evaluate the right-side expression. The actual behavior of the operator 
673      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
674      * on its left. If the value of this expression can be converted to <tt>false</tt> 
675      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
676      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
677      * its second operand, the expression on its right, and returns the value of that 
678      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
679      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
680      * returning the unconverted value of the left-side expression.</p>
681      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
682      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
683      * anonymously, returning the actual expression in the method overriding 
684      * {@link Var#var()}.</p>
685      * <p>Sometimes, this operation probably does not do what the programmers intended. 
686      * To avoid problems, do not use expressions with side effects (assignments, increments, 
687      * decrements, and function calls) for the second operand unless you are quite sure 
688      * you know exactly what you are doing.</p>
689      * <p>Despite the fairly confusing way that this operation actually works, it is 
690      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
691      * Although it does not actually return a boolean value, the value it returns can always 
692      * be converted to a boolean value.</p>
693      * <p>Note that, this method is probably useful in emulation codes just for perfect 
694      * re-compilations. However, in most cases you can use the logical AND operator of the 
695      * Java language like this:
696      * <pre>Js.be(var) && Js.be(other)</pre>
697      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
698      * JavaScript expression since the Java compilers generally used are free to compile 
699      * the expression into any byte codes they think efficient, making it too hard for the 
700      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
701      * @param other A value or object.
702      * @return The logical AND of the two operands.
703      * @since 1.0
704      * @javascript Re-compilers must replace the instance invocation of this method with the 
705      * JavaScript expression:
706      * <pre>p && other</pre>
707      * where <tt>p</tt> is the current function instance of the invocation of this method.
708      */
709     public final JsObject and(Var<? extends JsObject> other) {
710         return Js.and(this, other);
711     }
712 
713     /**
714      * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND 
715      * operation on the two values: it returns <tt>true</tt> if and only if both its first 
716      * operand and its second operand are <tt>true</tt>. If one or both of these operands 
717      * is <tt>false</tt>, it returns <tt>false</tt>.</p>
718      * <p>In JavaScript, depending on the value of the left-side expression, the operator 
719      * may or may not evaluate the right-side expression. The actual behavior of the operator 
720      * is somewhat more complicated. It starts by evaluating its first operand, the expression 
721      * on its left. If the value of this expression can be converted to <tt>false</tt> 
722      * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined), 
723      * the operator returns the value of the left-side expression. Otherwise, it evaluates 
724      * its second operand, the expression on its right, and returns the value of that 
725      * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression 
726      * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than 
727      * returning the unconverted value of the left-side expression.</p>
728      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
729      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
730      * anonymously, returning the actual expression in the method overriding 
731      * {@link Var#var()}.</p>
732      * <p>Sometimes, this operation probably does not do what the programmers intended. 
733      * To avoid problems, do not use expressions with side effects (assignments, increments, 
734      * decrements, and function calls) for the second operand unless you are quite sure 
735      * you know exactly what you are doing.</p>
736      * <p>Despite the fairly confusing way that this operation actually works, it is 
737      * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator. 
738      * Although it does not actually return a boolean value, the value it returns can always 
739      * be converted to a boolean value.</p>
740      * <p>Note that, this method is probably useful in emulation codes just for perfect 
741      * re-compilations. However, in most cases you can use the logical AND operator of the 
742      * Java language like this:
743      * <pre>Js.be(var) && Js.be(other)</pre>
744      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
745      * JavaScript expression since the Java compilers generally used are free to compile 
746      * the expression into any byte codes they think efficient, making it too hard for the 
747      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
748      * @param other A value or object.
749      * @return The logical AND of the two operands.
750      * @since 1.0
751      * @javascript Re-compilers must replace the instance invocation of this method with the 
752      * JavaScript expression:
753      * <pre>p && other</pre>
754      * where <tt>p</tt> is the current function instance of the invocation of this method.
755      */
756     public final JsClass and(JsClass other) {
757         return Js.and(this, other);
758     }
759 
760     /**
761      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
762      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
763      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
764      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
765      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
766      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
767      * its first operand, the expression on its left. If the value of this expression can 
768      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
769      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
770      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
771      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
772      * and doesn't return the unconverted value of the left-side expression.</p>
773      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
774      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
775      * anonymously, returning the actual expression in the method overriding 
776      * {@link Var#var()}.</p>
777      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
778      * operands that include side effects, unless you purposely want to use the fact that 
779      * the right-side expression may not be evaluated in JavaScript.</p>
780      * <p>Even when this operation is used with operands that are not boolean values, it 
781      * can still be considered a Boolean OR operator because its return value, whatever the 
782      * type, can be converted to a boolean value.</p>
783      * <p>Note that, this method is probably useful in emulation codes just for perfect 
784      * re-compilations. However, in most cases you can use the logical OR operator of the 
785      * Java language like this:
786      * <pre>Js.be(var) || Js.be(other)</pre>
787      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
788      * JavaScript expression since the Java compilers generally used are free to compile 
789      * the expression into any byte codes they think efficient, making it too hard for the 
790      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
791      * @param other A value or object.
792      * @return The logical OR of the two operands.
793      * @since 1.0
794      * @javascript Re-compilers must replace the instance invocation of this method with the 
795      * JavaScript expression:
796      * <pre>p || other</pre>
797      * where <tt>p</tt> is the current function instance of the invocation of this method.
798      */
799     public final Object or(Object other) {
800         return Js.or(this, other);
801     }
802 
803     /**
804      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
805      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
806      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
807      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
808      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
809      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
810      * its first operand, the expression on its left. If the value of this expression can 
811      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
812      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
813      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
814      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
815      * and doesn't return the unconverted value of the left-side expression.</p>
816      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
817      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
818      * anonymously, returning the actual expression in the method overriding 
819      * {@link Var#var()}.</p>
820      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
821      * operands that include side effects, unless you purposely want to use the fact that 
822      * the right-side expression may not be evaluated in JavaScript.</p>
823      * <p>Even when this operation is used with operands that are not boolean values, it 
824      * can still be considered a Boolean OR operator because its return value, whatever the 
825      * type, can be converted to a boolean value.</p>
826      * <p>Note that, this method is probably useful in emulation codes just for perfect 
827      * re-compilations. However, in most cases you can use the logical OR operator of the 
828      * Java language like this:
829      * <pre>Js.be(var) || Js.be(other)</pre>
830      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
831      * JavaScript expression since the Java compilers generally used are free to compile 
832      * the expression into any byte codes they think efficient, making it too hard for the 
833      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
834      * @param other A value or object.
835      * @return The logical OR of the two operands.
836      * @since 1.0
837      * @javascript Re-compilers must replace the instance invocation of this method with the 
838      * JavaScript expression:
839      * <pre>p || other</pre>
840      * where <tt>p</tt> is the current function instance of the invocation of this method.
841      */
842     public final JsObject or(Var<? extends JsObject> other) {
843         return Js.or(this, other);
844     }
845 
846     /**
847      * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR 
848      * operation on the two values: it returns <tt>true</tt> if either the first operand or 
849      * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands 
850      * are <tt>false</tt>, it returns <tt>false</tt>.</p>
851      * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR 
852      * operator, it, like the && operator, has more complex behavior. It starts by evaluating 
853      * its first operand, the expression on its left. If the value of this expression can 
854      * be converted to <tt>true</tt>, it returns the unconverted value of the left-side 
855      * expression. Otherwise, it evaluates its second operand, the expression on its right, 
856      * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the 
857      * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt> 
858      * and doesn't return the unconverted value of the left-side expression.</p>
859      * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation 
860      * mode, resembling what happens in JavaScript, you may have to extend {@link Var} 
861      * anonymously, returning the actual expression in the method overriding 
862      * {@link Var#var()}.</p>
863      * <p>As with the {@link #and(Object)} operation, you should avoid right-side 
864      * operands that include side effects, unless you purposely want to use the fact that 
865      * the right-side expression may not be evaluated in JavaScript.</p>
866      * <p>Even when this operation is used with operands that are not boolean values, it 
867      * can still be considered a Boolean OR operator because its return value, whatever the 
868      * type, can be converted to a boolean value.</p>
869      * <p>Note that, this method is probably useful in emulation codes just for perfect 
870      * re-compilations. However, in most cases you can use the logical OR operator of the 
871      * Java language like this:
872      * <pre>Js.be(var) || Js.be(other)</pre>
873      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
874      * JavaScript expression since the Java compilers generally used are free to compile 
875      * the expression into any byte codes they think efficient, making it too hard for the 
876      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
877      * @param other A value or object.
878      * @return The logical OR of the two operands.
879      * @since 1.0
880      * @javascript Re-compilers must replace the instance invocation of this method with the 
881      * JavaScript expression:
882      * <pre>p || other</pre>
883      * where <tt>p</tt> is the current function instance of the invocation of this method.
884      */
885     public final JsClass or(JsClass other) {
886         return Js.or(this, other);
887     }
888 
889     /**
890      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
891      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
892      * operand, otherwise.</p>
893      * <p>The first operand of the conditional operation must be (or be convertible to) a 
894      * boolean value. Usually this is the result of a comparison operation. The second and 
895      * third operands may have any value. The value returned by the conditional operation 
896      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
897      * the value of the conditional expression is the value of the second operand. If the 
898      * first operand is <tt>false</tt>, the value of the conditional expression is the 
899      * value of the third operand.</p>
900      * <p>To make the second and third operands really late-evaluated or not evaluated in 
901      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
902      * {@link Var} anonymously, returning the actual expression in the method overriding 
903      * {@link Var#var()}.</p>
904      * <p>Note that, this method is probably useful in emulation codes just for perfect 
905      * re-compilations. However, in most cases you can use the conditional operator of the 
906      * Java language like this:
907      * <pre>Js.be(test) ? var : other</pre>
908      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
909      * JavaScript expression since the Java compilers generally used are free to compile 
910      * the expression into any byte codes they think efficient, making it too hard for the 
911      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
912      * @param other A value or object.
913      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
914      * the third operand.
915      * @since 1.0
916      * @javascript Re-compilers must replace the instance invocation of this method with the 
917      * JavaScript expression:
918      * <pre>test ? p : other</pre>
919      * where <tt>p</tt> is the current function instance of the invocation of this method.
920      */
921     public final Object cond(Object test, Object other) {
922         return Js.cond(test, this, other);
923     }
924 
925     /**
926      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
927      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
928      * operand, otherwise.</p>
929      * <p>The first operand of the conditional operation must be (or be convertible to) a 
930      * boolean value. Usually this is the result of a comparison operation. The second and 
931      * third operands may have any value. The value returned by the conditional operation 
932      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
933      * the value of the conditional expression is the value of the second operand. If the 
934      * first operand is <tt>false</tt>, the value of the conditional expression is the 
935      * value of the third operand.</p>
936      * <p>To make the second and third operands really late-evaluated or not evaluated in 
937      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
938      * {@link Var} anonymously, returning the actual expression in the method overriding 
939      * {@link Var#var()}.</p>
940      * <p>Note that, this method is probably useful in emulation codes just for perfect 
941      * re-compilations. However, in most cases you can use the conditional operator of the 
942      * Java language like this:
943      * <pre>Js.be(test) ? var : other</pre>
944      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
945      * JavaScript expression since the Java compilers generally used are free to compile 
946      * the expression into any byte codes they think efficient, making it too hard for the 
947      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
948      * @param other A value or object.
949      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
950      * the third operand.
951      * @since 1.0
952      * @javascript Re-compilers must replace the instance invocation of this method with the 
953      * JavaScript expression:
954      * <pre>test ? p : other</pre>
955      * where <tt>p</tt> is the current function instance of the invocation of this method.
956      */
957     public final JsObject cond(Object test, Var<? extends JsObject> other) {
958         return Js.cond(test, this, other);
959     }
960 
961     /**
962      * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the 
963      * second operand if the first operand evaluates to <tt>true</tt>; Returns the third 
964      * operand, otherwise.</p>
965      * <p>The first operand of the conditional operation must be (or be convertible to) a 
966      * boolean value. Usually this is the result of a comparison operation. The second and 
967      * third operands may have any value. The value returned by the conditional operation 
968      * depends on the boolean value of the first operand. If that operand is <tt>true</tt>, 
969      * the value of the conditional expression is the value of the second operand. If the 
970      * first operand is <tt>false</tt>, the value of the conditional expression is the 
971      * value of the third operand.</p>
972      * <p>To make the second and third operands really late-evaluated or not evaluated in 
973      * JS Simulation mode, resembling what happens in JavaScript, you may have to extend 
974      * {@link Var} anonymously, returning the actual expression in the method overriding 
975      * {@link Var#var()}.</p>
976      * <p>Note that, this method is probably useful in emulation codes just for perfect 
977      * re-compilations. However, in most cases you can use the conditional operator of the 
978      * Java language like this:
979      * <pre>Js.be(test) ? var : other</pre>
980      * which is definitely late-evaluated but not necessarily re-compiled into an expected 
981      * JavaScript expression since the Java compilers generally used are free to compile 
982      * the expression into any byte codes they think efficient, making it too hard for the 
983      * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
984      * @param other A value or object.
985      * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise, 
986      * the third operand.
987      * @since 1.0
988      * @javascript Re-compilers must replace the instance invocation of this method with the 
989      * JavaScript expression:
990      * <pre>test ? p : other</pre>
991      * where <tt>p</tt> is the current function instance of the invocation of this method.
992      */
993     public final JsClass cond(Object test, JsClass other) {
994         return Js.cond(test, this, other);
995     }
996 }