00001 00002 /*
00003 * JScripter Standard 1.0 - To Script In Java
00004 * Copyright (C) 2008-2011 J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
00005 *
00006 * This program is free software: you can redistribute it and/or modify
00007 * it under the terms of the GNU Affero General Public License as published by
00008 * the Free Software Foundation, either version 3 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014 * GNU Affero General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU Affero General Public License
00017 * along with this program. If not, see <http://www.gnu.org/licenses/>.
00018 */00019 00020 packagejs;00021 00022 importjs.core.*;00023 00024 /**
00025 * <p>An <b>opaque</b> class resembling JavaScript primitive values.</p>
00026 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00027 * wrap primitive data types are also "primitive" to JS.</p>
00028 *
00029 * @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>
00030 *
00031 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
00032 * generated into the target codes. Re-compilers must exit with error on the operations of
00033 * accessing that kind of class objects.
00034 * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
00035 * and <tt>instanceof</tt> to it always <tt>true</tt>.
00036 */00037 publicclassValue<T>extendsVar<T>00038 {00039 /**
00040 * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
00041 * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>.
00042 * This class and the subclasses of this class are used to declare either <b>opaque</b>
00043 * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the
00044 * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their
00045 * constructors are used to define the fields inside <b>opaque</b> classes. Under
00046 * either circumstance, the field names must be exactly same as the member names, as
00047 * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly
00048 * based on the field names.</p>
00049 *
00050 * @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>
00051 *
00052 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
00053 * in the target codes. Re-compilers must exit with error on operations accessing that kind
00054 * of class objects.
00055 * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
00056 * {@link js.Var.Member} or its subclasses to the JavaScript identifier:
00057 * <pre>q.m</pre>
00058 * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
00059 * resolved from the instance of the enclosing member. Re-compilers must resolve an
00060 * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than
00061 * {@link js.Var.Member} and its subclasses to the JavaScript identifier:
00062 * <pre>m</pre>
00063 * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
00064 * error on the access to <b>opaque</b> fields declared by this class under any other
00065 * circumstances.
00066 */00067 publicstaticclassMember<T>extendsVar.Member<T>00068 {00069 /**
00070 * <p>Internally constructs a member based on a qualifying member.</p>
00071 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
00072 * or <b>internal</b> classes or class members.</p>
00073 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
00074 * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields
00075 * declared in the declaring class of this constructor itself or its subclasses.
00076 * Under this circumstance, the field names must be exactly same as the member
00077 * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type
00078 * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
00079 * to their names appending to the name resolved from the specified qualifying
00080 * member with a dot in between.</p>
00081 * @param q A qualifying member
00082 * @param mid The ID of the member to construct
00083 * @since 1.0
00084 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
00085 */00086 publicMember(JsObject.Memberq,Midmid){00087 super(q,mid);00088 }00089 /**
00090 * <p>Internally constructs a member without a qualifying member.</p>
00091 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
00092 * or <b>internal</b> classes or class members.</p>
00093 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
00094 * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields,
00095 * declared in <b>opaque</b> types other than the declaring class of this constructor
00096 * itself and its subclasses. Under this circumstance, the field names must be
00097 * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
00098 * types are generally resolved by re-compilers directly to identifiers of their names.</p>
00099 * @param mid The ID of the member to construct
00100 * @since 1.0
00101 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
00102 */00103 publicMember(Midmid){00104 super(mid);00105 }00106 /**
00107 * <p>Evaluates the property, represented by the current member instance, of the
00108 * argument object.</p>
00109 * @param o The argument object.
00110 * @return The value of the current member based on the object argument.
00111 * @since 1.0
00112 * @javascript Re-compilers must convert the instance invocation of this method into
00113 * the JavaScript expression:
00114 * <pre>o.m</pre>
00115 * where <tt>m</tt> is the identifier name resolved from the current member
00116 * instance of the invocation.
00117 */00118 @SuppressWarnings("unchecked")00119 @Override00120 publicfinalTwith(ObjectLikeo){00121 return(T)var(o).var(mid());00122 }00123 /**
00124 * <p>Evaluates a property, represented by the current member instance, of the
00125 * JavaScript global object, that is, evaluates the member to a global identifier.</p>
00126 * @return The value of the current member based on the JavaScript global object.
00127 * @since 1.0
00128 * @javascript Re-compilers must convert the instance invocation of this method into
00129 * the JavaScript expression:
00130 * <pre>m</pre>
00131 * where <tt>m</tt> is the identifier name resolved from the current member
00132 * instance of the invocation.
00133 */00134 publicfinalTwith(){00135 returnwith(Js.core());00136 }00137 }00138 00139 privateTvalue;00140 00141 /**
00142 * <p>Internally constructs a primitive instance from a primitive value.</p>
00143 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> or
00144 * <b>internal</b> classes or class members.</p>
00145 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00146 * wrap primitive data types are also "primitive" to JS.</p>
00147 * @since 1.0
00148 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
00149 */00150 protectedValue(Tvalue){00151 var(value);00152 }00153 /**
00154 * <p>Internally constructs a primitive instance from another primitive instance.</p>
00155 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> or
00156 * <b>internal</b> classes or class members.</p>
00157 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00158 * wrap primitive data types are also "primitive" to JS.</p>
00159 * @since 1.0
00160 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
00161 */00162 protectedValue(Var<?extendsT>value){00163 var(value);00164 }00165 00166 /**
00167 * <p>Assigns a new primitive value to the current primitive instance.</p>
00168 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00169 * wrap primitive data types are also "primitive" to JS.</p>
00170 * @param value The new value to set
00171 * @return The new value
00172 * @since 1.0
00173 * @javascript Re-compilers must convert the instance invocation of this method into
00174 * the JavaScript expression:
00175 * <pre>p = value</pre>
00176 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00177 */00178 publicfinalTvar(Tvalue){00179 this.value=value;00180 returnvalue;00181 }00182 /**
00183 * <p>Assigns the primitive value of another primitive instance to the current
00184 * primitive instance.</p>
00185 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00186 * wrap primitive data types are also "primitive" to JS.</p>
00187 * @param value Another primitive instance
00188 * @return The new value
00189 * @since 1.0
00190 * @javascript Re-compilers must convert the instance invocation of this method into
00191 * the JavaScript expression:
00192 * <pre>p = value</pre>
00193 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00194 */00195 publicfinalTvar(Var<?extendsT>value){00196 returnvar(value==null?null:value.var());00197 }00198 00199 /**
00200 * <p>Simply returns the primitive value of the current primitive instance.</p>
00201 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
00202 * wrap primitive data types are also "primitive" to JS.</p>
00203 * @return The primitive value of the current primitive instance.
00204 * @since 1.0
00205 * @javascript Re-compilers must ignore the instance invocation of this method, that is,
00206 * replacing it with its current instance.
00207 */00208 @Override00209 publicfinalTvar(){00210 returnvalue;00211 }00212 00213 /**
00214 * <p>Undefines the current primitive instance.</p>
00215 * @return <tt>true</tt> if the deletion is successful; Otherwise, <tt>false</tt>.
00216 * @since 1.0
00217 * @javascript Re-compilers must replace the instance invocation of this method with the
00218 * JavaScript expression:
00219 * <pre>delete p</pre>
00220 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00221 */00222 publicfinalbooleandelete(){00223 if(undefined()){00224 returnfalse;00225 }00226 var((T)null);00227 returntrue;00228 }00229 00230 /**
00231 * <p>Logically evaluates the current primitive instance.</p>
00232 * @return The logical value of the current primitive instance.
00233 * @since 1.0
00234 * @javascript Re-compilers must ignore the instance invocation of this method, that is,
00235 * replacing it with its current primitive instance.
00236 */00237 publicfinalbooleanbe(){00238 returnJs.be(var());00239 }00240 00241 /**
00242 * <p>Inverts the boolean value of the current primitive instance, resembling the
00243 * logical NOT operator in JavaScript.</p>
00244 * <p>This operation converts the current primitive instance to a boolean value using
00245 * the following rules if necessary before inverting the converted value.</p>
00246 * <ul>
00247 * <li>If a number is used where a boolean value is expected, the number is converted
00248 * to <tt>true</tt> unless the number is 0 or NaN, which are converted to <tt>false</tt>.</li>
00249 * <li>If a string is used where a boolean value is expected, it is converted to <tt>true</tt>
00250 * except for the empty string, which is converted to <tt>false</tt>.</li>
00251 * <li><tt>null</tt> and the undefined value convert to <tt>false</tt>, and any
00252 * non-null object, array, or function converts to <tt>true</tt>.
00253 * </ul>
00254 * <p>You can convert any value <tt>x</tt> to its equivalent boolean value by applying
00255 * this operation twice: <tt>Js.not(Js.not(x))</tt></p>
00256 * <p>Note that, this method is probably useful in emulation codes just for perfect
00257 * re-compilations. However, in most cases you can use the logical NOT operator of the
00258 * Java language like this:
00259 * <pre>!Js.be(var)</pre>
00260 * which is definitely late-evaluated but not necessarily re-compiled into an expected
00261 * JavaScript expression since the Java compilers generally used are free to compile
00262 * the expression into any byte codes they think efficient, making it too hard for the
00263 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
00264 * @return The inverted boolean value.
00265 * @since 1.0
00266 * @javascript Re-compilers must replace the instance invocation of this method with the
00267 * JavaScript expression:
00268 * <pre>!p</pre>
00269 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00270 */00271 publicfinalbooleannot(){00272 returnJs.not(var());00273 }00274 00275 /**
00276 * <p>Bitwise-NOT operation, resembling that of JavaScript, operates by reversing all
00277 * bits in the current primitive instance.</p>
00278 * <p>Because of the way signed integers are represented in JavaScript, applying this
00279 * operation to a value is equivalent to changing its sign and subtracting 1.</p>
00280 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
00281 * operation requires numeric operands that have integer values. It operate on the integer
00282 * values using a 32-bit integer representation instead of the equivalent floating-point
00283 * representation.</p>
00284 * <p>If this bitwise operation is used with the current primitive instance that are
00285 * not integers or are too large to fit in a 32-bit integer representation, it simply
00286 * coerces them to 32-bit integers by dropping any fractional part of the value or any
00287 * bits beyond the 32nd.</p>
00288 * @return The bitwise-NOT of the current primitive instance.
00289 * @since 1.0
00290 * @javascript Re-compilers must replace the instance invocation of this method with the
00291 * JavaScript expression:
00292 * <pre>~p</pre>
00293 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00294 */00295 publicfinalintbnot(){00296 returnJs.bnot(var());00297 }00298 00299 /**
00300 * <p>Multiplies the current primitive instance with the operand, resembling the
00301 * multiplication operator in JavaScript.</p>
00302 * <p>If used with non-numeric values, this operation attempts to convert them to
00303 * numbers.</p>
00304 * @param other Any numeric value.
00305 * @return The product of the current primitive instance and the operand.
00306 * @since 1.0
00307 * @javascript Re-compilers must replace the instance invocation of this method with the
00308 * JavaScript expression:
00309 * <pre>p * other</pre>
00310 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00311 */00312 publicfinalNumbermul(Objectother){00313 returnnewNumber(Js.mul(var(),other));00314 }00315 00316 /**
00317 * <p>Divides the current primitive instance by the operand, resembling the division
00318 * operator in JavaScript.</p>
00319 * <p>Used with non-numeric values, this operation attempts to convert them to
00320 * numbers. If you are used to programming languages that distinguish between integer
00321 * and floating-point numbers, you might expect to get an integer result when you
00322 * divide one integer by another. In JavaScript, however, all numbers are floating-point,
00323 * so all division operations have floating-point results. Division by zero yields positive
00324 * or negative infinity, while <tt>0/0</tt> evaluates to <tt>NaN</tt>.</p>
00325 * @param other Any numeric value.
00326 * @return The quotient of the current primitive instance and the operand.
00327 * @since 1.0
00328 * @javascript Re-compilers must replace the instance invocation of this method with the
00329 * JavaScript expression:
00330 * <pre>p / other</pre>
00331 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00332 */00333 publicfinalNumberdiv(Objectother){00334 returnnewNumber(Js.div(var(),other));00335 }00336 00337 /**
00338 * <p>Computes the current primitive instance modulo the operand, resembling the modulo
00339 * operator in JavaScript.</p>
00340 * <p>The operation returns the remainder when the current primitive instance is divided
00341 * by the operand a certain number of times. If used with non-numeric values, the
00342 * operation attempts to convert them to numbers. The sign of the result is the same
00343 * as the sign of the current primitive instance.</p>
00344 * <p>This operation is typically used with integer values, it also works for
00345 * floating-point values.</p>
00346 * @param other Any numeric value.
00347 * @return The remainder.
00348 * @since 1.0
00349 * @javascript Re-compilers must replace the instance invocation of this method with the
00350 * JavaScript expression:
00351 * <pre>p % other</pre>
00352 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00353 */00354 publicfinalNumbermod(Objectother){00355 returnnewNumber(Js.mod(var(),other));00356 }00357 00358 /**
00359 * <p>Subtracts the operand from the current primitive instance, resembling the
00360 * subtraction operator in JavaScript.</p>
00361 * <p>If used with non-numeric values, this operation attempts to convert them to
00362 * numbers.</p>
00363 * @param other Any numeric value.
00364 * @return The difference between the current primitive instance and the operand.
00365 * @since 1.0
00366 * @javascript Re-compilers must replace the instance invocation of this method with the
00367 * JavaScript expression:
00368 * <pre>p - other</pre>
00369 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00370 */00371 publicfinalNumbersub(Objectother){00372 returnnewNumber(Js.sub(var(),other));00373 }00374 00375 /**
00376 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
00377 * a string operand, resembling the addition operator in JavaScript.</p>
00378 * <p>If one value is a string, the other is converted to a string, and the two
00379 * strings are then concatenated. Object operands are converted to numbers or strings
00380 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
00381 * method and/or the {@link Js#toString(Object)} method on the object.</p>
00382 * @param other A value or object.
00383 * @return The sum or concatenation of the values.
00384 * @since 1.0
00385 * @javascript Re-compilers must replace the instance invocation of this method with the
00386 * JavaScript expression:
00387 * <pre>p + other</pre>
00388 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00389 */00390 publicObjectadd(Objectother){00391 returnJs.add(var(),other);00392 }00393 00394 /**
00395 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
00396 * a string operand, resembling the addition operator in JavaScript.</p>
00397 * <p>If one value is a string, the other is converted to a string, and the two
00398 * strings are then concatenated. Object operands are converted to numbers or strings
00399 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
00400 * method and/or the {@link Js#toString(Object)} method on the object.</p>
00401 * @param other A value or object.
00402 * @return The sum or concatenation of the values.
00403 * @since 1.0
00404 * @javascript Re-compilers must replace the instance invocation of this method with the
00405 * JavaScript expression:
00406 * <pre>p + other</pre>
00407 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00408 */00409 publicfinalStringadd(java.lang.Stringother){00410 returnnewString(Js.add(var(),other));00411 }00412 00413 /**
00414 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
00415 * a string operand, resembling the addition operator in JavaScript.</p>
00416 * <p>If one value is a string, the other is converted to a string, and the two
00417 * strings are then concatenated. Object operands are converted to numbers or strings
00418 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
00419 * method and/or the {@link Js#toString(Object)} method on the object.</p>
00420 * @param other A value or object.
00421 * @return The sum or concatenation of the values.
00422 * @since 1.0
00423 * @javascript Re-compilers must replace the instance invocation of this method with the
00424 * JavaScript expression:
00425 * <pre>p + other</pre>
00426 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00427 */00428 publicfinalStringadd(Var<java.lang.String>other){00429 returnnewString(Js.add(var(),other));00430 }00431 00432 /**
00433 * <p>Shift-left operation, resembling that of JavaScript, moves all bits in the
00434 * current primitive instance to the left by the number of places specified in the
00435 * second operand, which should be an integer between 0 and 31.</p>
00436 * <p>A zero is used for the new first bit, and the value of the 32nd bit is lost.
00437 * Shifting a value left by one position is equivalent to multiplying by 2, shifting
00438 * two positions is equivalent to multiplying by 4, etc.</p>
00439 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
00440 * operation requires numeric operands that have integer values. It operate on the integer
00441 * operands using a 32-bit integer representation instead of the equivalent floating-point
00442 * representation.</p>
00443 * <p>If this bitwise operation is used with values that are not integers or are too
00444 * large to fit in a 32-bit integer representation, it simply coerces the values to
00445 * 32-bit integers by dropping any fractional part of the value or any bits beyond
00446 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
00447 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
00448 * yields a number in the appropriate range.</p>
00449 * @param n The number of bits to shift.
00450 * @return The shifted integer number.
00451 * @since 1.0
00452 * @javascript Re-compilers must replace the instance invocation of this method with the
00453 * JavaScript expression:
00454 * <pre>p << n</pre>
00455 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00456 */00457 publicfinalIntegershl(intn){00458 returnnewInteger(Js.shl(var(),n));00459 }00460 00461 /**
00462 * <p>Shift-right operation, resembling that of JavaScript, moves all bits in the
00463 * current primitive instance to the right by the number of places specified in the
00464 * second operand (an integer between 0 and 31). Bits that are shifted off the right
00465 * are lost. The bits filled in on the left depend on the sign bit of the original
00466 * value, in order to preserve the sign of the result. If the current primitive
00467 * instance is positive, the result has zeros placed in the high bits; if the current
00468 * primitive instance is negative, the result has ones placed in the high bits.</p>
00469 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
00470 * remainder), shifting right two places is equivalent to integer division by 4, and
00471 * so on.</p>
00472 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
00473 * operation requires numeric operands that have integer values. It operate on the integer
00474 * operands using a 32-bit integer representation instead of the equivalent floating-point
00475 * representation.</p>
00476 * <p>If this bitwise operation is used with values that are not integers or are too
00477 * large to fit in a 32-bit integer representation, it simply coerces the values to
00478 * 32-bit integers by dropping any fractional part of the value or any bits beyond
00479 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
00480 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
00481 * yields a number in the appropriate range.</p>
00482 * @param n The number of bits to shift.
00483 * @return The shifted integer number.
00484 * @since 1.0
00485 * @javascript Re-compilers must replace the instance invocation of this method with the
00486 * JavaScript expression:
00487 * <pre>p >> n</pre>
00488 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00489 */00490 publicfinalIntegershr(intn){00491 returnnewInteger(Js.shr(var(),n));00492 }00493 00494 /**
00495 * <p>Shift-right-unsigned operation, resembling that of JavaScript, moves all bits in
00496 * the current primitive instance to the right by the number of places specified in the
00497 * second operand (an integer between 0 and 31). Bits that are shifted off the right
00498 * are lost. The result has zeros placed in the high bits.</p>
00499 * <p>This operation is just like {@link #shr(int)}, except that the bits shifted
00500 * in on the left are always zero, regardless of the sign of the current primitive instance.</p>
00501 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
00502 * remainder), shifting right two places is equivalent to integer division by 4, and
00503 * so on.</p>
00504 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
00505 * operation requires numeric operands that have integer values. It operate on the integer
00506 * operands using a 32-bit integer representation instead of the equivalent floating-point
00507 * representation.</p>
00508 * <p>If this bitwise operation is used with values that are not integers or are too
00509 * large to fit in a 32-bit integer representation, it simply coerces the values to
00510 * 32-bit integers by dropping any fractional part of the value or any bits beyond
00511 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
00512 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
00513 * yields a number in the appropriate range.</p>
00514 * @param n The number of bits to shift.
00515 * @return The shifted integer number.
00516 * @since 1.0
00517 * @javascript Re-compilers must replace the instance invocation of this method with the
00518 * JavaScript expression:
00519 * <pre>p >>> n</pre>
00520 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00521 */00522 publicfinalIntegershru(intn){00523 returnnewInteger(Js.shru(var(),n));00524 }00525 00526 /**
00527 * <p>Less-than operation, resembling that of JavaScript, evaluates to <tt>true</tt> if
00528 * the current primitive instance is less than the second operand; otherwise it
00529 * evaluates to <tt>false</tt>.</p>
00530 * <p>The operands of this operation may be of any type. Comparison can be performed
00531 * only on numbers and strings, however, so operands that are not numbers or strings
00532 * are converted. Comparison and conversion occur as follows:</p>
00533 * <ul>
00534 * <li>If both operands are numbers, or if both convert to numbers, they are compared
00535 * numerically.</li>
00536 * <li>If both operands are strings or convert to strings, they are compared as
00537 * strings.</li>
00538 * <li>If one operand is or converts to a string, and one is or converts to a number,
00539 * the operation attempts to convert the string to a number and performs a numerical
00540 * comparison. If the string does not represent a number, it converts to <tt>NaN</tt>,
00541 * and the comparison is <tt>false</tt>. In JavaScript 1.1, the string-to-number
00542 * conversion causes an error instead of yielding <tt>NaN</tt>.</li>
00543 * <li>If an object can be converted to either a number or a string, JavaScript performs
00544 * the numerical conversion. This means, for example, that Date objects are compared
00545 * numerically, and it is meaningful to compare two dates to see whether one is earlier
00546 * than the other.</li>
00547 * <li>If the operands of the comparison operations cannot both be successfully converted
00548 * to numbers or to strings, these operations always return <tt>false</tt>.</li>
00549 * <li>If either operand is or converts to <tt>NaN</tt>, the comparison operation always
00550 * yields <tt>false</tt>.</li>
00551 * </ul>
00552 * <p>Keep in mind that string comparison is done on a strict character-by-character
00553 * basis using the numerical value of each character from the Unicode encoding. Although
00554 * in some cases the Unicode standard allows equivalent strings to be encoded using
00555 * different sequences of characters, the JavaScript comparison operations do not
00556 * detect these encoding differences; they assume that all strings are expressed in
00557 * normalized form. Note in particular that string comparison is case-sensitive, and
00558 * in the Unicode encoding (at least for the ASCII subset), all capital letters are
00559 * "less than" all lowercase letters. This rule can cause confusing results if you do
00560 * not expect it.</p>
00561 * <p>For a more robust string-comparison algorithm, see the {@link StringLike#localeCompare(Object)}
00562 * method, which also takes locale-specific definitions of alphabetical order into account.
00563 * For case-insensitive comparisons, you must first convert the strings to all lowercase or
00564 * all uppercase using {@link StringLike#toLowerCase()} or {@link StringLike#toUpperCase()}.</p>
00565 * <p>The less-than-or-equal and greater-than-or-equal operations do not rely on the
00566 * equality or identity operations for determining whether two values are "equal."
00567 * Instead, the less-than-or-equal operator is simply defined as "not greater than",
00568 * and the greater-than-or-equal operator is defined as "not less than". The one
00569 * exception occurs when either operand is (or converts to) <tt>NaN</tt>, in which case
00570 * all comparison operations return <tt>false</tt>.</p>
00571 * @param other A value or object.
00572 * @return <tt>true</tt> if the current primitive instance is less than the second
00573 * operand; otherwise <tt>false</tt>.
00574 * @since 1.0
00575 * @javascript Re-compilers must replace the instance invocation of this method with the
00576 * JavaScript expression:
00577 * <pre>p < other</pre>
00578 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00579 */00580 publicfinalBooleanlt(Objectother){00581 returnnewBoolean(Js.lt(var(),other));00582 }00583 00584 /**
00585 * <p>Greater-than operation, resembling that of JavaScript, evaluates to <tt>true</tt> if
00586 * the current primitive instance is greater than the second operand; otherwise it
00587 * evaluates to <tt>false</tt>.</p>
00588 * <p>The operands of this operation may be of any type. Comparison can be performed
00589 * only on numbers and strings, however, so operands that are not numbers or strings
00590 * are converted. Comparison and conversion occur as follows:</p>
00591 * <ul>
00592 * <li>If both operands are numbers, or if both convert to numbers, they are compared
00593 * numerically.</li>
00594 * <li>If both operands are strings or convert to strings, they are compared as
00595 * strings.</li>
00596 * <li>If one operand is or converts to a string, and one is or converts to a number,
00597 * the operation attempts to convert the string to a number and performs a numerical
00598 * comparison. If the string does not represent a number, it converts to <tt>NaN</tt>,
00599 * and the comparison is <tt>false</tt>. In JavaScript 1.1, the string-to-number
00600 * conversion causes an error instead of yielding <tt>NaN</tt>.</li>
00601 * <li>If an object can be converted to either a number or a string, JavaScript performs
00602 * the numerical conversion. This means, for example, that Date objects are compared
00603 * numerically, and it is meaningful to compare two dates to see whether one is earlier
00604 * than the other.</li>
00605 * <li>If the operands of the comparison operations cannot both be successfully converted
00606 * to numbers or to strings, these operations always return <tt>false</tt>.</li>
00607 * <li>If either operand is or converts to <tt>NaN</tt>, the comparison operation always
00608 * yields <tt>false</tt>.</li>
00609 * </ul>
00610 * <p>Keep in mind that string comparison is done on a strict character-by-character
00611 * basis using the numerical value of each character from the Unicode encoding. Although
00612 * in some cases the Unicode standard allows equivalent strings to be encoded using
00613 * different sequences of characters, the JavaScript comparison operations do not
00614 * detect these encoding differences; they assume that all strings are expressed in
00615 * normalized form. Note in particular that string comparison is case-sensitive, and
00616 * in the Unicode encoding (at least for the ASCII subset), all capital letters are
00617 * "less than" all lowercase letters. This rule can cause confusing results if you do
00618 * not expect it.</p>
00619 * <p>For a more robust string-comparison algorithm, see the {@link StringLike#localeCompare(Object)}
00620 * method, which also takes locale-specific definitions of alphabetical order into account.
00621 * For case-insensitive comparisons, you must first convert the strings to all lowercase or
00622 * all uppercase using {@link StringLike#toLowerCase()} or {@link StringLike#toUpperCase()}.</p>
00623 * <p>The less-than-or-equal and greater-than-or-equal operations do not rely on the
00624 * equality or identity operations for determining whether two values are "equal."
00625 * Instead, the less-than-or-equal operator is simply defined as "not greater than",
00626 * and the greater-than-or-equal operator is defined as "not less than". The one
00627 * exception occurs when either operand is (or converts to) <tt>NaN</tt>, in which case
00628 * all comparison operations return <tt>false</tt>.</p>
00629 * @param other A value or object.
00630 * @return <tt>true</tt> if the current primitive instance is greater than the second
00631 * operand; otherwise <tt>false</tt>.
00632 * @since 1.0
00633 * @javascript Re-compilers must replace the instance invocation of this method with the
00634 * JavaScript expression:
00635 * <pre>p > other</pre>
00636 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00637 */00638 publicfinalBooleangt(Objectother){00639 returnnewBoolean(Js.gt(var(),other));00640 }00641 00642 /**
00643 * <p>Less-than-or-equal operation, resembling that of JavaScript, evaluates to
00644 * <tt>true</tt> if the current primitive instance is less than or equal to the second
00645 * operand; otherwise it evaluates to <tt>false</tt>.</p>
00646 * <p>The operands of this operation may be of any type. Comparison can be performed
00647 * only on numbers and strings, however, so operands that are not numbers or strings
00648 * are converted. Comparison and conversion occur as follows:</p>
00649 * <ul>
00650 * <li>If both operands are numbers, or if both convert to numbers, they are compared
00651 * numerically.</li>
00652 * <li>If both operands are strings or convert to strings, they are compared as
00653 * strings.</li>
00654 * <li>If one operand is or converts to a string, and one is or converts to a number,
00655 * the operation attempts to convert the string to a number and performs a numerical
00656 * comparison. If the string does not represent a number, it converts to <tt>NaN</tt>,
00657 * and the comparison is <tt>false</tt>. In JavaScript 1.1, the string-to-number
00658 * conversion causes an error instead of yielding <tt>NaN</tt>.</li>
00659 * <li>If an object can be converted to either a number or a string, JavaScript performs
00660 * the numerical conversion. This means, for example, that Date objects are compared
00661 * numerically, and it is meaningful to compare two dates to see whether one is earlier
00662 * than the other.</li>
00663 * <li>If the operands of the comparison operations cannot both be successfully converted
00664 * to numbers or to strings, these operations always return <tt>false</tt>.</li>
00665 * <li>If either operand is or converts to <tt>NaN</tt>, the comparison operation always
00666 * yields <tt>false</tt>.</li>
00667 * </ul>
00668 * <p>Keep in mind that string comparison is done on a strict character-by-character
00669 * basis using the numerical value of each character from the Unicode encoding. Although
00670 * in some cases the Unicode standard allows equivalent strings to be encoded using
00671 * different sequences of characters, the JavaScript comparison operations do not
00672 * detect these encoding differences; they assume that all strings are expressed in
00673 * normalized form. Note in particular that string comparison is case-sensitive, and
00674 * in the Unicode encoding (at least for the ASCII subset), all capital letters are
00675 * "less than" all lowercase letters. This rule can cause confusing results if you do
00676 * not expect it.</p>
00677 * <p>For a more robust string-comparison algorithm, see the {@link StringLike#localeCompare(Object)}
00678 * method, which also takes locale-specific definitions of alphabetical order into account.
00679 * For case-insensitive comparisons, you must first convert the strings to all lowercase or
00680 * all uppercase using {@link StringLike#toLowerCase()} or {@link StringLike#toUpperCase()}.</p>
00681 * <p>The less-than-or-equal and greater-than-or-equal operations do not rely on the
00682 * equality or identity operations for determining whether two values are "equal."
00683 * Instead, the less-than-or-equal operator is simply defined as "not greater than",
00684 * and the greater-than-or-equal operator is defined as "not less than". The one
00685 * exception occurs when either operand is (or converts to) <tt>NaN</tt>, in which case
00686 * all comparison operations return <tt>false</tt>.</p>
00687 * @param other A value or object.
00688 * @return <tt>true</tt> if the current primitive instance is less than or equal to
00689 * the second operand; otherwise <tt>false</tt>.
00690 * @since 1.0
00691 * @javascript Re-compilers must replace the instance invocation of this method with the
00692 * JavaScript expression:
00693 * <pre>p <= other</pre>
00694 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00695 */00696 publicfinalBooleanlte(Objectother){00697 returnnewBoolean(Js.lte(var(),other));00698 }00699 00700 /**
00701 * <p>Greater-than-or-equal operation, resembling that of JavaScript, evaluates to
00702 * <tt>true</tt> if the current primitive instance is greater than or equal to the
00703 * second operand; otherwise it evaluates to <tt>false</tt>.</p>
00704 * <p>The operands of this operation may be of any type. Comparison can be performed
00705 * only on numbers and strings, however, so operands that are not numbers or strings
00706 * are converted. Comparison and conversion occur as follows:</p>
00707 * <ul>
00708 * <li>If both operands are numbers, or if both convert to numbers, they are compared
00709 * numerically.</li>
00710 * <li>If both operands are strings or convert to strings, they are compared as
00711 * strings.</li>
00712 * <li>If one operand is or converts to a string, and one is or converts to a number,
00713 * the operation attempts to convert the string to a number and performs a numerical
00714 * comparison. If the string does not represent a number, it converts to <tt>NaN</tt>,
00715 * and the comparison is <tt>false</tt>. In JavaScript 1.1, the string-to-number
00716 * conversion causes an error instead of yielding <tt>NaN</tt>.</li>
00717 * <li>If an object can be converted to either a number or a string, JavaScript performs
00718 * the numerical conversion. This means, for example, that Date objects are compared
00719 * numerically, and it is meaningful to compare two dates to see whether one is earlier
00720 * than the other.</li>
00721 * <li>If the operands of the comparison operations cannot both be successfully converted
00722 * to numbers or to strings, these operations always return <tt>false</tt>.</li>
00723 * <li>If either operand is or converts to <tt>NaN</tt>, the comparison operation always
00724 * yields <tt>false</tt>.</li>
00725 * </ul>
00726 * <p>Keep in mind that string comparison is done on a strict character-by-character
00727 * basis using the numerical value of each character from the Unicode encoding. Although
00728 * in some cases the Unicode standard allows equivalent strings to be encoded using
00729 * different sequences of characters, the JavaScript comparison operations do not
00730 * detect these encoding differences; they assume that all strings are expressed in
00731 * normalized form. Note in particular that string comparison is case-sensitive, and
00732 * in the Unicode encoding (at least for the ASCII subset), all capital letters are
00733 * "less than" all lowercase letters. This rule can cause confusing results if you do
00734 * not expect it.</p>
00735 * <p>For a more robust string-comparison algorithm, see the {@link StringLike#localeCompare(Object)}
00736 * method, which also takes locale-specific definitions of alphabetical order into account.
00737 * For case-insensitive comparisons, you must first convert the strings to all lowercase or
00738 * all uppercase using {@link StringLike#toLowerCase()} or {@link StringLike#toUpperCase()}.</p>
00739 * <p>The less-than-or-equal and greater-than-or-equal operations do not rely on the
00740 * equality or identity operations for determining whether two values are "equal."
00741 * Instead, the less-than-or-equal operator is simply defined as "not greater than",
00742 * and the greater-than-or-equal operator is defined as "not less than". The one
00743 * exception occurs when either operand is (or converts to) <tt>NaN</tt>, in which case
00744 * all comparison operations return <tt>false</tt>.</p>
00745 * @param other A value or object.
00746 * @return <tt>true</tt> if the current primitive instance is greater than or equal to
00747 * the second operand; otherwise <tt>false</tt>.
00748 * @since 1.0
00749 * @javascript Re-compilers must replace the instance invocation of this method with the
00750 * JavaScript expression:
00751 * <pre>p >= other</pre>
00752 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00753 */00754 publicfinalBooleangte(Objectother){00755 returnnewBoolean(Js.gte(var(),other));00756 }00757 00758 /**
00759 * <p>Checks if the current primitive instance is the name of a property of the second
00760 * operand, resembling the <tt>in</tt> operator in JavaScript.</p>
00761 * <p>This operation converts the current primitive instance to a string and expects
00762 * the second operand be an object (or array).</p>
00763 * @param other Any object or array.
00764 * @return <tt>true</tt> if the current primitive instance is the name of a property of
00765 * the second operand; <tt>false</tt>, otherwise;
00766 * @since 1.0
00767 * @javascript Re-compilers must replace the instance invocation of this method with the
00768 * JavaScript expression:
00769 * <pre>p in other</pre>
00770 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00771 */00772 publicfinalBooleanin(Objectother){00773 returnnewBoolean(Js.in(var(),other));00774 }00775 00776 /**
00777 * <p>Checks if the current primitive instance is an instance of the second operand,
00778 * resembling the <tt>instanceof</tt> operator in JavaScript.</p>
00779 * <p>This operation expects the first operand be an object and the second be a class
00780 * of objects. In JavaScript, classes of objects are defined by the constructor function
00781 * that initializes them.</p>
00782 * @param other A constructor function.
00783 * @return <tt>true</tt> if the current primitive instance is an instance of the second
00784 * operand; <tt>false</tt>, otherwise;
00785 * @since 1.0
00786 * @javascript Re-compilers must replace the instance invocation of this method with the
00787 * JavaScript expression:
00788 * <pre>p instanceof other</pre>
00789 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00790 */00791 publicfinalBooleaninstanceOf(Objectother){00792 returnnewBoolean(Js.instanceOf(var(),other));00793 }00794 00795 /**
00796 * <p>Checks whether the two operands are "equal" using a more relaxed definition of
00797 * sameness that allows type conversions, resembling the equality operator in
00798 * JavaScript.</p>
00799 * <p>The equality and identity operations check whether two values are the same, using
00800 * two different definitions of sameness. Both operations accept operands of any type,
00801 * and both return <tt>true</tt> if their operands are the same and <tt>false</tt>
00802 * if they are different. The identity operation checks whether its two operands are
00803 * "identical" using a strict definition of sameness. The equality operation checks
00804 * whether its two operands are "equal" using a more relaxed definition of sameness
00805 * that allows type conversions.</p>
00806 * <p>The identity operation is standardized by ECMAScript v3 and implemented in
00807 * JavaScript 1.3 and later. Be sure you understand the differences between the
00808 * assignment, equality, and identity operations, and be careful to use the correct one
00809 * when coding! Although it is tempting to call all three operations "equals," it may
00810 * help to reduce confusion if you read "gets or is assigned" for assignment operation,
00811 * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
00812 * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this
00813 * case, two separate values are involved, and the equality and identity operations
00814 * check that these two values are identical. This means that two variables are equal
00815 * or identical only if they contain the same value. For example, two strings are equal
00816 * only if they each contain exactly the same characters.</p>
00817 * <p>On the other hand, objects, arrays, and functions are compared by reference. This
00818 * means that two variables are equal only if they refer to the same object. Two
00819 * separate arrays are never equal or identical, even if they contain equal or identical
00820 * elements. Two variables that contain references to objects, arrays, or functions are
00821 * equal only if they refer to the same object, array, or function. If you want to test
00822 * that two distinct objects contain the same properties or that two distinct arrays
00823 * contain the same elements, you'll have to check the properties or elements individually
00824 * for equality or identity. And, if any of the properties or elements are themselves
00825 * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
00826 * <p>The following rules determine whether two values are equal according to the
00827 * equality operation:
00828 * <ul>
00829 * <li>If the two values have the same type, test them for identity. If the values are
00830 * identical, they are equal; if they are not identical, they are not equal.</li>
00831 * <li>If the two values do not have the same type, they may still be equal. Use the
00832 * following rules and type conversions to check for equality:</li>
00833 * <ul>
00834 * <li>If one value is null and the other is undefined, they are equal.</li>
00835 * <li>If one value is a number and the other is a string, convert the string to a
00836 * number and try the comparison again, using the converted value.</li>
00837 * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison
00838 * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison
00839 * again.</li>
00840 * <li>If one value is an object and the other is a number or string, convert the
00841 * object to a primitive and try the comparison again. An object is converted to a
00842 * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt>
00843 * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt>
00844 * conversion before <tt>toString()</tt> conversion, except for the Date class,
00845 * which performs <tt>toString()</tt> conversion. Objects that are not part of core
00846 * JavaScript may convert themselves to primitive values in an implementation-defined
00847 * way.</li>
00848 * <li>Any other combinations of values are not equal.</li>
00849 * </ul>
00850 * </ul>
00851 * @param other Any value or object.
00852 * @return <tt>true</tt> if the first operand equals the second; <tt>false</tt>,
00853 * otherwise;
00854 * @since 1.0
00855 * @javascript Re-compilers must replace the instance invocation of this method with the
00856 * JavaScript expression:
00857 * <pre>p == other</pre>
00858 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00859 */00860 publicfinalBooleaneq(Objectother){00861 returnnewBoolean(Js.eq(var(),other));00862 }00863 00864 /**
00865 * <p>Checks whether the two operands are "identical" using a strict definition of
00866 * sameness, resembling the identity operator in JavaScript.</p>
00867 * <p>The equality and identity operations check whether two values are the same, using
00868 * two different definitions of sameness. Both operations accept operands of any type,
00869 * and both return <tt>true</tt> if their operands are the same and <tt>false</tt>
00870 * if they are different. The identity operation checks whether its two operands are
00871 * "identical" using a strict definition of sameness. The equality operation checks
00872 * whether its two operands are "equal" using a more relaxed definition of sameness
00873 * that allows type conversions.</p>
00874 * <p>The identity operation is standardized by ECMAScript v3 and implemented in
00875 * JavaScript 1.3 and later. Be sure you understand the differences between the
00876 * assignment, equality, and identity operations, and be careful to use the correct one
00877 * when coding! Although it is tempting to call all three operations "equals," it may
00878 * help to reduce confusion if you read "gets or is assigned" for assignment operation,
00879 * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
00880 * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this
00881 * case, two separate values are involved, and the equality and identity operations
00882 * check that these two values are identical. This means that two variables are equal
00883 * or identical only if they contain the same value. For example, two strings are equal
00884 * only if they each contain exactly the same characters.</p>
00885 * <p>On the other hand, objects, arrays, and functions are compared by reference. This
00886 * means that two variables are equal only if they refer to the same object. Two
00887 * separate arrays are never equal or identical, even if they contain equal or identical
00888 * elements. Two variables that contain references to objects, arrays, or functions are
00889 * equal only if they refer to the same object, array, or function. If you want to test
00890 * that two distinct objects contain the same properties or that two distinct arrays
00891 * contain the same elements, you'll have to check the properties or elements individually
00892 * for equality or identity. And, if any of the properties or elements are themselves
00893 * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
00894 * <p>The following rules determine whether two values are identical according to the identity operation:
00895 * <ul>
00896 * <li>If the two values have different types, they are not identical.</li>
00897 * <li>If both values are numbers and have the same value, they are identical, unless
00898 * either or both values are <tt>NaN</tt>, in which case they are not identical.
00899 * The <tt>NaN</tt> value is never identical to any other value, including itself!
00900 * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)}
00901 * function.</li>
00902 * <li>If both values are strings and contain exactly the same characters in the same
00903 * positions, they are identical. If the strings differ in length or content, they are
00904 * not identical. Note that in some cases, the Unicode standard allows more than one
00905 * way to encode the same string. For efficiency, however, JavaScript's string
00906 * comparison compares strictly on a character-by-character basis, and it assumes that
00907 * all strings have been converted to a "normalized form" before they are compared.
00908 * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
00909 * <li>If both values are the boolean value <tt>true</tt> or both are the boolean
00910 * value <tt>false</tt>, they are identical.</li>
00911 * <li>If both values refer to the same object, array, or function, they are identical.
00912 * If they refer to different objects (or arrays or functions) they are not identical,
00913 * even if both objects have identical properties or both arrays have identical elements.</li>
00914 * <li>If both values are null or both values are undefined, they are identical.</li>
00915 * </ul>
00916 * @param other Any value or object.
00917 * @return <tt>true</tt> if the first operand is identical to the second;
00918 * <tt>false</tt>, otherwise;
00919 * @since 1.0
00920 * @javascript Re-compilers must replace the instance invocation of this method with the
00921 * JavaScript expression:
00922 * <pre>p === other</pre>
00923 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00924 */00925 publicfinalBooleaneqs(Objectother){00926 returnnewBoolean(Js.eqs(var(),other));00927 }00928 00929 /**
00930 * <p>Checks whether the two operands are not "equal" using a more relaxed definition of
00931 * sameness that allows type conversions, resembling the equality operator in
00932 * JavaScript.</p>
00933 * <p>The equality and identity operations check whether two values are the same, using
00934 * two different definitions of sameness. Both operations accept operands of any type,
00935 * and both return <tt>true</tt> if their operands are the same and <tt>false</tt>
00936 * if they are different. The identity operation checks whether its two operands are
00937 * "identical" using a strict definition of sameness. The equality operation checks
00938 * whether its two operands are "equal" using a more relaxed definition of sameness
00939 * that allows type conversions.</p>
00940 * <p>The identity operation is standardized by ECMAScript v3 and implemented in
00941 * JavaScript 1.3 and later. Be sure you understand the differences between the
00942 * assignment, equality, and identity operations, and be careful to use the correct one
00943 * when coding! Although it is tempting to call all three operations "equals," it may
00944 * help to reduce confusion if you read "gets or is assigned" for assignment operation,
00945 * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
00946 * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this
00947 * case, two separate values are involved, and the equality and identity operations
00948 * check that these two values are identical. This means that two variables are equal
00949 * or identical only if they contain the same value. For example, two strings are equal
00950 * only if they each contain exactly the same characters.</p>
00951 * <p>On the other hand, objects, arrays, and functions are compared by reference. This
00952 * means that two variables are equal only if they refer to the same object. Two
00953 * separate arrays are never equal or identical, even if they contain equal or identical
00954 * elements. Two variables that contain references to objects, arrays, or functions are
00955 * equal only if they refer to the same object, array, or function. If you want to test
00956 * that two distinct objects contain the same properties or that two distinct arrays
00957 * contain the same elements, you'll have to check the properties or elements individually
00958 * for equality or identity. And, if any of the properties or elements are themselves
00959 * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
00960 * <p>The following rules determine whether two values are equal according to the
00961 * equality operation:
00962 * <ul>
00963 * <li>If the two values have the same type, test them for identity. If the values are
00964 * identical, they are equal; if they are not identical, they are not equal.</li>
00965 * <li>If the two values do not have the same type, they may still be equal. Use the
00966 * following rules and type conversions to check for equality:</li>
00967 * <ul>
00968 * <li>If one value is null and the other is undefined, they are equal.</li>
00969 * <li>If one value is a number and the other is a string, convert the string to a
00970 * number and try the comparison again, using the converted value.</li>
00971 * <li>If either value is <tt>true</tt>, convert it to 1 and try the comparison
00972 * again. If either value is <tt>false</tt>, convert it to 0 and try the comparison
00973 * again.</li>
00974 * <li>If one value is an object and the other is a number or string, convert the
00975 * object to a primitive and try the comparison again. An object is converted to a
00976 * primitive value by either its <tt>toString()</tt> method or its <tt>valueOf()</tt>
00977 * method. The built-in classes of core JavaScript attempt <tt>valueOf()</tt>
00978 * conversion before <tt>toString()</tt> conversion, except for the Date class,
00979 * which performs <tt>toString()</tt> conversion. Objects that are not part of core
00980 * JavaScript may convert themselves to primitive values in an implementation-defined
00981 * way.</li>
00982 * <li>Any other combinations of values are not equal.</li>
00983 * </ul>
00984 * </ul>
00985 * @param other Any value or object.
00986 * @return <tt>false</tt> if the first operand equals the second; <tt>true</tt>,
00987 * otherwise;
00988 * @since 1.0
00989 * @javascript Re-compilers must replace the instance invocation of this method with the
00990 * JavaScript expression:
00991 * <pre>p != other</pre>
00992 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
00993 */00994 publicfinalBooleanneq(Objectother){00995 returnnewBoolean(Js.neq(var(),other));00996 }00997 00998 /**
00999 * <p>Checks whether the two operands are not "identical" using a strict definition of
01000 * sameness, resembling the identity operator in JavaScript.</p>
01001 * <p>The equality and identity operations check whether two values are the same, using
01002 * two different definitions of sameness. Both operations accept operands of any type,
01003 * and both return <tt>true</tt> if their operands are the same and <tt>false</tt>
01004 * if they are different. The identity operation checks whether its two operands are
01005 * "identical" using a strict definition of sameness. The equality operation checks
01006 * whether its two operands are "equal" using a more relaxed definition of sameness
01007 * that allows type conversions.</p>
01008 * <p>The identity operation is standardized by ECMAScript v3 and implemented in
01009 * JavaScript 1.3 and later. Be sure you understand the differences between the
01010 * assignment, equality, and identity operations, and be careful to use the correct one
01011 * when coding! Although it is tempting to call all three operations "equals," it may
01012 * help to reduce confusion if you read "gets or is assigned" for assignment operation,
01013 * "is equal to" for equality operation, and "is identical to" for identity operation.</p>
01014 * <p>In JavaScript, numbers, strings, and boolean values are compared by value. In this
01015 * case, two separate values are involved, and the equality and identity operations
01016 * check that these two values are identical. This means that two variables are equal
01017 * or identical only if they contain the same value. For example, two strings are equal
01018 * only if they each contain exactly the same characters.</p>
01019 * <p>On the other hand, objects, arrays, and functions are compared by reference. This
01020 * means that two variables are equal only if they refer to the same object. Two
01021 * separate arrays are never equal or identical, even if they contain equal or identical
01022 * elements. Two variables that contain references to objects, arrays, or functions are
01023 * equal only if they refer to the same object, array, or function. If you want to test
01024 * that two distinct objects contain the same properties or that two distinct arrays
01025 * contain the same elements, you'll have to check the properties or elements individually
01026 * for equality or identity. And, if any of the properties or elements are themselves
01027 * objects or arrays, you'll have to decide how deep you want the comparison to go.</p>
01028 * <p>The following rules determine whether two values are identical according to the identity operation:
01029 * <ul>
01030 * <li>If the two values have different types, they are not identical.</li>
01031 * <li>If both values are numbers and have the same value, they are identical, unless
01032 * either or both values are <tt>NaN</tt>, in which case they are not identical.
01033 * The <tt>NaN</tt> value is never identical to any other value, including itself!
01034 * To check whether a value is <tt>NaN</tt>, use the global {@link Js#isNaN(Object)}
01035 * function.</li>
01036 * <li>If both values are strings and contain exactly the same characters in the same
01037 * positions, they are identical. If the strings differ in length or content, they are
01038 * not identical. Note that in some cases, the Unicode standard allows more than one
01039 * way to encode the same string. For efficiency, however, JavaScript's string
01040 * comparison compares strictly on a character-by-character basis, and it assumes that
01041 * all strings have been converted to a "normalized form" before they are compared.
01042 * See the {@link StringLike#localeCompare(Object)} for another way to compare strings.</li>
01043 * <li>If both values are the boolean value <tt>true</tt> or both are the boolean
01044 * value <tt>false</tt>, they are identical.</li>
01045 * <li>If both values refer to the same object, array, or function, they are identical.
01046 * If they refer to different objects (or arrays or functions) they are not identical,
01047 * even if both objects have identical properties or both arrays have identical elements.</li>
01048 * <li>If both values are null or both values are undefined, they are identical.</li>
01049 * </ul>
01050 * @param other Any value or object.
01051 * @return <tt>false</tt> if the first operand is identical to the second;
01052 * <tt>true</tt>, otherwise;
01053 * @since 1.0
01054 * @javascript Re-compilers must replace the instance invocation of this method with the
01055 * JavaScript expression:
01056 * <pre>p !== other</pre>
01057 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01058 */01059 publicfinalBooleanneqs(Objectother){01060 returnnewBoolean(Js.neqs(var(),other));01061 }01062 01063 /**
01064 * <p>Bitwise-AND operation, resembling that of JavaScript, performs a boolean AND
01065 * operation on each bit of the integer arguments. A bit is set in the result only if
01066 * the corresponding bit is set in both operands.</p>
01067 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
01068 * operation requires numeric operands that have integer values. It operate on the integer
01069 * operands using a 32-bit integer representation instead of the equivalent floating-point
01070 * representation.</p>
01071 * <p>If this bitwise operation is used with operands that are not integers or are too
01072 * large to fit in a 32-bit integer representation, it simply coerces the operands to
01073 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
01074 * the 32nd.</p>
01075 * @param other A numeric value.
01076 * @return The bitwise-AND of the two operands.
01077 * @since 1.0
01078 * @javascript Re-compilers must replace the instance invocation of this method with the
01079 * JavaScript expression:
01080 * <pre>p & other</pre>
01081 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01082 */01083 publicfinalIntegerband(Objectother){01084 returnnewInteger(Js.band(var(),other));01085 }01086 01087 /**
01088 * <p>Bitwise-OR operation, resembling that of JavaScript, performs a boolean OR operation
01089 * on each bit of the integer arguments. A bit is set in the result if the corresponding
01090 * bit is set in one or both of the operands.</p>
01091 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
01092 * operation requires numeric operands that have integer values. It operate on the integer
01093 * operands using a 32-bit integer representation instead of the equivalent floating-point
01094 * representation.</p>
01095 * <p>If this bitwise operation is used with operands that are not integers or are too
01096 * large to fit in a 32-bit integer representation, it simply coerces the operands to
01097 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
01098 * the 32nd.</p>
01099 * @param other A numeric value.
01100 * @return The bitwise-OR of the two operands.
01101 * @since 1.0
01102 * @javascript Re-compilers must replace the instance invocation of this method with the
01103 * JavaScript expression:
01104 * <pre>p | other</pre>
01105 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01106 */01107 publicfinalIntegerbor(Objectother){01108 returnnewInteger(Js.bor(this,other));01109 }01110 01111 /**
01112 * <p>Bitwise-XOR operation, resembling that of JavaScript, performs a boolean exclusive
01113 * OR operation on each bit of the integer arguments. Exclusive OR means that either
01114 * operand one is <tt>true</tt> or operand two is <tt>true</tt>, but not both. A bit is
01115 * set in this operation's result if a corresponding bit is set in one (but not both)
01116 * of the two operands.</p>
01117 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
01118 * operation requires numeric operands that have integer values. It operate on the integer
01119 * operands using a 32-bit integer representation instead of the equivalent floating-point
01120 * representation.</p>
01121 * <p>If this bitwise operation is used with operands that are not integers or are too
01122 * large to fit in a 32-bit integer representation, it simply coerces the operands to
01123 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
01124 * the 32nd.</p>
01125 * @param other A numeric value.
01126 * @return The bitwise-exclusive-OR of the two operands.
01127 * @since 1.0
01128 * @javascript Re-compilers must replace the instance invocation of this method with the
01129 * JavaScript expression:
01130 * <pre>p ^ other</pre>
01131 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01132 */01133 publicfinalIntegerxor(Objectother){01134 returnnewInteger(Js.xor(this,other));01135 }01136 01137 /**
01138 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
01139 * operation on the two values: it returns <tt>true</tt> if and only if both its first
01140 * operand and its second operand are <tt>true</tt>. If one or both of these operands
01141 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
01142 * <p>In JavaScript, depending on the value of the left-side expression, the operator
01143 * may or may not evaluate the right-side expression. The actual behavior of the operator
01144 * is somewhat more complicated. It starts by evaluating its first operand, the expression
01145 * on its left. If the value of this expression can be converted to <tt>false</tt>
01146 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
01147 * the operator returns the value of the left-side expression. Otherwise, it evaluates
01148 * its second operand, the expression on its right, and returns the value of that
01149 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
01150 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
01151 * returning the unconverted value of the left-side expression.</p>
01152 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
01153 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
01154 * anonymously, returning the actual expression in the method overriding
01155 * {@link Var#var()}.</p>
01156 * <p>Sometimes, this operation probably does not do what the programmers intended.
01157 * To avoid problems, do not use expressions with side effects (assignments, increments,
01158 * decrements, and function calls) for the second operand unless you are quite sure
01159 * you know exactly what you are doing.</p>
01160 * <p>Despite the fairly confusing way that this operation actually works, it is
01161 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
01162 * Although it does not actually return a boolean value, the value it returns can always
01163 * be converted to a boolean value.</p>
01164 * <p>Note that, this method is probably useful in emulation codes just for perfect
01165 * re-compilations. However, in most cases you can use the logical AND operator of the
01166 * Java language like this:
01167 * <pre>Js.be(var) && Js.be(other)</pre>
01168 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01169 * JavaScript expression since the Java compilers generally used are free to compile
01170 * the expression into any byte codes they think efficient, making it too hard for the
01171 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01172 * @param other A value or object.
01173 * @return The logical AND of the two operands.
01174 * @since 1.0
01175 * @javascript Re-compilers must replace the instance invocation of this method with the
01176 * JavaScript expression:
01177 * <pre>p && other</pre>
01178 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01179 */01180 publicValue<T>and(Tother){01181 return!Js.be(var())?this:newValue<T>(other);01182 }01183 01184 /**
01185 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
01186 * operation on the two values: it returns <tt>true</tt> if and only if both its first
01187 * operand and its second operand are <tt>true</tt>. If one or both of these operands
01188 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
01189 * <p>In JavaScript, depending on the value of the left-side expression, the operator
01190 * may or may not evaluate the right-side expression. The actual behavior of the operator
01191 * is somewhat more complicated. It starts by evaluating its first operand, the expression
01192 * on its left. If the value of this expression can be converted to <tt>false</tt>
01193 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
01194 * the operator returns the value of the left-side expression. Otherwise, it evaluates
01195 * its second operand, the expression on its right, and returns the value of that
01196 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
01197 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
01198 * returning the unconverted value of the left-side expression.</p>
01199 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
01200 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
01201 * anonymously, returning the actual expression in the method overriding
01202 * {@link Var#var()}.</p>
01203 * <p>Sometimes, this operation probably does not do what the programmers intended.
01204 * To avoid problems, do not use expressions with side effects (assignments, increments,
01205 * decrements, and function calls) for the second operand unless you are quite sure
01206 * you know exactly what you are doing.</p>
01207 * <p>Despite the fairly confusing way that this operation actually works, it is
01208 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
01209 * Although it does not actually return a boolean value, the value it returns can always
01210 * be converted to a boolean value.</p>
01211 * <p>Note that, this method is probably useful in emulation codes just for perfect
01212 * re-compilations. However, in most cases you can use the logical AND operator of the
01213 * Java language like this:
01214 * <pre>Js.be(var) && Js.be(other)</pre>
01215 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01216 * JavaScript expression since the Java compilers generally used are free to compile
01217 * the expression into any byte codes they think efficient, making it too hard for the
01218 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01219 * @param other A value or object.
01220 * @return The logical AND of the two operands.
01221 * @since 1.0
01222 * @javascript Re-compilers must replace the instance invocation of this method with the
01223 * JavaScript expression:
01224 * <pre>p && other</pre>
01225 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01226 */01227 publicValue<T>and(Var<?extendsT>other){01228 return!Js.be(var())?this:newValue<T>(other);01229 }01230 01231 /**
01232 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
01233 * operation on the two values: it returns <tt>true</tt> if either the first operand or
01234 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
01235 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
01236 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
01237 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
01238 * its first operand, the expression on its left. If the value of this expression can
01239 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
01240 * expression. Otherwise, it evaluates its second operand, the expression on its right,
01241 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
01242 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
01243 * and doesn't return the unconverted value of the left-side expression.</p>
01244 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
01245 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
01246 * anonymously, returning the actual expression in the method overriding
01247 * {@link Var#var()}.</p>
01248 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
01249 * operands that include side effects, unless you purposely want to use the fact that
01250 * the right-side expression may not be evaluated in JavaScript.</p>
01251 * <p>Even when this operation is used with operands that are not boolean values, it
01252 * can still be considered a Boolean OR operator because its return value, whatever the
01253 * type, can be converted to a boolean value.</p>
01254 * <p>Note that, this method is probably useful in emulation codes just for perfect
01255 * re-compilations. However, in most cases you can use the logical OR operator of the
01256 * Java language like this:
01257 * <pre>Js.be(var) || Js.be(other)</pre>
01258 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01259 * JavaScript expression since the Java compilers generally used are free to compile
01260 * the expression into any byte codes they think efficient, making it too hard for the
01261 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01262 * @param other A value or object.
01263 * @return The logical OR of the two operands.
01264 * @since 1.0
01265 * @javascript Re-compilers must replace the instance invocation of this method with the
01266 * JavaScript expression:
01267 * <pre>p || other</pre>
01268 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01269 */01270 publicValue<T>or(Tother){01271 returnJs.be(var())?this:newValue<T>(other);01272 }01273 01274 /**
01275 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
01276 * operation on the two values: it returns <tt>true</tt> if either the first operand or
01277 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
01278 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
01279 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
01280 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
01281 * its first operand, the expression on its left. If the value of this expression can
01282 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
01283 * expression. Otherwise, it evaluates its second operand, the expression on its right,
01284 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
01285 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
01286 * and doesn't return the unconverted value of the left-side expression.</p>
01287 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
01288 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
01289 * anonymously, returning the actual expression in the method overriding
01290 * {@link Var#var()}.</p>
01291 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
01292 * operands that include side effects, unless you purposely want to use the fact that
01293 * the right-side expression may not be evaluated in JavaScript.</p>
01294 * <p>Even when this operation is used with operands that are not boolean values, it
01295 * can still be considered a Boolean OR operator because its return value, whatever the
01296 * type, can be converted to a boolean value.</p>
01297 * <p>Note that, this method is probably useful in emulation codes just for perfect
01298 * re-compilations. However, in most cases you can use the logical OR operator of the
01299 * Java language like this:
01300 * <pre>Js.be(var) || Js.be(other)</pre>
01301 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01302 * JavaScript expression since the Java compilers generally used are free to compile
01303 * the expression into any byte codes they think efficient, making it too hard for the
01304 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01305 * @param other A value or object.
01306 * @return The logical OR of the two operands.
01307 * @since 1.0
01308 * @javascript Re-compilers must replace the instance invocation of this method with the
01309 * JavaScript expression:
01310 * <pre>p || other</pre>
01311 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01312 */01313 publicValue<T>or(Var<?extendsT>other){01314 returnJs.be(var())?this:newValue<T>(other);01315 }01316 01317 /**
01318 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
01319 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
01320 * operand, otherwise.</p>
01321 * <p>The first operand of the conditional operation must be (or be convertible to) a
01322 * boolean value. Usually this is the result of a comparison operation. The second and
01323 * third operands may have any value. The value returned by the conditional operation
01324 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
01325 * the value of the conditional expression is the value of the second operand. If the
01326 * first operand is <tt>false</tt>, the value of the conditional expression is the
01327 * value of the third operand.</p>
01328 * <p>To make the second and third operands really late-evaluated or not evaluated in
01329 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
01330 * {@link Var} anonymously, returning the actual expression in the method overriding
01331 * {@link Var#var()}.</p>
01332 * <p>Note that, this method is probably useful in emulation codes just for perfect
01333 * re-compilations. However, in most cases you can use the conditional operator of the
01334 * Java language like this:
01335 * <pre>Js.be(test) ? var : other</pre>
01336 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01337 * JavaScript expression since the Java compilers generally used are free to compile
01338 * the expression into any byte codes they think efficient, making it too hard for the
01339 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01340 * @param other A value or object.
01341 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
01342 * the third operand.
01343 * @since 1.0
01344 * @javascript Re-compilers must replace the instance invocation of this method with the
01345 * JavaScript expression:
01346 * <pre>test ? p : other</pre>
01347 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01348 */01349 publicValue<T>cond(Objecttest,Tother){01350 returnJs.be(test)?this:newValue<T>(other);01351 }01352 01353 /**
01354 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
01355 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
01356 * operand, otherwise.</p>
01357 * <p>The first operand of the conditional operation must be (or be convertible to) a
01358 * boolean value. Usually this is the result of a comparison operation. The second and
01359 * third operands may have any value. The value returned by the conditional operation
01360 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
01361 * the value of the conditional expression is the value of the second operand. If the
01362 * first operand is <tt>false</tt>, the value of the conditional expression is the
01363 * value of the third operand.</p>
01364 * <p>To make the second and third operands really late-evaluated or not evaluated in
01365 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
01366 * {@link Var} anonymously, returning the actual expression in the method overriding
01367 * {@link Var#var()}.</p>
01368 * <p>Note that, this method is probably useful in emulation codes just for perfect
01369 * re-compilations. However, in most cases you can use the conditional operator of the
01370 * Java language like this:
01371 * <pre>Js.be(test) ? var : other</pre>
01372 * which is definitely late-evaluated but not necessarily re-compiled into an expected
01373 * JavaScript expression since the Java compilers generally used are free to compile
01374 * the expression into any byte codes they think efficient, making it too hard for the
01375 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
01376 * @param other A value or object.
01377 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
01378 * the third operand.
01379 * @since 1.0
01380 * @javascript Re-compilers must replace the instance invocation of this method with the
01381 * JavaScript expression:
01382 * <pre>test ? p : other</pre>
01383 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01384 */01385 publicValue<T>cond(Objecttest,Var<?extendsT>other){01386 returnJs.be(test)?this:newValue<T>(other);01387 }01388 01389 /**
01390 * <p>Performs unary negation on a 64-bit integer.</p>
01391 * <p>This operation converts a positive value to an equivalently negative value, and
01392 * vice versa. If the operand is not a 64-bit integer, it attempts to convert it to one.</p>
01393 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01394 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01395 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01396 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01397 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01398 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01399 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01400 * naturally evaluates to a normal number without extra casting codes. That is, casting
01401 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01402 * bits involve the invocation of a predefined re-compiler dependent function while
01403 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01404 * In addition, the <tt>toString()</tt> method of that object or array must return a
01405 * string representation of the <tt>long</tt> number in full 64-bit precision. </p>
01406 * @return The negation of the 64-bit integer.
01407 * @since 1.0
01408 * @javascript A re-compiler is expected to replace the instance invocation of this method
01409 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01410 * the same re-compiler would replace the byte codes of a negation operation on a long number,
01411 * such as the byte codes compiled from the following Java expression:
01412 * <pre>-((Number)p).longValue()</pre>
01413 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01414 */01415 publicfinalLonglneg(){01416 returnnewLong(Js.lneg(var()));01417 }01418 01419 /**
01420 * <p>The 64-bit bitwise-NOT operation, casting the operand to a <tt>long</tt> number
01421 * if it is not 64-bit, operates by reversing all bits in the 64-bit integer.</p>
01422 * <p>Because of the way signed integers are represented in JavaScript, applying this
01423 * operation to a value is equivalent to changing its sign and subtracting 1.</p>
01424 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01425 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01426 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01427 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01428 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01429 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01430 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01431 * naturally evaluates to a normal number without extra casting codes. That is, casting
01432 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01433 * bits involve the invocation of a predefined re-compiler dependent function while
01434 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01435 * In addition, the <tt>toString()</tt> method of that object or array must return a
01436 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01437 * @return The bitwise-NOT of the 64-bit integer.
01438 * @since 1.0
01439 * @javascript A re-compiler is expected to replace the instance invocation of this method
01440 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01441 * the same re-compiler would replace the byte codes of a bitwise-NOT operation on a long number,
01442 * such as the byte codes compiled from the following Java expression:
01443 * <pre>~((Number)p).longValue()</pre>
01444 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01445 */01446 publicfinalLonglnot(){01447 returnnewLong(Js.lnot(var()));01448 }01449 01450 /**
01451 * <p>Adds two 64-bit integers, casting the operands to <tt>long</tt> numbers if any
01452 * one of them is not a 64-bit integer.</p>
01453 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01454 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01455 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01456 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01457 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01458 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01459 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01460 * naturally evaluates to a normal number without extra casting codes. That is, casting
01461 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01462 * bits involve the invocation of a predefined re-compiler dependent function while
01463 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01464 * In addition, the <tt>toString()</tt> method of that object or array must return a
01465 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01466 * @param other Any numeric value.
01467 * @return The sum of the two 64-bit integers.
01468 * @since 1.0
01469 * @javascript A re-compiler is expected to replace the instance invocation of this method
01470 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01471 * the same re-compiler would replace the byte codes of an addition operation on two long numbers,
01472 * such as the byte codes compiled from the following Java expression:
01473 * <pre>((Number)p).longValue() + ((Number)other).longValue()</pre>
01474 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01475 */01476 publicfinalLongladd(Objectother){01477 returnnewLong(Js.ladd(var(),other));01478 }01479 01480 /**
01481 * <p>Subtracts the second 64-bit integer from the first 64-bit integer, casting the
01482 * operands to <tt>long</tt> numbers if any one of them is not a 64-bit integer.</p>
01483 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01484 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01485 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01486 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01487 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01488 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01489 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01490 * naturally evaluates to a normal number without extra casting codes. That is, casting
01491 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01492 * bits involve the invocation of a predefined re-compiler dependent function while
01493 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01494 * In addition, the <tt>toString()</tt> method of that object or array must return a
01495 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01496 * @param other Any numeric value.
01497 * @return The difference between the two 64-bit integers.
01498 * @since 1.0
01499 * @javascript A re-compiler is expected to replace the instance invocation of this method
01500 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01501 * the same re-compiler would replace the byte codes of a subtraction operation on two long numbers,
01502 * such as the byte codes compiled from the following Java expression:
01503 * <pre>((Number)p).longValue() - ((Number)other).longValue()</pre>
01504 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01505 */01506 publicfinalLonglsub(Objectother){01507 returnnewLong(Js.lsub(var(),other));01508 }01509 01510 /**
01511 * <p>Multiplies the two 64-bit integer, casting the operands to <tt>long</tt> numbers
01512 * if any one of them is not a 64-bit integer.</p>
01513 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01514 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01515 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01516 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01517 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01518 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01519 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01520 * naturally evaluates to a normal number without extra casting codes. That is, casting
01521 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01522 * bits involve the invocation of a predefined re-compiler dependent function while
01523 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01524 * In addition, the <tt>toString()</tt> method of that object or array must return a
01525 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01526 * @param other Any numeric value.
01527 * @return The product of the two 64-bit integers.
01528 * @since 1.0
01529 * @javascript A re-compiler is expected to replace the instance invocation of this method
01530 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01531 * the same re-compiler would replace the byte codes of a multiplication operation on two long numbers,
01532 * such as the byte codes compiled from the following Java expression:
01533 * <pre>((Number)p).longValue() * ((Number)other).longValue()</pre>
01534 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01535 */01536 publicfinalLonglmul(Objectother){01537 returnnewLong(Js.lmul(var(),other));01538 }01539 01540 /**
01541 * <p>Divides the first 64-bit integer by the second 64-bit integer, casting the operands
01542 * to <tt>long</tt> numbers if any one of them is not a 64-bit integer.</p>
01543 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01544 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01545 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01546 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01547 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01548 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01549 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01550 * naturally evaluates to a normal number without extra casting codes. That is, casting
01551 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01552 * bits involve the invocation of a predefined re-compiler dependent function while
01553 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01554 * In addition, the <tt>toString()</tt> method of that object or array must return a
01555 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01556 * @param other Any numeric value.
01557 * @return The quotient of the two 64-bit integers.
01558 * @since 1.0
01559 * @javascript A re-compiler is expected to replace the instance invocation of this method
01560 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01561 * the same re-compiler would replace the byte codes of an division operation on two long numbers,
01562 * such as the byte codes compiled from the following Java expression:
01563 * <pre>((Number)p).longValue() / ((Number)other).longValue()</pre>
01564 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01565 */01566 publicfinalLongldiv(Objectother){01567 returnnewLong(Js.ldiv(var(),other));01568 }01569 01570 /**
01571 * <p>Computes the first operand modulo the second operand, casting the operands to
01572 * <tt>long</tt> numbers if any one of them is not a 64-bit integer.</p>
01573 * <p>The operation returns the remainder when the first operand is divided by the
01574 * second operand a certain number of times. The sign of the result is the same as the
01575 * sign of the first operand.</p>
01576 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01577 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01578 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01579 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01580 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01581 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01582 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01583 * naturally evaluates to a normal number without extra casting codes. That is, casting
01584 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01585 * bits involve the invocation of a predefined re-compiler dependent function while
01586 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01587 * In addition, the <tt>toString()</tt> method of that object or array must return a
01588 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01589 * @param other Any numeric value.
01590 * @return The remainder.
01591 * @since 1.0
01592 * @javascript A re-compiler is expected to replace the instance invocation of this method
01593 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01594 * the same re-compiler would replace the byte codes of a modulo operation on two long numbers,
01595 * such as the byte codes compiled from the following Java expression:
01596 * <pre>((Number)p).longValue() % ((Number)other).longValue()</pre>
01597 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01598 */01599 publicfinalLonglmod(Objectother){01600 returnnewLong(Js.lmod(var(),other));01601 }01602 01603 /**
01604 * <p>The 64-bit shift-left operation, casting the first operand to a <tt>long</tt>
01605 * number if it is not 64-bit, moves all bits in it to the left by the number of places
01606 * specified in the second operand, which should be an integer between 0 and 63.</p>
01607 * <p>A zero is used for the new first bit, and the value of the 64th bit is lost.
01608 * Shifting a value left by one position is equivalent to multiplying by 2, shifting
01609 * two positions is equivalent to multiplying by 4, etc.</p>
01610 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01611 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01612 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01613 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01614 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01615 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01616 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01617 * naturally evaluates to a normal number without extra casting codes. That is, casting
01618 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01619 * bits involve the invocation of a predefined re-compiler dependent function while
01620 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01621 * In addition, the <tt>toString()</tt> method of that object or array must return a
01622 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01623 * @param n The number of bits to shift.
01624 * @return The shifted 64-bit integer.
01625 * @since 1.0
01626 * @javascript A re-compiler is expected to replace the instance invocation of this method
01627 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01628 * the same re-compiler would replace the byte codes of a shift-left operation on a long number,
01629 * such as the byte codes compiled from the following Java expression:
01630 * <pre>((Number)p).longValue() << n</pre>
01631 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01632 */01633 publicfinalLonglshl(intn){01634 returnnewLong(Js.lshl(var(),n));01635 }01636 01637 /**
01638 * <p>The 64-bit shift-right operation, casting the first operand to a <tt>long</tt>
01639 * number if it is not 64-bit, moves all bits in it to the right by the number of
01640 * places specified in the second operand (an integer between 0 and 63). Bits that are
01641 * shifted off the right are lost. The bits filled in on the left depend on the sign
01642 * bit of the original operand, in order to preserve the sign of the result. If the
01643 * first operand is positive, the result has zeros placed in the high bits; if the
01644 * first operand is negative, the result has ones placed in the high bits.</p>
01645 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
01646 * remainder), shifting right two places is equivalent to integer division by 4, and
01647 * so on.</p>
01648 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01649 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01650 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01651 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01652 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01653 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01654 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01655 * naturally evaluates to a normal number without extra casting codes. That is, casting
01656 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01657 * bits involve the invocation of a predefined re-compiler dependent function while
01658 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01659 * In addition, the <tt>toString()</tt> method of that object or array must return a
01660 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01661 * @param n The number of bits to shift.
01662 * @return The shifted 64-bit integer.
01663 * @since 1.0
01664 * @javascript A re-compiler is expected to replace the instance invocation of this method
01665 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01666 * the same re-compiler would replace the byte codes of a shift-right operation on a long number,
01667 * such as the byte codes compiled from the following Java expression:
01668 * <pre>((Number)p).longValue() >> n</pre>
01669 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01670 */01671 publicfinalLonglshr(intn){01672 returnnewLong(Js.lshr(var(),n));01673 }01674 01675 /**
01676 * <p>The 64-bit shift-right-unsigned operation, casting the first operand to a
01677 * <tt>long</tt> number if it is not 64-bit, moves all bits in it to the right by the
01678 * number of places specified in the second operand (an integer between 0 and 63). Bits
01679 * that are shifted off the right are lost. The result has zeros placed in the high
01680 * bits.</p>
01681 * <p>This operation is just like {@link #lshr(int)}, except that the bits shifted
01682 * in on the left are always zero, regardless of the sign of the first operand.</p>
01683 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
01684 * remainder), shifting right two places is equivalent to integer division by 4, and
01685 * so on.</p>
01686 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01687 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01688 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01689 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01690 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01691 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01692 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01693 * naturally evaluates to a normal number without extra casting codes. That is, casting
01694 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01695 * bits involve the invocation of a predefined re-compiler dependent function while
01696 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01697 * In addition, the <tt>toString()</tt> method of that object or array must return a
01698 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01699 * @param n The number of bits to shift.
01700 * @return The shifted 64-bit integer.
01701 * @since 1.0
01702 * @javascript A re-compiler is expected to replace the instance invocation of this method
01703 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01704 * the same re-compiler would replace the byte codes of an unsigned shift-right operation on a long number,
01705 * such as the byte codes compiled from the following Java expression:
01706 * <pre>((Number)p).longValue() >>> n</pre>
01707 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01708 */01709 publicfinalLonglshru(intn){01710 returnnewLong(Js.lshru(var(),n));01711 }01712 01713 /**
01714 * <p>The 64-bit bitwise-AND operation, casting the operands to <tt>long</tt> numbers
01715 * if any one of them is not a 64-bit integer, performs a boolean AND operation on each
01716 * bit of the 64-bit integers. A bit is set in the result only if the corresponding
01717 * bit is set in both operands.</p>
01718 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01719 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01720 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01721 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01722 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01723 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01724 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01725 * naturally evaluates to a normal number without extra casting codes. That is, casting
01726 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01727 * bits involve the invocation of a predefined re-compiler dependent function while
01728 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01729 * In addition, the <tt>toString()</tt> method of that object or array must return a
01730 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01731 * @param other Any numeric value.
01732 * @return The bitwise-AND of the two 64-bit integers.
01733 * @since 1.0
01734 * @javascript A re-compiler is expected to replace the instance invocation of this method
01735 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01736 * the same re-compiler would replace the byte codes of a bitwise AND operation on two long numbers,
01737 * such as the byte codes compiled from the following Java expression:
01738 * <pre>((Number)p).longValue() & ((Number)other).longValue()</pre>
01739 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01740 */01741 publicfinalLongland(Objectother){01742 returnnewLong(Js.land(var(),other));01743 }01744 01745 /**
01746 * <p>The 64-bit bitwise-OR operation, casting the operands to <tt>long</tt> numbers if
01747 * any one of them is not a 64-bit integer, performs a boolean OR operation on each bit
01748 * of the 64-bit integers. A bit is set in the result if the corresponding bit is set
01749 * in one or both of the operands.</p>
01750 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01751 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01752 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01753 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01754 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01755 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01756 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01757 * naturally evaluates to a normal number without extra casting codes. That is, casting
01758 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01759 * bits involve the invocation of a predefined re-compiler dependent function while
01760 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01761 * In addition, the <tt>toString()</tt> method of that object or array must return a
01762 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01763 * @param other Any numeric value.
01764 * @return The bitwise-OR of the two 64-bit integers.
01765 * @since 1.0
01766 * @javascript A re-compiler is expected to replace the instance invocation of this method
01767 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01768 * the same re-compiler would replace the byte codes of a bitwise OR operation on two long numbers,
01769 * such as the byte codes compiled from the following Java expression:
01770 * <pre>((Number)p).longValue() | ((Number)other).longValue()</pre>
01771 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01772 */01773 publicfinalLonglor(Objectother){01774 returnnewLong(Js.lor(var(),other));01775 }01776 01777 /**
01778 * <p>The 64-bit bitwise-XOR operation, casting the operands to <tt>long</tt> numbers
01779 * if any one of them is not a 64-bit integer, performs a boolean exclusive OR operation
01780 * on each bit of the 64-bit integers. Exclusive OR means that either operand one is
01781 * <tt>true</tt> or operand two is <tt>true</tt>, but not both. A bit is set in this
01782 * operation's result if a corresponding bit is set in one (but not both) of the two
01783 * operands.</p>
01784 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01785 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01786 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01787 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01788 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01789 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01790 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01791 * naturally evaluates to a normal number without extra casting codes. That is, casting
01792 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01793 * bits involve the invocation of a predefined re-compiler dependent function while
01794 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01795 * In addition, the <tt>toString()</tt> method of that object or array must return a
01796 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01797 * @param other Any numeric value.
01798 * @return The bitwise-exclusive-OR of the two 64-bit integers.
01799 * @since 1.0
01800 * @javascript A re-compiler is expected to replace the instance invocation of this method
01801 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01802 * the same re-compiler would replace the byte codes of a bitwise exclusive OR operation on two long numbers,
01803 * such as the byte codes compiled from the following Java expression:
01804 * <pre>((Number)p).longValue() ^ ((Number)other).longValue()</pre>
01805 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01806 */01807 publicfinalLonglxor(Objectother){01808 returnnewLong(Js.lxor(var(),other));01809 }01810 01811 /**
01812 * <p>The 64-bit less-than operation, casting the operands to <tt>long</tt> numbers if
01813 * any one of them is not a 64-bit integer, evaluates to <tt>true</tt> if the first
01814 * operand is less than the second operand; otherwise it evaluates to <tt>false</tt>.</p>
01815 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01816 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01817 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01818 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01819 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01820 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01821 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01822 * naturally evaluates to a normal number without extra casting codes. That is, casting
01823 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01824 * bits involve the invocation of a predefined re-compiler dependent function while
01825 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01826 * In addition, the <tt>toString()</tt> method of that object or array must return a
01827 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01828 * @param other Any numeric value.
01829 * @return <tt>true</tt> if the first operand is less than the second operand;
01830 * otherwise <tt>false</tt>.
01831 * @since 1.0
01832 * @javascript A re-compiler is expected to replace the instance invocation of this method
01833 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01834 * the same re-compiler would replace the byte codes of a less-than operation on two long numbers,
01835 * such as the byte codes compiled from the following Java expression:
01836 * <pre>((Number)p).longValue() < ((Number)other).longValue()</pre>
01837 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01838 */01839 publicfinalBooleanllt(Objectother){01840 returnnewBoolean(Js.llt(var(),other));01841 }01842 01843 /**
01844 * <p>The 64-bit greater-than operation, casting the operands to <tt>long</tt> numbers
01845 * if any one of them is not a 64-bit integer, evaluates to <tt>true</tt> if the first
01846 * operand is greater than the second operand; otherwise it evaluates to <tt>false</tt>.</p>
01847 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01848 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01849 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01850 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01851 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01852 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01853 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01854 * naturally evaluates to a normal number without extra casting codes. That is, casting
01855 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01856 * bits involve the invocation of a predefined re-compiler dependent function while
01857 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01858 * In addition, the <tt>toString()</tt> method of that object or array must return a
01859 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01860 * @param other Any numeric value.
01861 * @return <tt>true</tt> if the first operand is greater than the second operand;
01862 * otherwise <tt>false</tt>.
01863 * @since 1.0
01864 * @javascript A re-compiler is expected to replace the instance invocation of this method
01865 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01866 * the same re-compiler would replace the byte codes of a greater-than operation on two long numbers,
01867 * such as the byte codes compiled from the following Java expression:
01868 * <pre>((Number)p).longValue() > ((Number)other).longValue()</pre>
01869 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01870 */01871 publicfinalBooleanlgt(Objectother){01872 returnnewBoolean(Js.lgt(var(),other));01873 }01874 01875 /**
01876 * <p>The 64-bit less-than-or-equal operation, casting the operands to <tt>long</tt>
01877 * numbers if any one of them is not a 64-bit integer, evaluates to <tt>true</tt> if
01878 * the first operand is less than or equal to the second operand; otherwise it evaluates
01879 * to <tt>false</tt>.</p>
01880 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01881 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01882 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01883 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01884 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01885 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01886 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01887 * naturally evaluates to a normal number without extra casting codes. That is, casting
01888 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01889 * bits involve the invocation of a predefined re-compiler dependent function while
01890 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01891 * In addition, the <tt>toString()</tt> method of that object or array must return a
01892 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01893 * @param other Any numeric value.
01894 * @return <tt>true</tt> if the first operand is less than or equal to the second operand;
01895 * otherwise <tt>false</tt>.
01896 * @since 1.0
01897 * @javascript A re-compiler is expected to replace the instance invocation of this method
01898 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01899 * the same re-compiler would replace the byte codes of a less-than-or-equal operation on two long numbers,
01900 * such as the byte codes compiled from the following Java expression:
01901 * <pre>((Number)p).longValue() <= ((Number)other).longValue()</pre>
01902 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01903 */01904 publicfinalBooleanllte(Objectother){01905 returnnewBoolean(Js.llte(var(),other));01906 }01907 01908 /**
01909 * <p>The 64-bit greater-than-or-equal operation, casting the operands to <tt>long</tt>
01910 * numbers if any one of them is not a 64-bit integer, evaluates to <tt>true</tt> if the
01911 * first operand is greater than or equal to the second operand; otherwise it evaluates
01912 * to <tt>false</tt>.</p>
01913 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01914 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01915 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01916 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01917 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01918 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01919 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01920 * naturally evaluates to a normal number without extra casting codes. That is, casting
01921 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01922 * bits involve the invocation of a predefined re-compiler dependent function while
01923 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01924 * In addition, the <tt>toString()</tt> method of that object or array must return a
01925 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01926 * @param other Any numeric value.
01927 * @return <tt>true</tt> if the first operand is greater than or equal to the second operand;
01928 * otherwise <tt>false</tt>.
01929 * @since 1.0
01930 * @javascript A re-compiler is expected to replace the instance invocation of this method
01931 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01932 * the same re-compiler would replace the byte codes of a greater-than-or-equal operation on two long numbers,
01933 * such as the byte codes compiled from the following Java expression:
01934 * <pre>((Number)p).longValue() >= ((Number)other).longValue()</pre>
01935 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01936 */01937 publicfinalBooleanlgte(Objectother){01938 returnnewBoolean(Js.lgte(var(),other));01939 }01940 01941 /**
01942 * <p>Checks whether the two 64-bit integers are "equal", casting the operands to
01943 * <tt>long</tt> numbers if any one of them is not a 64-bit integer.</p>
01944 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01945 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01946 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01947 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01948 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01949 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01950 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01951 * naturally evaluates to a normal number without extra casting codes. That is, casting
01952 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01953 * bits involve the invocation of a predefined re-compiler dependent function while
01954 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01955 * In addition, the <tt>toString()</tt> method of that object or array must return a
01956 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01957 * @param other Any numeric value.
01958 * @return <tt>true</tt> if the first operand equals the second; <tt>false</tt>,
01959 * otherwise;
01960 * @since 1.0
01961 * @javascript A re-compiler is expected to replace the instance invocation of this method
01962 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01963 * the same re-compiler would replace the byte codes of an equality operation on two long numbers,
01964 * such as the byte codes compiled from the following Java expression:
01965 * <pre>((Number)p).longValue() == ((Number)other).longValue()</pre>
01966 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01967 */01968 publicfinalBooleanleq(Objectother){01969 returnnewBoolean(Js.leq(var(),other));01970 }01971 01972 /**
01973 * <p>Checks whether the two 64-bit integers are not "equal", casting the operands to
01974 * <tt>long</tt> numbers if any one of them is not a 64-bit integer.</p>
01975 * <p>Note that, although the representation of <tt>long</tt> numbers in JavaScript and
01976 * the 64-bit operations on them are re-compiler dependent, the re-compilers are expected
01977 * to express 64-bit integers as JavaScript objects or arrays, with a bitwise or arithmetc
01978 * operation on <tt>long</tt> numbers converted to the invocation of a predefined global
01979 * function that is also re-compiler dependent. The <tt>valueOf()</tt> method of the object
01980 * or array representing a 64-bit integer must return a number representing the <tt>long</tt>
01981 * number in JavaScript limited bits range, so that a <tt>long</tt> integer in JavaScript
01982 * naturally evaluates to a normal number without extra casting codes. That is, casting
01983 * a normal number to a <tt>long</tt> integer, or creating a <tt>long</tt> integer from
01984 * bits involve the invocation of a predefined re-compiler dependent function while
01985 * casting a <tt>long</tt> integer to a normal number is expected to be ignored by re-compilation.
01986 * In addition, the <tt>toString()</tt> method of that object or array must return a
01987 * string representation of the <tt>long</tt> number in full 64-bit precision.</p>
01988 * @param other Any numeric value.
01989 * @return <tt>false</tt> if the first operand equals the second; <tt>true</tt>,
01990 * otherwise;
01991 * @since 1.0
01992 * @javascript A re-compiler is expected to replace the instance invocation of this method
01993 * with the invocation of a predefined and re-compiler dependent function, with an invocation of which
01994 * the same re-compiler would replace the byte codes of an inequality operation on two long numbers,
01995 * such as the byte codes compiled from the following Java expression:
01996 * <pre>((Number)p).longValue() != ((Number)other).longValue()</pre>
01997 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
01998 */01999 publicfinalBooleanlneq(Objectother){02000 returnnewBoolean(Js.lneq(var(),other));02001 }02002 02003 /**
02004 * <p>An <b>opaque</b> class resembling JavaScript primitive boolean values.</p>
02005 *
02006 * @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>
02007 *
02008 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
02009 * generated into the target codes. Re-compilers must exit with error on the operations of
02010 * accessing that kind of class objects.
02011 */02012 02013 publicstaticfinalclassBooleanextendsValue<java.lang.Boolean>02014 {02015 /**
02016 * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
02017 * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>.
02018 * This class and the subclasses of this class are used to declare either <b>opaque</b>
02019 * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the
02020 * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their
02021 * constructors are used to define the fields inside <b>opaque</b> classes. Under
02022 * either circumstance, the field names must be exactly same as the member names, as
02023 * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly
02024 * based on the field names.</p>
02025 *
02026 * @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>
02027 *
02028 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
02029 * in the target codes. Re-compilers must exit with error on operations accessing that kind
02030 * of class objects.
02031 * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
02032 * {@link js.Var.Member} or its subclasses to the JavaScript identifier:
02033 * <pre>q.m</pre>
02034 * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
02035 * resolved from the instance of the enclosing member. Re-compilers must resolve an
02036 * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than
02037 * {@link js.Var.Member} and its subclasses to the JavaScript identifier:
02038 * <pre>m</pre>
02039 * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
02040 * error on the access to <b>opaque</b> fields declared by this class under any other
02041 * circumstances.
02042 */02043 publicstaticfinalclassMemberextendsValue.Member<java.lang.Boolean>02044 {02045 /**
02046 * <p>Internally constructs a member based on a qualifying member.</p>
02047 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
02048 * or <b>internal</b> classes or class members.</p>
02049 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
02050 * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields
02051 * declared in the declaring class of this constructor itself or its subclasses.
02052 * Under this circumstance, the field names must be exactly same as the member
02053 * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type
02054 * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
02055 * to their names appending to the name resolved from the specified qualifying
02056 * member with a dot in between.</p>
02057 * @param q A qualifying member
02058 * @param mid The ID of the member to construct
02059 * @since 1.0
02060 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
02061 */02062 publicMember(JsObject.Memberq,Midmid){02063 super(q,mid);02064 }02065 /**
02066 * <p>Internally constructs a member without a qualifying member.</p>
02067 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
02068 * or <b>internal</b> classes or class members.</p>
02069 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
02070 * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields,
02071 * declared in <b>opaque</b> types other than the declaring class of this constructor
02072 * itself and its subclasses. Under this circumstance, the field names must be
02073 * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
02074 * types are generally resolved by re-compilers directly to identifiers of their names.</p>
02075 * @param mid The ID of the member to construct
02076 * @since 1.0
02077 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
02078 */02079 publicMember(Midmid){02080 super(mid);02081 }02082 /**
02083 * <p>Sets a new value to the property, represented by the current member instance,
02084 * of an object.</p>
02085 * @param o The base object
02086 * @param v The new value to set
02087 * @return The new value
02088 * @since 1.0
02089 * @javascript Re-compilers must convert the instance invocation of this method into
02090 * the JavaScript expression:
02091 * <pre>o.m = v</pre>
02092 * where <tt>m</tt> is the identifier name resolved from the current member
02093 * instance of the invocation.
02094 */02095 publicjava.lang.Booleanwith(ObjectLikeo,Var<java.lang.Boolean>v){02096 returnwith(o,v.var());02097 }02098 /**
02099 * <p>Sets a new value to the property, represented by the current member instance,
02100 * of an object.</p>
02101 * @param o The base object
02102 * @param v The new value to set
02103 * @return The new value
02104 * @since 1.0
02105 * @javascript Re-compilers must convert the instance invocation of this method into
02106 * the JavaScript expression:
02107 * <pre>o.m = v</pre>
02108 * where <tt>m</tt> is the identifier name resolved from the current member
02109 * instance of the invocation.
02110 */02111 publicjava.lang.Booleanwith(ObjectLikeo,JsBooleanv){02112 returnwith(o,v.valueOf());02113 }02114 }02115 02116 /**
02117 * <p>Constructs a primitive boolean instance from a primitive boolean value.</p>
02118 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
02119 * wrap primitive data types are also "primitive" to JS.</p>
02120 * @since 1.0
02121 * @javascript Re-compilers must ignore the construction operation of this constructor,
02122 * that is, replacing it with its only argument.
02123 */02124 publicBoolean(java.lang.Booleanvalue){02125 super(value);02126 }02127 /**
02128 * <p>Constructs a primitive boolean instance from a primitive boolean value.</p>
02129 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
02130 * wrap primitive data types are also "primitive" to JS.</p>
02131 * @since 1.0
02132 * @javascript Re-compilers must ignore the construction operation of this constructor,
02133 * that is, replacing it with its only argument.
02134 */02135 publicBoolean(Var<java.lang.Boolean>value){02136 super(value==null?null:value.var());02137 }02138 02139 /**
02140 * <p>Returns the primitive value associated with the current instance, if there is one.</p>
02141 * @return The primitive value associated with the current instance.
02142 * @see #toString()
02143 * @since 1.0
02144 * @javascript Re-compilers must convert the instance invocation of this method directly
02145 * into a JavaScript invocation on its current instance without changing the method
02146 * name, but expanding variable arguments, if any, into comma-separated values.
02147 */02148 @Override02149 publicfinaljava.lang.BooleanvalueOf(){02150 returnvar();02151 }02152 02153 /**
02154 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
02155 * a string operand, resembling the addition operator in JavaScript.</p>
02156 * <p>If one value is a string, the other is converted to a string, and the two
02157 * strings are then concatenated. Object operands are converted to numbers or strings
02158 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
02159 * method and/or the {@link Js#toString(Object)} method on the object.</p>
02160 * @param other A value or object.
02161 * @return The sum or concatenation of the values.
02162 * @since 1.0
02163 * @javascript Re-compilers must replace the instance invocation of this method with the
02164 * JavaScript expression:
02165 * <pre>p + other</pre>
02166 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02167 */02168 @Override02169 publicfinalStringadd(Objectother){02170 returnnewString(Js.add(toString(),other));02171 }02172 02173 /**
02174 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02175 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02176 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02177 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02178 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02179 * may or may not evaluate the right-side expression. The actual behavior of the operator
02180 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02181 * on its left. If the value of this expression can be converted to <tt>false</tt>
02182 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02183 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02184 * its second operand, the expression on its right, and returns the value of that
02185 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02186 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02187 * returning the unconverted value of the left-side expression.</p>
02188 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02189 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02190 * anonymously, returning the actual expression in the method overriding
02191 * {@link Var#var()}.</p>
02192 * <p>Sometimes, this operation probably does not do what the programmers intended.
02193 * To avoid problems, do not use expressions with side effects (assignments, increments,
02194 * decrements, and function calls) for the second operand unless you are quite sure
02195 * you know exactly what you are doing.</p>
02196 * <p>Despite the fairly confusing way that this operation actually works, it is
02197 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02198 * Although it does not actually return a boolean value, the value it returns can always
02199 * be converted to a boolean value.</p>
02200 * <p>Note that, this method is probably useful in emulation codes just for perfect
02201 * re-compilations. However, in most cases you can use the logical AND operator of the
02202 * Java language like this:
02203 * <pre>Js.be(var) && Js.be(other)</pre>
02204 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02205 * JavaScript expression since the Java compilers generally used are free to compile
02206 * the expression into any byte codes they think efficient, making it too hard for the
02207 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02208 * @param other A value or object.
02209 * @return The logical AND of the two operands.
02210 * @since 1.0
02211 * @javascript Re-compilers must replace the instance invocation of this method with the
02212 * JavaScript expression:
02213 * <pre>p && other</pre>
02214 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02215 */02216 @Override02217 publicfinalBooleanand(java.lang.Booleanother){02218 returnnewBoolean(Js.and(this,other));02219 }02220 02221 /**
02222 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02223 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02224 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02225 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02226 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02227 * may or may not evaluate the right-side expression. The actual behavior of the operator
02228 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02229 * on its left. If the value of this expression can be converted to <tt>false</tt>
02230 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02231 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02232 * its second operand, the expression on its right, and returns the value of that
02233 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02234 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02235 * returning the unconverted value of the left-side expression.</p>
02236 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02237 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02238 * anonymously, returning the actual expression in the method overriding
02239 * {@link Var#var()}.</p>
02240 * <p>Sometimes, this operation probably does not do what the programmers intended.
02241 * To avoid problems, do not use expressions with side effects (assignments, increments,
02242 * decrements, and function calls) for the second operand unless you are quite sure
02243 * you know exactly what you are doing.</p>
02244 * <p>Despite the fairly confusing way that this operation actually works, it is
02245 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02246 * Although it does not actually return a boolean value, the value it returns can always
02247 * be converted to a boolean value.</p>
02248 * <p>Note that, this method is probably useful in emulation codes just for perfect
02249 * re-compilations. However, in most cases you can use the logical AND operator of the
02250 * Java language like this:
02251 * <pre>Js.be(var) && Js.be(other)</pre>
02252 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02253 * JavaScript expression since the Java compilers generally used are free to compile
02254 * the expression into any byte codes they think efficient, making it too hard for the
02255 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02256 * @param other A value or object.
02257 * @return The logical AND of the two operands.
02258 * @since 1.0
02259 * @javascript Re-compilers must replace the instance invocation of this method with the
02260 * JavaScript expression:
02261 * <pre>p && other</pre>
02262 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02263 */02264 publicfinalBooleanand(Value<java.lang.Boolean>other){02265 returnnewBoolean(Js.and(this,other));02266 }02267 02268 /**
02269 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02270 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02271 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02272 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02273 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02274 * may or may not evaluate the right-side expression. The actual behavior of the operator
02275 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02276 * on its left. If the value of this expression can be converted to <tt>false</tt>
02277 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02278 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02279 * its second operand, the expression on its right, and returns the value of that
02280 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02281 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02282 * returning the unconverted value of the left-side expression.</p>
02283 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02284 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02285 * anonymously, returning the actual expression in the method overriding
02286 * {@link Var#var()}.</p>
02287 * <p>Sometimes, this operation probably does not do what the programmers intended.
02288 * To avoid problems, do not use expressions with side effects (assignments, increments,
02289 * decrements, and function calls) for the second operand unless you are quite sure
02290 * you know exactly what you are doing.</p>
02291 * <p>Despite the fairly confusing way that this operation actually works, it is
02292 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02293 * Although it does not actually return a boolean value, the value it returns can always
02294 * be converted to a boolean value.</p>
02295 * <p>Note that, this method is probably useful in emulation codes just for perfect
02296 * re-compilations. However, in most cases you can use the logical AND operator of the
02297 * Java language like this:
02298 * <pre>Js.be(var) && Js.be(other)</pre>
02299 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02300 * JavaScript expression since the Java compilers generally used are free to compile
02301 * the expression into any byte codes they think efficient, making it too hard for the
02302 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02303 * @param other A value or object.
02304 * @return The logical AND of the two operands.
02305 * @since 1.0
02306 * @javascript Re-compilers must replace the instance invocation of this method with the
02307 * JavaScript expression:
02308 * <pre>p && other</pre>
02309 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02310 */02311 publicfinalBooleanand(Booleanother){02312 returnnewBoolean(Js.and(this,other));02313 }02314 02315 /**
02316 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02317 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02318 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02319 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02320 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02321 * may or may not evaluate the right-side expression. The actual behavior of the operator
02322 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02323 * on its left. If the value of this expression can be converted to <tt>false</tt>
02324 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02325 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02326 * its second operand, the expression on its right, and returns the value of that
02327 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02328 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02329 * returning the unconverted value of the left-side expression.</p>
02330 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02331 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02332 * anonymously, returning the actual expression in the method overriding
02333 * {@link Var#var()}.</p>
02334 * <p>Sometimes, this operation probably does not do what the programmers intended.
02335 * To avoid problems, do not use expressions with side effects (assignments, increments,
02336 * decrements, and function calls) for the second operand unless you are quite sure
02337 * you know exactly what you are doing.</p>
02338 * <p>Despite the fairly confusing way that this operation actually works, it is
02339 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02340 * Although it does not actually return a boolean value, the value it returns can always
02341 * be converted to a boolean value.</p>
02342 * <p>Note that, this method is probably useful in emulation codes just for perfect
02343 * re-compilations. However, in most cases you can use the logical AND operator of the
02344 * Java language like this:
02345 * <pre>Js.be(var) && Js.be(other)</pre>
02346 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02347 * JavaScript expression since the Java compilers generally used are free to compile
02348 * the expression into any byte codes they think efficient, making it too hard for the
02349 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02350 * @param other A value or object.
02351 * @return The logical AND of the two operands.
02352 * @since 1.0
02353 * @javascript Re-compilers must replace the instance invocation of this method with the
02354 * JavaScript expression:
02355 * <pre>p && other</pre>
02356 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02357 */02358 publicfinalJsBooleanand(JsBooleanother){02359 returnJs.and(this,other);02360 }02361 02362 /**
02363 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
02364 * operation on the two values: it returns <tt>true</tt> if either the first operand or
02365 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
02366 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
02367 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
02368 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
02369 * its first operand, the expression on its left. If the value of this expression can
02370 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
02371 * expression. Otherwise, it evaluates its second operand, the expression on its right,
02372 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
02373 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
02374 * and doesn't return the unconverted value of the left-side expression.</p>
02375 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02376 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02377 * anonymously, returning the actual expression in the method overriding
02378 * {@link Var#var()}.</p>
02379 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
02380 * operands that include side effects, unless you purposely want to use the fact that
02381 * the right-side expression may not be evaluated in JavaScript.</p>
02382 * <p>Even when this operation is used with operands that are not boolean values, it
02383 * can still be considered a Boolean OR operator because its return value, whatever the
02384 * type, can be converted to a boolean value.</p>
02385 * <p>Note that, this method is probably useful in emulation codes just for perfect
02386 * re-compilations. However, in most cases you can use the logical OR operator of the
02387 * Java language like this:
02388 * <pre>Js.be(var) || Js.be(other)</pre>
02389 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02390 * JavaScript expression since the Java compilers generally used are free to compile
02391 * the expression into any byte codes they think efficient, making it too hard for the
02392 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02393 * @param other A value or object.
02394 * @return The logical OR of the two operands.
02395 * @since 1.0
02396 * @javascript Re-compilers must replace the instance invocation of this method with the
02397 * JavaScript expression:
02398 * <pre>p || other</pre>
02399 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02400 */02401 @Override02402 publicfinalBooleanor(java.lang.Booleanother){02403 returnnewBoolean(Js.or(this,other));02404 }02405 02406 /**
02407 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
02408 * operation on the two values: it returns <tt>true</tt> if either the first operand or
02409 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
02410 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
02411 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
02412 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
02413 * its first operand, the expression on its left. If the value of this expression can
02414 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
02415 * expression. Otherwise, it evaluates its second operand, the expression on its right,
02416 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
02417 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
02418 * and doesn't return the unconverted value of the left-side expression.</p>
02419 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02420 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02421 * anonymously, returning the actual expression in the method overriding
02422 * {@link Var#var()}.</p>
02423 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
02424 * operands that include side effects, unless you purposely want to use the fact that
02425 * the right-side expression may not be evaluated in JavaScript.</p>
02426 * <p>Even when this operation is used with operands that are not boolean values, it
02427 * can still be considered a Boolean OR operator because its return value, whatever the
02428 * type, can be converted to a boolean value.</p>
02429 * <p>Note that, this method is probably useful in emulation codes just for perfect
02430 * re-compilations. However, in most cases you can use the logical OR operator of the
02431 * Java language like this:
02432 * <pre>Js.be(var) || Js.be(other)</pre>
02433 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02434 * JavaScript expression since the Java compilers generally used are free to compile
02435 * the expression into any byte codes they think efficient, making it too hard for the
02436 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02437 * @param other A value or object.
02438 * @return The logical OR of the two operands.
02439 * @since 1.0
02440 * @javascript Re-compilers must replace the instance invocation of this method with the
02441 * JavaScript expression:
02442 * <pre>p || other</pre>
02443 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02444 */02445 publicfinalBooleanor(Value<java.lang.Boolean>other){02446 returnnewBoolean(Js.or(this,other));02447 }02448 02449 /**
02450 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
02451 * operation on the two values: it returns <tt>true</tt> if either the first operand or
02452 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
02453 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
02454 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
02455 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
02456 * its first operand, the expression on its left. If the value of this expression can
02457 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
02458 * expression. Otherwise, it evaluates its second operand, the expression on its right,
02459 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
02460 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
02461 * and doesn't return the unconverted value of the left-side expression.</p>
02462 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02463 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02464 * anonymously, returning the actual expression in the method overriding
02465 * {@link Var#var()}.</p>
02466 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
02467 * operands that include side effects, unless you purposely want to use the fact that
02468 * the right-side expression may not be evaluated in JavaScript.</p>
02469 * <p>Even when this operation is used with operands that are not boolean values, it
02470 * can still be considered a Boolean OR operator because its return value, whatever the
02471 * type, can be converted to a boolean value.</p>
02472 * <p>Note that, this method is probably useful in emulation codes just for perfect
02473 * re-compilations. However, in most cases you can use the logical OR operator of the
02474 * Java language like this:
02475 * <pre>Js.be(var) || Js.be(other)</pre>
02476 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02477 * JavaScript expression since the Java compilers generally used are free to compile
02478 * the expression into any byte codes they think efficient, making it too hard for the
02479 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02480 * @param other A value or object.
02481 * @return The logical OR of the two operands.
02482 * @since 1.0
02483 * @javascript Re-compilers must replace the instance invocation of this method with the
02484 * JavaScript expression:
02485 * <pre>p || other</pre>
02486 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02487 */02488 publicfinalBooleanor(Booleanother){02489 returnnewBoolean(Js.or(this,other));02490 }02491 02492 /**
02493 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
02494 * operation on the two values: it returns <tt>true</tt> if either the first operand or
02495 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
02496 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
02497 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
02498 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
02499 * its first operand, the expression on its left. If the value of this expression can
02500 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
02501 * expression. Otherwise, it evaluates its second operand, the expression on its right,
02502 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
02503 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
02504 * and doesn't return the unconverted value of the left-side expression.</p>
02505 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02506 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02507 * anonymously, returning the actual expression in the method overriding
02508 * {@link Var#var()}.</p>
02509 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
02510 * operands that include side effects, unless you purposely want to use the fact that
02511 * the right-side expression may not be evaluated in JavaScript.</p>
02512 * <p>Even when this operation is used with operands that are not boolean values, it
02513 * can still be considered a Boolean OR operator because its return value, whatever the
02514 * type, can be converted to a boolean value.</p>
02515 * <p>Note that, this method is probably useful in emulation codes just for perfect
02516 * re-compilations. However, in most cases you can use the logical OR operator of the
02517 * Java language like this:
02518 * <pre>Js.be(var) || Js.be(other)</pre>
02519 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02520 * JavaScript expression since the Java compilers generally used are free to compile
02521 * the expression into any byte codes they think efficient, making it too hard for the
02522 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02523 * @param other A value or object.
02524 * @return The logical OR of the two operands.
02525 * @since 1.0
02526 * @javascript Re-compilers must replace the instance invocation of this method with the
02527 * JavaScript expression:
02528 * <pre>p || other</pre>
02529 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02530 */02531 publicfinalBooleanor(JsBooleanother){02532 returnnewBoolean(Js.or(this,other));02533 }02534 02535 /**
02536 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
02537 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
02538 * operand, otherwise.</p>
02539 * <p>The first operand of the conditional operation must be (or be convertible to) a
02540 * boolean value. Usually this is the result of a comparison operation. The second and
02541 * third operands may have any value. The value returned by the conditional operation
02542 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
02543 * the value of the conditional expression is the value of the second operand. If the
02544 * first operand is <tt>false</tt>, the value of the conditional expression is the
02545 * value of the third operand.</p>
02546 * <p>To make the second and third operands really late-evaluated or not evaluated in
02547 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
02548 * {@link Var} anonymously, returning the actual expression in the method overriding
02549 * {@link Var#var()}.</p>
02550 * <p>Note that, this method is probably useful in emulation codes just for perfect
02551 * re-compilations. However, in most cases you can use the conditional operator of the
02552 * Java language like this:
02553 * <pre>Js.be(test) ? var : other</pre>
02554 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02555 * JavaScript expression since the Java compilers generally used are free to compile
02556 * the expression into any byte codes they think efficient, making it too hard for the
02557 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02558 * @param other A value or object.
02559 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
02560 * the third operand.
02561 * @since 1.0
02562 * @javascript Re-compilers must replace the instance invocation of this method with the
02563 * JavaScript expression:
02564 * <pre>test ? p : other</pre>
02565 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02566 */02567 @Override02568 publicfinalBooleancond(Objecttest,java.lang.Booleanother){02569 returnnewBoolean(Js.cond(test,this,other));02570 }02571 02572 /**
02573 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
02574 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
02575 * operand, otherwise.</p>
02576 * <p>The first operand of the conditional operation must be (or be convertible to) a
02577 * boolean value. Usually this is the result of a comparison operation. The second and
02578 * third operands may have any value. The value returned by the conditional operation
02579 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
02580 * the value of the conditional expression is the value of the second operand. If the
02581 * first operand is <tt>false</tt>, the value of the conditional expression is the
02582 * value of the third operand.</p>
02583 * <p>To make the second and third operands really late-evaluated or not evaluated in
02584 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
02585 * {@link Var} anonymously, returning the actual expression in the method overriding
02586 * {@link Var#var()}.</p>
02587 * <p>Note that, this method is probably useful in emulation codes just for perfect
02588 * re-compilations. However, in most cases you can use the conditional operator of the
02589 * Java language like this:
02590 * <pre>Js.be(test) ? var : other</pre>
02591 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02592 * JavaScript expression since the Java compilers generally used are free to compile
02593 * the expression into any byte codes they think efficient, making it too hard for the
02594 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02595 * @param other A value or object.
02596 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
02597 * the third operand.
02598 * @since 1.0
02599 * @javascript Re-compilers must replace the instance invocation of this method with the
02600 * JavaScript expression:
02601 * <pre>test ? p : other</pre>
02602 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02603 */02604 publicfinalBooleancond(Objecttest,Value<java.lang.Boolean>other){02605 returnnewBoolean(Js.cond(test,this,other));02606 }02607 02608 /**
02609 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
02610 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
02611 * operand, otherwise.</p>
02612 * <p>The first operand of the conditional operation must be (or be convertible to) a
02613 * boolean value. Usually this is the result of a comparison operation. The second and
02614 * third operands may have any value. The value returned by the conditional operation
02615 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
02616 * the value of the conditional expression is the value of the second operand. If the
02617 * first operand is <tt>false</tt>, the value of the conditional expression is the
02618 * value of the third operand.</p>
02619 * <p>To make the second and third operands really late-evaluated or not evaluated in
02620 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
02621 * {@link Var} anonymously, returning the actual expression in the method overriding
02622 * {@link Var#var()}.</p>
02623 * <p>Note that, this method is probably useful in emulation codes just for perfect
02624 * re-compilations. However, in most cases you can use the conditional operator of the
02625 * Java language like this:
02626 * <pre>Js.be(test) ? var : other</pre>
02627 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02628 * JavaScript expression since the Java compilers generally used are free to compile
02629 * the expression into any byte codes they think efficient, making it too hard for the
02630 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02631 * @param other A value or object.
02632 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
02633 * the third operand.
02634 * @since 1.0
02635 * @javascript Re-compilers must replace the instance invocation of this method with the
02636 * JavaScript expression:
02637 * <pre>test ? p : other</pre>
02638 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02639 */02640 publicfinalBooleancond(Objecttest,Booleanother){02641 returnnewBoolean(Js.cond(test,this,other));02642 }02643 }02644 02645 /**
02646 * <p>An <b>opaque</b> class resembling JavaScript primitive string values.</p>
02647 *
02648 * @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>
02649 *
02650 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
02651 * generated into the target codes. Re-compilers must exit with error on the operations of
02652 * accessing that kind of class objects.
02653 */02654 02655 publicstaticfinalclassStringextendsValue<java.lang.String>implementsStringLike02656 {02657 /**
02658 * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
02659 * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>.
02660 * This class and the subclasses of this class are used to declare either <b>opaque</b>
02661 * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the
02662 * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their
02663 * constructors are used to define the fields inside <b>opaque</b> classes. Under
02664 * either circumstance, the field names must be exactly same as the member names, as
02665 * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly
02666 * based on the field names.</p>
02667 *
02668 * @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>
02669 *
02670 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
02671 * in the target codes. Re-compilers must exit with error on operations accessing that kind
02672 * of class objects.
02673 * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
02674 * {@link js.Var.Member} or its subclasses to the JavaScript identifier:
02675 * <pre>q.m</pre>
02676 * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
02677 * resolved from the instance of the enclosing member. Re-compilers must resolve an
02678 * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than
02679 * {@link js.Var.Member} and its subclasses to the JavaScript identifier:
02680 * <pre>m</pre>
02681 * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
02682 * error on the access to <b>opaque</b> fields declared by this class under any other
02683 * circumstances.
02684 */02685 publicstaticfinalclassMemberextendsValue.Member<java.lang.String>02686 {02687 /**
02688 * <p>Internally constructs a member based on a qualifying member.</p>
02689 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
02690 * or <b>internal</b> classes or class members.</p>
02691 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
02692 * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields
02693 * declared in the declaring class of this constructor itself or its subclasses.
02694 * Under this circumstance, the field names must be exactly same as the member
02695 * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type
02696 * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
02697 * to their names appending to the name resolved from the specified qualifying
02698 * member with a dot in between.</p>
02699 * @param q A qualifying member
02700 * @param mid The ID of the member to construct
02701 * @since 1.0
02702 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
02703 */02704 publicMember(JsObject.Memberq,Midmid){02705 super(q,mid);02706 }02707 /**
02708 * <p>Internally constructs a member without a qualifying member.</p>
02709 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
02710 * or <b>internal</b> classes or class members.</p>
02711 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
02712 * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields,
02713 * declared in <b>opaque</b> types other than the declaring class of this constructor
02714 * itself and its subclasses. Under this circumstance, the field names must be
02715 * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
02716 * types are generally resolved by re-compilers directly to identifiers of their names.</p>
02717 * @param mid The ID of the member to construct
02718 * @since 1.0
02719 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
02720 */02721 publicMember(Midmid){02722 super(mid);02723 }02724 /**
02725 * <p>Sets a new value to the property, represented by the current member instance,
02726 * of an object.</p>
02727 * @param o The base object
02728 * @param v The new value to set
02729 * @return The new value
02730 * @since 1.0
02731 * @javascript Re-compilers must convert the instance invocation of this method into
02732 * the JavaScript expression:
02733 * <pre>o.m = v</pre>
02734 * where <tt>m</tt> is the identifier name resolved from the current member
02735 * instance of the invocation.
02736 */02737 publicjava.lang.Stringwith(ObjectLikeo,Var<java.lang.String>v){02738 returnwith(o,v.var());02739 }02740 /**
02741 * <p>Sets a new value to the property, represented by the current member instance,
02742 * of an object.</p>
02743 * @param o The base object
02744 * @param v The new value to set
02745 * @return The new value
02746 * @since 1.0
02747 * @javascript Re-compilers must convert the instance invocation of this method into
02748 * the JavaScript expression:
02749 * <pre>o.m = v</pre>
02750 * where <tt>m</tt> is the identifier name resolved from the current member
02751 * instance of the invocation.
02752 */02753 publicjava.lang.Stringwith(ObjectLikeo,JsStringv){02754 returnwith(o,v.valueOf());02755 }02756 }02757 02758 /**
02759 * <p>Constructs a primitive string instance from a primitive string value.</p>
02760 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
02761 * wrap primitive data types are also "primitive" to JS.</p>
02762 * @since 1.0
02763 * @javascript Re-compilers must ignore the construction operation of this constructor,
02764 * that is, replacing it with its only argument.
02765 */02766 publicString(java.lang.Stringvalue){02767 super(value);02768 }02769 /**
02770 * <p>Constructs a primitive string instance from a primitive string value.</p>
02771 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
02772 * wrap primitive data types are also "primitive" to JS.</p>
02773 * @since 1.0
02774 * @javascript Re-compilers must ignore the construction operation of this constructor,
02775 * that is, replacing it with its only argument.
02776 */02777 publicString(Var<java.lang.String>value){02778 super(value==null?null:value.var());02779 }02780 /**
02781 * <p>Constructs a primitive string instance from a primitive string value.</p>
02782 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
02783 * wrap primitive data types are also "primitive" to JS.</p>
02784 * @since 1.0
02785 * @javascript Re-compilers must ignore the construction operation of this constructor,
02786 * that is, replacing it with its only argument.
02787 */02788 publicString(Objectvalue){02789 super(Js.toString(value));02790 }02791 02792 /**
02793 * <p>Returns the primitive value associated with the current instance, if there is one.</p>
02794 * @return The primitive value associated with the current instance.
02795 * @see #toString()
02796 * @since 1.0
02797 * @javascript Re-compilers must convert the instance invocation of this method directly
02798 * into a JavaScript invocation on its current instance without changing the method
02799 * name, but expanding variable arguments, if any, into comma-separated values.
02800 */02801 @Override02802 publicfinaljava.lang.StringvalueOf(){02803 returnvar();02804 }02805 02806 /**
02807 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
02808 * a string operand, resembling the addition operator in JavaScript.</p>
02809 * <p>If one value is a string, the other is converted to a string, and the two
02810 * strings are then concatenated. Object operands are converted to numbers or strings
02811 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
02812 * method and/or the {@link Js#toString(Object)} method on the object.</p>
02813 * @param other A value or object.
02814 * @return The sum or concatenation of the values.
02815 * @since 1.0
02816 * @javascript Re-compilers must replace the instance invocation of this method with the
02817 * JavaScript expression:
02818 * <pre>p + other</pre>
02819 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02820 */02821 @Override02822 publicfinalStringadd(Objectother){02823 returnnewString(Js.add(var(),other));02824 }02825 02826 /**
02827 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02828 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02829 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02830 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02831 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02832 * may or may not evaluate the right-side expression. The actual behavior of the operator
02833 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02834 * on its left. If the value of this expression can be converted to <tt>false</tt>
02835 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02836 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02837 * its second operand, the expression on its right, and returns the value of that
02838 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02839 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02840 * returning the unconverted value of the left-side expression.</p>
02841 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02842 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02843 * anonymously, returning the actual expression in the method overriding
02844 * {@link Var#var()}.</p>
02845 * <p>Sometimes, this operation probably does not do what the programmers intended.
02846 * To avoid problems, do not use expressions with side effects (assignments, increments,
02847 * decrements, and function calls) for the second operand unless you are quite sure
02848 * you know exactly what you are doing.</p>
02849 * <p>Despite the fairly confusing way that this operation actually works, it is
02850 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02851 * Although it does not actually return a boolean value, the value it returns can always
02852 * be converted to a boolean value.</p>
02853 * <p>Note that, this method is probably useful in emulation codes just for perfect
02854 * re-compilations. However, in most cases you can use the logical AND operator of the
02855 * Java language like this:
02856 * <pre>Js.be(var) && Js.be(other)</pre>
02857 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02858 * JavaScript expression since the Java compilers generally used are free to compile
02859 * the expression into any byte codes they think efficient, making it too hard for the
02860 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02861 * @param other A value or object.
02862 * @return The logical AND of the two operands.
02863 * @since 1.0
02864 * @javascript Re-compilers must replace the instance invocation of this method with the
02865 * JavaScript expression:
02866 * <pre>p && other</pre>
02867 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02868 */02869 @Override02870 publicfinalStringand(java.lang.Stringother){02871 returnnewString(Js.and(this,other));02872 }02873 02874 /**
02875 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02876 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02877 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02878 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02879 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02880 * may or may not evaluate the right-side expression. The actual behavior of the operator
02881 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02882 * on its left. If the value of this expression can be converted to <tt>false</tt>
02883 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02884 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02885 * its second operand, the expression on its right, and returns the value of that
02886 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02887 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02888 * returning the unconverted value of the left-side expression.</p>
02889 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02890 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02891 * anonymously, returning the actual expression in the method overriding
02892 * {@link Var#var()}.</p>
02893 * <p>Sometimes, this operation probably does not do what the programmers intended.
02894 * To avoid problems, do not use expressions with side effects (assignments, increments,
02895 * decrements, and function calls) for the second operand unless you are quite sure
02896 * you know exactly what you are doing.</p>
02897 * <p>Despite the fairly confusing way that this operation actually works, it is
02898 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02899 * Although it does not actually return a boolean value, the value it returns can always
02900 * be converted to a boolean value.</p>
02901 * <p>Note that, this method is probably useful in emulation codes just for perfect
02902 * re-compilations. However, in most cases you can use the logical AND operator of the
02903 * Java language like this:
02904 * <pre>Js.be(var) && Js.be(other)</pre>
02905 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02906 * JavaScript expression since the Java compilers generally used are free to compile
02907 * the expression into any byte codes they think efficient, making it too hard for the
02908 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02909 * @param other A value or object.
02910 * @return The logical AND of the two operands.
02911 * @since 1.0
02912 * @javascript Re-compilers must replace the instance invocation of this method with the
02913 * JavaScript expression:
02914 * <pre>p && other</pre>
02915 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02916 */02917 publicfinalStringand(Value<java.lang.String>other){02918 returnnewString(Js.and(this,other));02919 }02920 02921 /**
02922 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02923 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02924 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02925 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02926 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02927 * may or may not evaluate the right-side expression. The actual behavior of the operator
02928 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02929 * on its left. If the value of this expression can be converted to <tt>false</tt>
02930 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02931 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02932 * its second operand, the expression on its right, and returns the value of that
02933 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02934 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02935 * returning the unconverted value of the left-side expression.</p>
02936 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02937 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02938 * anonymously, returning the actual expression in the method overriding
02939 * {@link Var#var()}.</p>
02940 * <p>Sometimes, this operation probably does not do what the programmers intended.
02941 * To avoid problems, do not use expressions with side effects (assignments, increments,
02942 * decrements, and function calls) for the second operand unless you are quite sure
02943 * you know exactly what you are doing.</p>
02944 * <p>Despite the fairly confusing way that this operation actually works, it is
02945 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02946 * Although it does not actually return a boolean value, the value it returns can always
02947 * be converted to a boolean value.</p>
02948 * <p>Note that, this method is probably useful in emulation codes just for perfect
02949 * re-compilations. However, in most cases you can use the logical AND operator of the
02950 * Java language like this:
02951 * <pre>Js.be(var) && Js.be(other)</pre>
02952 * which is definitely late-evaluated but not necessarily re-compiled into an expected
02953 * JavaScript expression since the Java compilers generally used are free to compile
02954 * the expression into any byte codes they think efficient, making it too hard for the
02955 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
02956 * @param other A value or object.
02957 * @return The logical AND of the two operands.
02958 * @since 1.0
02959 * @javascript Re-compilers must replace the instance invocation of this method with the
02960 * JavaScript expression:
02961 * <pre>p && other</pre>
02962 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
02963 */02964 publicfinalStringand(Stringother){02965 returnnewString(Js.and(this,other));02966 }02967 02968 /**
02969 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
02970 * operation on the two values: it returns <tt>true</tt> if and only if both its first
02971 * operand and its second operand are <tt>true</tt>. If one or both of these operands
02972 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
02973 * <p>In JavaScript, depending on the value of the left-side expression, the operator
02974 * may or may not evaluate the right-side expression. The actual behavior of the operator
02975 * is somewhat more complicated. It starts by evaluating its first operand, the expression
02976 * on its left. If the value of this expression can be converted to <tt>false</tt>
02977 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
02978 * the operator returns the value of the left-side expression. Otherwise, it evaluates
02979 * its second operand, the expression on its right, and returns the value of that
02980 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
02981 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
02982 * returning the unconverted value of the left-side expression.</p>
02983 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
02984 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
02985 * anonymously, returning the actual expression in the method overriding
02986 * {@link Var#var()}.</p>
02987 * <p>Sometimes, this operation probably does not do what the programmers intended.
02988 * To avoid problems, do not use expressions with side effects (assignments, increments,
02989 * decrements, and function calls) for the second operand unless you are quite sure
02990 * you know exactly what you are doing.</p>
02991 * <p>Despite the fairly confusing way that this operation actually works, it is
02992 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
02993 * Although it does not actually return a boolean value, the value it returns can always
02994 * be converted to a boolean value.</p>
02995 * <p>Note that, this method is probably useful in emulation codes just for perfect
02996 * re-compilations. However, in most cases you can use the logical AND operator of the
02997 * Java language like this:
02998 * <pre>Js.be(var) && Js.be(other)</pre>
02999 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03000 * JavaScript expression since the Java compilers generally used are free to compile
03001 * the expression into any byte codes they think efficient, making it too hard for the
03002 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03003 * @param other A value or object.
03004 * @return The logical AND of the two operands.
03005 * @since 1.0
03006 * @javascript Re-compilers must replace the instance invocation of this method with the
03007 * JavaScript expression:
03008 * <pre>p && other</pre>
03009 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03010 */03011 publicfinalJsStringand(JsStringother){03012 returnJs.and(this,other);03013 }03014 03015 /**
03016 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
03017 * operation on the two values: it returns <tt>true</tt> if either the first operand or
03018 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
03019 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
03020 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
03021 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
03022 * its first operand, the expression on its left. If the value of this expression can
03023 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
03024 * expression. Otherwise, it evaluates its second operand, the expression on its right,
03025 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
03026 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
03027 * and doesn't return the unconverted value of the left-side expression.</p>
03028 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
03029 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
03030 * anonymously, returning the actual expression in the method overriding
03031 * {@link Var#var()}.</p>
03032 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
03033 * operands that include side effects, unless you purposely want to use the fact that
03034 * the right-side expression may not be evaluated in JavaScript.</p>
03035 * <p>Even when this operation is used with operands that are not boolean values, it
03036 * can still be considered a Boolean OR operator because its return value, whatever the
03037 * type, can be converted to a boolean value.</p>
03038 * <p>Note that, this method is probably useful in emulation codes just for perfect
03039 * re-compilations. However, in most cases you can use the logical OR operator of the
03040 * Java language like this:
03041 * <pre>Js.be(var) || Js.be(other)</pre>
03042 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03043 * JavaScript expression since the Java compilers generally used are free to compile
03044 * the expression into any byte codes they think efficient, making it too hard for the
03045 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03046 * @param other A value or object.
03047 * @return The logical OR of the two operands.
03048 * @since 1.0
03049 * @javascript Re-compilers must replace the instance invocation of this method with the
03050 * JavaScript expression:
03051 * <pre>p || other</pre>
03052 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03053 */03054 @Override03055 publicfinalStringor(java.lang.Stringother){03056 returnnewString(Js.or(this,other));03057 }03058 03059 /**
03060 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
03061 * operation on the two values: it returns <tt>true</tt> if either the first operand or
03062 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
03063 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
03064 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
03065 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
03066 * its first operand, the expression on its left. If the value of this expression can
03067 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
03068 * expression. Otherwise, it evaluates its second operand, the expression on its right,
03069 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
03070 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
03071 * and doesn't return the unconverted value of the left-side expression.</p>
03072 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
03073 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
03074 * anonymously, returning the actual expression in the method overriding
03075 * {@link Var#var()}.</p>
03076 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
03077 * operands that include side effects, unless you purposely want to use the fact that
03078 * the right-side expression may not be evaluated in JavaScript.</p>
03079 * <p>Even when this operation is used with operands that are not boolean values, it
03080 * can still be considered a Boolean OR operator because its return value, whatever the
03081 * type, can be converted to a boolean value.</p>
03082 * <p>Note that, this method is probably useful in emulation codes just for perfect
03083 * re-compilations. However, in most cases you can use the logical OR operator of the
03084 * Java language like this:
03085 * <pre>Js.be(var) || Js.be(other)</pre>
03086 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03087 * JavaScript expression since the Java compilers generally used are free to compile
03088 * the expression into any byte codes they think efficient, making it too hard for the
03089 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03090 * @param other A value or object.
03091 * @return The logical OR of the two operands.
03092 * @since 1.0
03093 * @javascript Re-compilers must replace the instance invocation of this method with the
03094 * JavaScript expression:
03095 * <pre>p || other</pre>
03096 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03097 */03098 publicfinalStringor(Value<java.lang.String>other){03099 returnnewString(Js.or(this,other));03100 }03101 03102 /**
03103 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
03104 * operation on the two values: it returns <tt>true</tt> if either the first operand or
03105 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
03106 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
03107 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
03108 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
03109 * its first operand, the expression on its left. If the value of this expression can
03110 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
03111 * expression. Otherwise, it evaluates its second operand, the expression on its right,
03112 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
03113 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
03114 * and doesn't return the unconverted value of the left-side expression.</p>
03115 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
03116 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
03117 * anonymously, returning the actual expression in the method overriding
03118 * {@link Var#var()}.</p>
03119 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
03120 * operands that include side effects, unless you purposely want to use the fact that
03121 * the right-side expression may not be evaluated in JavaScript.</p>
03122 * <p>Even when this operation is used with operands that are not boolean values, it
03123 * can still be considered a Boolean OR operator because its return value, whatever the
03124 * type, can be converted to a boolean value.</p>
03125 * <p>Note that, this method is probably useful in emulation codes just for perfect
03126 * re-compilations. However, in most cases you can use the logical OR operator of the
03127 * Java language like this:
03128 * <pre>Js.be(var) || Js.be(other)</pre>
03129 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03130 * JavaScript expression since the Java compilers generally used are free to compile
03131 * the expression into any byte codes they think efficient, making it too hard for the
03132 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03133 * @param other A value or object.
03134 * @return The logical OR of the two operands.
03135 * @since 1.0
03136 * @javascript Re-compilers must replace the instance invocation of this method with the
03137 * JavaScript expression:
03138 * <pre>p || other</pre>
03139 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03140 */03141 publicfinalStringor(Stringother){03142 returnnewString(Js.or(this,other));03143 }03144 03145 /**
03146 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
03147 * operation on the two values: it returns <tt>true</tt> if either the first operand or
03148 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
03149 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
03150 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
03151 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
03152 * its first operand, the expression on its left. If the value of this expression can
03153 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
03154 * expression. Otherwise, it evaluates its second operand, the expression on its right,
03155 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
03156 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
03157 * and doesn't return the unconverted value of the left-side expression.</p>
03158 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
03159 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
03160 * anonymously, returning the actual expression in the method overriding
03161 * {@link Var#var()}.</p>
03162 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
03163 * operands that include side effects, unless you purposely want to use the fact that
03164 * the right-side expression may not be evaluated in JavaScript.</p>
03165 * <p>Even when this operation is used with operands that are not boolean values, it
03166 * can still be considered a Boolean OR operator because its return value, whatever the
03167 * type, can be converted to a boolean value.</p>
03168 * <p>Note that, this method is probably useful in emulation codes just for perfect
03169 * re-compilations. However, in most cases you can use the logical OR operator of the
03170 * Java language like this:
03171 * <pre>Js.be(var) || Js.be(other)</pre>
03172 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03173 * JavaScript expression since the Java compilers generally used are free to compile
03174 * the expression into any byte codes they think efficient, making it too hard for the
03175 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03176 * @param other A value or object.
03177 * @return The logical OR of the two operands.
03178 * @since 1.0
03179 * @javascript Re-compilers must replace the instance invocation of this method with the
03180 * JavaScript expression:
03181 * <pre>p || other</pre>
03182 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03183 */03184 publicfinalStringor(JsStringother){03185 returnnewString(Js.or(this,other));03186 }03187 03188 /**
03189 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
03190 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
03191 * operand, otherwise.</p>
03192 * <p>The first operand of the conditional operation must be (or be convertible to) a
03193 * boolean value. Usually this is the result of a comparison operation. The second and
03194 * third operands may have any value. The value returned by the conditional operation
03195 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
03196 * the value of the conditional expression is the value of the second operand. If the
03197 * first operand is <tt>false</tt>, the value of the conditional expression is the
03198 * value of the third operand.</p>
03199 * <p>To make the second and third operands really late-evaluated or not evaluated in
03200 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
03201 * {@link Var} anonymously, returning the actual expression in the method overriding
03202 * {@link Var#var()}.</p>
03203 * <p>Note that, this method is probably useful in emulation codes just for perfect
03204 * re-compilations. However, in most cases you can use the conditional operator of the
03205 * Java language like this:
03206 * <pre>Js.be(test) ? var : other</pre>
03207 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03208 * JavaScript expression since the Java compilers generally used are free to compile
03209 * the expression into any byte codes they think efficient, making it too hard for the
03210 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03211 * @param other A value or object.
03212 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
03213 * the third operand.
03214 * @since 1.0
03215 * @javascript Re-compilers must replace the instance invocation of this method with the
03216 * JavaScript expression:
03217 * <pre>test ? p : other</pre>
03218 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03219 */03220 @Override03221 publicfinalStringcond(Objecttest,java.lang.Stringother){03222 returnJs.be(test)?this:newString(other);03223 }03224 03225 /**
03226 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
03227 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
03228 * operand, otherwise.</p>
03229 * <p>The first operand of the conditional operation must be (or be convertible to) a
03230 * boolean value. Usually this is the result of a comparison operation. The second and
03231 * third operands may have any value. The value returned by the conditional operation
03232 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
03233 * the value of the conditional expression is the value of the second operand. If the
03234 * first operand is <tt>false</tt>, the value of the conditional expression is the
03235 * value of the third operand.</p>
03236 * <p>To make the second and third operands really late-evaluated or not evaluated in
03237 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
03238 * {@link Var} anonymously, returning the actual expression in the method overriding
03239 * {@link Var#var()}.</p>
03240 * <p>Note that, this method is probably useful in emulation codes just for perfect
03241 * re-compilations. However, in most cases you can use the conditional operator of the
03242 * Java language like this:
03243 * <pre>Js.be(test) ? var : other</pre>
03244 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03245 * JavaScript expression since the Java compilers generally used are free to compile
03246 * the expression into any byte codes they think efficient, making it too hard for the
03247 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03248 * @param other A value or object.
03249 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
03250 * the third operand.
03251 * @since 1.0
03252 * @javascript Re-compilers must replace the instance invocation of this method with the
03253 * JavaScript expression:
03254 * <pre>test ? p : other</pre>
03255 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03256 */03257 publicfinalStringcond(Objecttest,Value<java.lang.String>other){03258 returnJs.be(test)?this:newString(other);03259 }03260 03261 /**
03262 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
03263 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
03264 * operand, otherwise.</p>
03265 * <p>The first operand of the conditional operation must be (or be convertible to) a
03266 * boolean value. Usually this is the result of a comparison operation. The second and
03267 * third operands may have any value. The value returned by the conditional operation
03268 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
03269 * the value of the conditional expression is the value of the second operand. If the
03270 * first operand is <tt>false</tt>, the value of the conditional expression is the
03271 * value of the third operand.</p>
03272 * <p>To make the second and third operands really late-evaluated or not evaluated in
03273 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
03274 * {@link Var} anonymously, returning the actual expression in the method overriding
03275 * {@link Var#var()}.</p>
03276 * <p>Note that, this method is probably useful in emulation codes just for perfect
03277 * re-compilations. However, in most cases you can use the conditional operator of the
03278 * Java language like this:
03279 * <pre>Js.be(test) ? var : other</pre>
03280 * which is definitely late-evaluated but not necessarily re-compiled into an expected
03281 * JavaScript expression since the Java compilers generally used are free to compile
03282 * the expression into any byte codes they think efficient, making it too hard for the
03283 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
03284 * @param other A value or object.
03285 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
03286 * the third operand.
03287 * @since 1.0
03288 * @javascript Re-compilers must replace the instance invocation of this method with the
03289 * JavaScript expression:
03290 * <pre>test ? p : other</pre>
03291 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03292 */03293 publicfinalStringcond(Objecttest,Stringother){03294 returnJs.be(test)?this:other;03295 }03296 03297 /**
03298 * <p>Concatenates a string operand to the current primitive instance and returns
03299 * the string operand, resembling the assignment-with-addition operator in
03300 * JavaScript.</p>
03301 * <p>If one value is a string, the other is converted to a string, and the two
03302 * strings are then concatenated. Object operands are converted to numbers or strings
03303 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
03304 * method and/or the {@link Js#toString(Object)} method on the object.</p>
03305 * @param other A value or object.
03306 * @return The string value of the argument.
03307 * @since 1.0
03308 * @javascript Re-compilers must replace the instance invocation of this method with the
03309 * JavaScript expression:
03310 * <pre>p += other</pre>
03311 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03312 */03313 publicfinaljava.lang.Stringaadd(Objectother){03314 returnvar((java.lang.String)Js.add(var(),other));03315 }03316 03317 /**
03318 * <p>Evaluates the current primitive string instance as JavaScript code and
03319 * returns the result.</p>
03320 * <p>In JavaScript, <tt>eval()</tt> is a global method that evaluates a string of
03321 * JavaScript code in the current lexical scope. If the code contains an expression,
03322 * eval evaluates the expression and returns its value. If the code contains a
03323 * JavaScript statement or statements, it executes those statements and returns the
03324 * value, if any, returned by the last statement. If the code does not return any
03325 * value, <tt>eval()</tt> returns undefined. Finally, if code throws an exception,
03326 * <tt>eval()</tt> passes that exception on to the caller.</p>
03327 * <p>The global function <tt>eval()</tt> provides a very powerful capability to
03328 * the JavaScript language, but its use is infrequent in real-world programs.
03329 * Obvious uses are to write programs that act as recursive JavaScript interpreters
03330 * and to write programs that dynamically generate and evaluate JavaScript code.</p>
03331 * <p>Most JavaScript functions and methods that expect string arguments accept
03332 * arguments of other types as well and simply convert those argument values to
03333 * strings before proceeding. <tt>eval()</tt> does not behave like this. If the
03334 * code argument is not a primitive string, it is simply returned unchanged. Be
03335 * careful, therefore, that you do not inadvertently pass a String object to
03336 * <tt>eval()</tt> when you intended to pass a primitive string value.</p>
03337 * <p>For purposes of implementation efficiency, the ECMAScript v3 standard places
03338 * an unusual restriction on the use of <tt>eval()</tt>. An ECMAScript implementation
03339 * is allowed to throw an <tt>EvalError</tt> exception if you attempt to overwrite
03340 * the <tt>eval</tt> property or if you assign the <tt>eval()</tt> method to another
03341 * property and attempt to invoke it through that property.</p>
03342 * @return The return value of the evaluated code, if any.
03343 * @throws RuntimeException JavaScript throws a <tt>SyntaxError</tt> if the current
03344 * primitive instance does not contain legal JavaScript, a <tt>EvalError</tt> if
03345 * the <tt>eval</tt> function was called illegally, through an identifier other
03346 * than "eval", or other JavaScript error generated by the code passed. See
03347 * {@link Js#err(Object)}, {@link js.core.JsSyntaxError}, {@link js.core.JsEvalError},
03348 * and {@link js.core.JsError} for JS Simulation.
03349 * @since 1.0
03350 * @javascript Re-compilers must replace the instance invocation of this method with the
03351 * JavaScript expression:
03352 * <pre>eval(p)</pre>
03353 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
03354 */03355 publicfinalObjecteval(){03356 returnJs.core().eval(var());03357 }03358 03359 /**
03360 * <p>Gets the length of the current string, an integer that indicates the number of
03361 * characters in the current string. For any string <tt>s</tt>, the index of the
03362 * last character is <tt>s.length() - 1</tt>. The length property of a string may
03363 * not be deleted.</p>
03364 * @return The length of the current string.
03365 * @see jsx.core.StringLikes#length(StringLike)
03366 * @since 1.0
03367 * @javascript Re-compilers must convert the instance invocation of this method into the
03368 * JavaScript expression:
03369 * <pre>s.length</pre>
03370 * where <tt>s</tt> is the current string instance of the invocation.
03371 */03372 publicfinalintlength(){03373 returnvar().length();03374 }03375 /**
03376 * <p>Returns the character string of length 1 at the specified <tt>index</tt> within
03377 * the current string. An index ranges from 0 to <tt>length() - 1</tt>. The first
03378 * character of the sequence is at index 0, the next at index 1, and so on, as for
03379 * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>,
03380 * this invocation returns an empty string.</p>
03381 * @param index The index of the character
03382 * @return The character string of length 1 at the specified index of the current string
03383 * @see #charCodeAt(Object)
03384 * @see #indexOf(Object)
03385 * @see #indexOf(Object, Object)
03386 * @see #lastIndexOf(Object)
03387 * @see #lastIndexOf(Object, Object)
03388 * @see jsx.core.StringLikes#charAt(StringLike, Object)
03389 * @see jsx.core.StringLikes#charAt(String, Object)
03390 * @since 1.0
03391 * @javascript Re-compilers must convert the instance invocation of this method directly
03392 * into a JavaScript invocation on its current primitive instance without changing the
03393 * method name, but expanding variable arguments, if any, into comma-separated values.
03394 */03395 publicfinaljava.lang.StringcharAt(Objectindex){03396 returnJs.s().stringLike(var()).charAt(index);03397 }03398 /**
03399 * <p>Returns the character encoding at a specific <tt>index</tt> within the current
03400 * string. An index ranges from 0 to <tt>length() - 1</tt>. The first
03401 * character of the sequence is at index 0, the next at index 1, and so on, as for
03402 * array indexing. If <tt>index</tt> is not between 0 and <tt>length() - 1</tt>,
03403 * this invocation returns <tt>NaN</tt>.</p>
03404 * @param index The index of the character
03405 * @return The Unicode encoding of the character within the current string. The return
03406 * value is a 16-bit integer between 0 and 65535.
03407 * @see #charAt(Object)
03408 * @see #indexOf(Object)
03409 * @see #indexOf(Object, Object)
03410 * @see #lastIndexOf(Object)
03411 * @see #lastIndexOf(Object, Object)
03412 * @see jsx.core.StringLikes#charCodeAt(StringLike, Object)
03413 * @see jsx.core.StringLikes#charCodeAt(String, Object)
03414 * @since 1.0
03415 * @javascript Re-compilers must convert the instance invocation of this method directly
03416 * into a JavaScript invocation on its current primitive instance without changing the
03417 * method name, but expanding variable arguments, if any, into comma-separated values.
03418 */03419 publicfinaljava.lang.CharactercharCodeAt(Objectindex){03420 returnJs.s().stringLike(var()).charCodeAt(index);03421 }03422 /**
03423 * <p>Converts the argument to a string (if necessary) and appends them, in order, to
03424 * the end of the current string and returns the resulting concatenation.</p>
03425 * <p>Note that the current string itself is not modified.</p>
03426 * <p>This method is an analog to {@link ArrayLike#concat(Object)}. Note that it is
03427 * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
03428 * @param other A value to be concatenated to the current string
03429 * @return A new string that results from concatenating the argument to the current
03430 * string.
03431 * @see #concat(Vars)
03432 * @see ArrayLike#concat(Object)
03433 * @see ArrayLike#concat(Vars)
03434 * @see jsx.core.StringLikes#concat(StringLike, Object)
03435 * @see jsx.core.StringLikes#concat(String, Object)
03436 * @since 1.0
03437 * @javascript Re-compilers must convert the instance invocation of this method directly
03438 * into a JavaScript invocation on its current primitive instance without changing the
03439 * method name, but expanding variable arguments, if any, into comma-separated values.
03440 */03441 publicfinaljava.lang.Stringconcat(Objectother){03442 returnJs.s().stringLike(var()).concat(other);03443 }03444 /**
03445 * <p>Converts each of the argument values to a string (if necessary) and appends them,
03446 * in order, to the end of the current string and returns the resulting concatenation.</p>
03447 * <p>Note that the current string itself is not modified.</p>
03448 * <p>This method is an analog to {@link ArrayLike#concat(Vars)}. Note that it is
03449 * often easier to use {@link Js#add(Object, Object)} perform string concatenation.</p>
03450 * @param args A list of the values to be concatenated to the current string
03451 * @return A new string that results from concatenating each of the argument values
03452 * to the current string.
03453 * @see #concat(Object)
03454 * @see ArrayLike#concat(Object)
03455 * @see ArrayLike#concat(Vars)
03456 * @since 1.0
03457 * @javascript Re-compilers must convert the instance invocation of this method directly
03458 * into a JavaScript invocation on its current primitive instance without changing the
03459 * method name, but expanding variable arguments, if any, into comma-separated values.
03460 */03461 publicfinaljava.lang.Stringconcat(Vars<?>args){03462 returnJs.s().stringLike(var()).concat(args);03463 }03464 /**
03465 * <p>Searches the current string instance from beginning to end to see if it contains
03466 * an occurrence of the substring <tt>other</tt>. The search begins at the beginning
03467 * of the current string. If an occurrence of the substring is found, this invocation
03468 * returns the position of the first character of the first occurrence of the substring
03469 * within the current string. Character positions within string are numbered starting with
03470 * zero. If no occurrence of substring is found within the current string, this invocation
03471 * returns -1.</p>
03472 * @param other The substring that is to be searched for within the current string
03473 * @return The position of the first occurrence of <tt>other</tt> within string, if
03474 * any, or -1 if no such occurrence is found.
03475 * @see #indexOf(Object, Object)
03476 * @see #charAt(Object)
03477 * @see #lastIndexOf(Object)
03478 * @see #lastIndexOf(Object, Object)
03479 * @see #substr(Object)
03480 * @see #substr(Object, Object)
03481 * @see #substring(Object)
03482 * @see #substring(Object, Object)
03483 * @see jsx.core.StringLikes#indexOf(StringLike, Object)
03484 * @see jsx.core.StringLikes#indexOf(String, Object)
03485 * @since 1.0
03486 * @javascript Re-compilers must convert the instance invocation of this method directly
03487 * into a JavaScript invocation on its current primitive instance without changing the
03488 * method name, but expanding variable arguments, if any, into comma-separated values.
03489 */03490 publicfinaljava.lang.IntegerindexOf(Objectother){03491 returnJs.s().stringLike(var()).indexOf(other);03492 }03493 /**
03494 * <p>Searches the current string instance from beginning to end to see if it contains
03495 * an occurrence of the substring <tt>other</tt>. The search begins at position
03496 * <tt>pos</tt> within string, or at the beginning of string if <tt>pos</tt> is
03497 * undefined. If an occurrence of the substring is found, this invocation returns the
03498 * position of the first character of the first occurrence of the substring within
03499 * the current string. Character positions within string are numbered starting with
03500 * zero. If no occurrence of substring is found within the current string, this invocation
03501 * returns -1.</p>
03502 * @param other The substring that is to be searched for within the current string
03503 * @param pos An optional integer argument that specifies the position within the
03504 * current string at which the search is to start. Legal values are 0 (the position of
03505 * the first character in the string) to <tt>length() - 1</tt> (the position of
03506 * the last character in the string). If this argument is undefined, the search begins
03507 * at the first character of the string
03508 * @return The position of the first occurrence of <tt>other</tt> within string that
03509 * appears after the <tt>pos</tt> position, if any, or -1 if no such occurrence
03510 * is found.
03511 * @see #indexOf(Object)
03512 * @see #charAt(Object)
03513 * @see #lastIndexOf(Object)
03514 * @see #lastIndexOf(Object, Object)
03515 * @see #substr(Object)
03516 * @see #substr(Object, Object)
03517 * @see #substring(Object)
03518 * @see #substring(Object, Object)
03519 * @see jsx.core.StringLikes#indexOf(StringLike, Object, Object)
03520 * @see jsx.core.StringLikes#indexOf(String, Object, Object)
03521 * @since 1.0
03522 * @javascript Re-compilers must convert the instance invocation of this method directly
03523 * into a JavaScript invocation on its current primitive instance without changing the
03524 * method name, but expanding variable arguments, if any, into comma-separated values.
03525 */03526 publicfinaljava.lang.IntegerindexOf(Objectother,Objectpos){03527 returnJs.s().stringLike(var()).indexOf(other,pos);03528 }03529 /**
03530 * <p>Searches the current string instance from end to beginning to see if it contains
03531 * an occurrence of the substring <tt>other</tt>. The search begins at the end
03532 * of the current string. If an occurrence of the substring is found, this invocation
03533 * returns the position of the first character of that occurrence. If no occurrence of
03534 * substring is found within the current string, this invocation returns -1.</p>
03535 * @param other The substring that is to be searched for within the current string
03536 * @return The position of the last occurrence of <tt>other</tt> within string, if
03537 * any, or -1 if no such occurrence is found.
03538 * @see #lastIndexOf(Object, Object)
03539 * @see #charAt(Object)
03540 * @see #indexOf(Object)
03541 * @see #indexOf(Object, Object)
03542 * @see #substr(Object)
03543 * @see #substr(Object, Object)
03544 * @see #substring(Object)
03545 * @see #substring(Object, Object)
03546 * @see jsx.core.StringLikes#lastIndexOf(StringLike, Object)
03547 * @see jsx.core.StringLikes#lastIndexOf(String, Object)
03548 * @since 1.0
03549 * @javascript Re-compilers must convert the instance invocation of this method directly
03550 * into a JavaScript invocation on its current primitive instance without changing the
03551 * method name, but expanding variable arguments, if any, into comma-separated values.
03552 */03553 publicfinaljava.lang.IntegerlastIndexOf(Objectother){03554 returnJs.s().stringLike(var()).lastIndexOf(other);03555 }03556 /**
03557 * <p>Searches the current string instance from end to beginning to see if it contains
03558 * an occurrence of the substring <tt>other</tt>. The search begins at position
03559 * <tt>pos</tt> within string, or at the end of string if <tt>pos</tt> is
03560 * undefined. If an occurrence of the substring is found, this invocation returns the
03561 * position of the first character that occurrence. Since this method
03562 * searches from end to beginning of the string, the first occurrence found is the last
03563 * one in the string that occurs before the <tt>pos</tt> position. If no occurrence
03564 * of substring is found within the current string, this invocation returns -1.</p>
03565 * @param other The substring that is to be searched for within the current string
03566 * @param pos An optional integer argument that specifies the position within the
03567 * current string at which the search is to start. Legal values are 0 (the position of
03568 * the first character in the string) to <tt>length() - 1</tt> (the position of
03569 * the last character in the string). If this argument is undefined, the search begins
03570 * at the last character of the string
03571 * @return The position of the last occurrence of <tt>other</tt> within string that
03572 * appears before the <tt>pos</tt> position, if any, or -1 if no such occurrence
03573 * is found.
03574 * @see #lastIndexOf(Object)
03575 * @see #charAt(Object)
03576 * @see #indexOf(Object)
03577 * @see #indexOf(Object, Object)
03578 * @see #substr(Object)
03579 * @see #substr(Object, Object)
03580 * @see #substring(Object)
03581 * @see #substring(Object, Object)
03582 * @see jsx.core.StringLikes#lastIndexOf(StringLike, Object, Object)
03583 * @see jsx.core.StringLikes#lastIndexOf(String, Object, Object)
03584 * @since 1.0
03585 * @javascript Re-compilers must convert the instance invocation of this method directly
03586 * into a JavaScript invocation on its current primitive instance without changing the
03587 * method name, but expanding variable arguments, if any, into comma-separated values.
03588 */03589 publicfinaljava.lang.IntegerlastIndexOf(Objectother,Objectpos){03590 returnJs.s().stringLike(var()).lastIndexOf(other,pos);03591 }03592 /**
03593 * <p>Compares strings taking the collation order of the default locale into account.</p>
03594 * <p>The ECMAScript standard does not specify how the locale-specific comparison is done;
03595 * it merely specifies that this function utilize the collation order provided by the
03596 * underlying operating system.</p>
03597 * @param other A string to be compared, in a locale-sensitive fashion, with the current string
03598 * @return An integer number that indicates the result of the comparison. If the current
03599 * string is "less than" the string <tt>other</tt>, this invocation returns a
03600 * number less than zero. If the current string is "greater than" <tt>other</tt>,
03601 * it returns a integer number greater than zero. And if the strings are identical or
03602 * indistinguishable according to the locale ordering conventions, the method returns 0.
03603 * @see jsx.core.StringLikes#localeCompare(StringLike, Object)
03604 * @see jsx.core.StringLikes#localeCompare(String, Object)
03605 * @since 1.0
03606 * @javascript Re-compilers must convert the instance invocation of this method directly
03607 * into a JavaScript invocation on its current primitive instance without changing the
03608 * method name, but expanding variable arguments, if any, into comma-separated values.
03609 */03610 publicfinaljava.lang.IntegerlocaleCompare(Objectother){03611 returnJs.s().stringLike(var()).localeCompare(other);03612 }03613 /**
03614 * <p>Searches the current string for one or more matches of <tt>regexp</tt>.
03615 * The behavior of this invocation depends significantly on whether <tt>regexp</tt>
03616 * has the "g" attribute or not .</p>
03617 * <p>If <tt>regexp</tt> does not have the "g" attribute, this invocation searches
03618 * string for a single match. If no match is found, it returns <tt>null</tt>.
03619 * Otherwise, it returns an array containing information about the match that it found.
03620 * Element 0 of the array contains the matched text. The remaining elements contain
03621 * the text that matches any parenthesized subexpressions within the regular expression.
03622 * In addition to these normal array elements, the returned array also has two object
03623 * properties. The <tt>index</tt> property (see {@link ArrayLike#index()}) of the array
03624 * specifies the character position within string of the start of the matched text. Also,
03625 * the <tt>input</tt> property (see {@link ArrayLike#input()}) of the returned array
03626 * is a reference to string itself.</p>
03627 * <p>If <tt>regexp</tt> has the "g" flag, this invocation does a global search,
03628 * searching string for all matching substrings. It returns <tt>null</tt> if no
03629 * match is found, and it returns an array if one or more matches are found. The
03630 * contents of this returned array are quite different for global matches, however. In
03631 * this case, the array elements contain each of the matched substrings within string.
03632 * The returned array does not have <tt>index</tt> (see {@link ArrayLike#index()})
03633 * or <tt>input</tt> (see {@link ArrayLike#input()}) properties in this case. Note
03634 * that for global matches, this invocation does not provide information about
03635 * parenthesized subexpressions, nor does it specify where within string each match
03636 * occurred. If you need to obtain this information for a global search, you can use
03637 * {@link RegExpLike#exec(Object)}.</p>
03638 * @param regexp A RegExp object that specifies the pattern to be matched
03639 * @return An array containing the results of the match. The contents of the array
03640 * depend on whether regexp has the global "g" attribute set.
03641 * @see #replace(RegExpLike, String)
03642 * @see #replace(RegExpLike, StringLike)
03643 * @see #replace(RegExpLike, JsFunction)
03644 * @see #search(RegExpLike)
03645 * @see ArrayLike#index()
03646 * @see ArrayLike#input()
03647 * @see Js#re(String)
03648 * @see Js#re(String, String)
03649 * @see RegExpLike#exec(Object)
03650 * @see RegExpLike#test(Object)
03651 * @see jsx.core.StringLikes#match(StringLike, RegExpLike)
03652 * @see jsx.core.StringLikes#match(String, RegExpLike)
03653 * @since 1.0
03654 * @javascript Re-compilers must convert the instance invocation of this method directly
03655 * into a JavaScript invocation on its current primitive instance without changing the
03656 * method name, but expanding variable arguments, if any, into comma-separated values.
03657 */03658 publicfinalArrayLike<?>match(RegExpLikeregexp){03659 returnJs.s().stringLike(var()).match(regexp);03660 }03661 /**
03662 * <p>Performs a search-and-replace operation on the current string.</p>
03663 * <p>This invocation searches the current string for one or more substrings that
03664 * match <tt>regexp</tt> and replaces them with the replacement string
03665 * <tt>newSubStr</tt>.</p>
03666 * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation
03667 * replaces all matching substrings. Otherwise, it replaces only the first matching
03668 * substring.</p>
03669 * <p>Note that the $ character has special meaning within the replacement string
03670 * <tt>newSubStr</tt>. As shown in the following, it indicates that a string
03671 * derived from the pattern match is used in the replacement.</p>
03672 * <ul>
03673 * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized
03674 * subexpression within <tt>regexp</tt></li>
03675 * <li>$& The substring that matched <tt>regexp</tt></li>
03676 * <li>$' The text to the left of the matched substring</li>
03677 * <li>$' The text to the right of the matched substring</li>
03678 * <li>$$ A literal dollar sign</li>
03679 * </ul>
03680 * @param regexp The RegExp object that specifies the pattern to be replaced
03681 * @param newSubStr A string that specifies the replacement text
03682 * @return A new string, with the first match, or all matches, of <tt>regexp</tt>
03683 * replaced with the replacement.
03684 * @see #replace(RegExpLike, StringLike)
03685 * @see #replace(RegExpLike, JsFunction)
03686 * @see #match(RegExpLike)
03687 * @see #search(RegExpLike)
03688 * @see Js#re(String)
03689 * @see Js#re(String, String)
03690 * @see RegExpLike#exec(Object)
03691 * @see RegExpLike#test(Object)
03692 * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, String)
03693 * @see jsx.core.StringLikes#replace(String, RegExpLike, String)
03694 * @since 1.0
03695 * @javascript Re-compilers must convert the instance invocation of this method directly
03696 * into a JavaScript invocation on its current primitive instance without changing the
03697 * method name, but expanding variable arguments, if any, into comma-separated values.
03698 */03699 publicfinaljava.lang.Stringreplace(RegExpLikeregexp,java.lang.StringnewSubStr){03700 returnJs.s().stringLike(var()).replace(regexp,newSubStr);03701 }03702 /**
03703 * <p>Performs a search-and-replace operation on the current string.</p>
03704 * <p>This invocation searches the current string for one or more substrings that
03705 * match <tt>regexp</tt> and replaces them with the replacement string
03706 * <tt>newSubStr</tt>.</p>
03707 * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation
03708 * replaces all matching substrings. Otherwise, it replaces only the first matching
03709 * substring.</p>
03710 * <p>Note that the $ character has special meaning within the replacement string
03711 * <tt>newSubStr</tt>. As shown in the following, it indicates that a string
03712 * derived from the pattern match is used in the replacement.</p>
03713 * <ul>
03714 * <li>$1, $2, ..., $99 The text that matched the 1st through 99th parenthesized
03715 * subexpression within <tt>regexp</tt></li>
03716 * <li>$& The substring that matched <tt>regexp</tt></li>
03717 * <li>$' The text to the left of the matched substring</li>
03718 * <li>$' The text to the right of the matched substring</li>
03719 * <li>$$ A literal dollar sign</li>
03720 * </ul>
03721 * @param regexp The RegExp object that specifies the pattern to be replaced
03722 * @param newSubStr A string that specifies the replacement text
03723 * @return A new string, with the first match, or all matches, of <tt>regexp</tt>
03724 * replaced with the replacement.
03725 * @see #replace(RegExpLike, String)
03726 * @see #replace(RegExpLike, JsFunction)
03727 * @see #match(RegExpLike)
03728 * @see #search(RegExpLike)
03729 * @see Js#re(String)
03730 * @see Js#re(String, String)
03731 * @see RegExpLike#exec(Object)
03732 * @see RegExpLike#test(Object)
03733 * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, StringLike)
03734 * @see jsx.core.StringLikes#replace(String, RegExpLike, StringLike)
03735 * @since 1.0
03736 * @javascript Re-compilers must convert the instance invocation of this method directly
03737 * into a JavaScript invocation on its current primitive instance without changing the
03738 * method name, but expanding variable arguments, if any, into comma-separated values.
03739 */03740 publicfinaljava.lang.Stringreplace(RegExpLikeregexp,StringLikenewSubStr){03741 returnJs.s().stringLike(var()).replace(regexp,newSubStr);03742 }03743 /**
03744 * <p>Performs a search-and-replace operation on the current string.</p>
03745 * <p>This invocation searches the current string for one or more substrings that
03746 * match <tt>regexp</tt> and replaces them with the replacement string generated by
03747 * <tt>lambda</tt>.</p>
03748 * <p>If <tt>regexp</tt> has the global "g" attribute specified, this invocation
03749 * replaces all matching substrings. Otherwise, it replaces only the first matching
03750 * substring.</p>
03751 * @param regexp The RegExp object that specifies the pattern to be replaced
03752 * @param lambda A function that is invoked to generate the replacement text
03753 * @return A new string, with the first match, or all matches, of <tt>regexp</tt>
03754 * replaced with the replacement.
03755 * @see #replace(RegExpLike, String)
03756 * @see #replace(RegExpLike, StringLike)
03757 * @see #match(RegExpLike)
03758 * @see #search(RegExpLike)
03759 * @see Js#re(String)
03760 * @see Js#re(String, String)
03761 * @see RegExpLike#exec(Object)
03762 * @see RegExpLike#test(Object)
03763 * @see jsx.core.StringLikes#replace(StringLike, RegExpLike, JsFunction)
03764 * @see jsx.core.StringLikes#replace(String, RegExpLike, JsFunction)
03765 * @since 1.0
03766 * @javascript Re-compilers must convert the instance invocation of this method directly
03767 * into a JavaScript invocation on its current primitive instance without changing the
03768 * method name, but expanding variable arguments, if any, into comma-separated values.
03769 */03770 publicfinaljava.lang.Stringreplace(RegExpLikeregexp,JsFunction<java.lang.String>lambda){03771 returnJs.s().stringLike(var()).replace(regexp,lambda);03772 }03773 /**
03774 * <p>Looks for a substring matching <tt>regexp</tt> within the current string
03775 * and returns the position of the first character of the matching substring,
03776 * or -1 if no match was found.</p>
03777 * <p>This invocation does not do global matches; it ignores the "g" flag of
03778 * <tt>regexp</tt>. It also ignores the <tt>lastIndex</tt> property
03779 * (see {@link RegExpLike#lastIndex()} and {@link RegExpLike#lastIndex(Integer)}) of
03780 * <tt>regexp</tt> and always searches from the beginning of the string, which
03781 * means that it always returns the position of the first match in the string.</p>
03782 * @param regexp A RegExp object that specifies the pattern to be searched for in the current string.
03783 * @return The position of the start of the first substring of the current string
03784 * that matches <tt>regexp</tt>, or -1 if no match is found.
03785 * @see #replace(RegExpLike, String)
03786 * @see #replace(RegExpLike, StringLike)
03787 * @see #replace(RegExpLike, JsFunction)
03788 * @see #match(RegExpLike)
03789 * @see Js#re(String)
03790 * @see Js#re(String, String)
03791 * @see RegExpLike#exec(Object)
03792 * @see RegExpLike#test(Object)
03793 * @see jsx.core.StringLikes#search(StringLike, RegExpLike)
03794 * @see jsx.core.StringLikes#search(String, RegExpLike)
03795 * @since 1.0
03796 * @javascript Re-compilers must convert the instance invocation of this method directly
03797 * into a JavaScript invocation on its current primitive instance without changing the
03798 * method name, but expanding variable arguments, if any, into comma-separated values.
03799 */03800 publicfinaljava.lang.Integersearch(RegExpLikeregexp){03801 returnJs.s().stringLike(var()).search(regexp);03802 }03803 /**
03804 * <p>Returns a string containing a slice, or substring, of the current string without
03805 * modify it.</p>
03806 * @param begin The string index where the slice is to begin. If negative, this argument
03807 * specifies a position measured from the end of the string. That is, -1 indicates the
03808 * last character, -2 indicates the second from last character, and so on.
03809 * @return A new string that contains all the characters of string from and including
03810 * <tt>begin</tt>.
03811 * @see #slice(Object, Object)
03812 * @see #substr(Object)
03813 * @see #substr(Object, Object)
03814 * @see #substring(Object)
03815 * @see #substring(Object, Object)
03816 * @see ArrayLike#slice(Object)
03817 * @see ArrayLike#slice(Object, Object)
03818 * @see ArrayLike#slice(Vars)
03819 * @see jsx.core.StringLikes#slice(StringLike, Object)
03820 * @see jsx.core.StringLikes#slice(String, Object)
03821 * @since 1.0
03822 * @javascript Re-compilers must convert the instance invocation of this method directly
03823 * into a JavaScript invocation on its current primitive instance without changing the
03824 * method name, but expanding variable arguments, if any, into comma-separated values.
03825 */03826 publicfinaljava.lang.Stringslice(Objectbegin){03827 returnJs.s().stringLike(var()).slice(begin);03828 }03829 /**
03830 * <p>Returns a string containing a slice, or substring, of the current string without
03831 * modify it.</p>
03832 * @param begin The string index where the slice is to begin. If negative, this argument
03833 * specifies a position measured from the end of the string. That is, -1 indicates the
03834 * last character, -2 indicates the second from last character, and so on.
03835 * @param end The string index immediately after the end of the slice. If undefined,
03836 * the slice includes all characters from <tt>begin</tt> to the end of the string.
03837 * If this argument is negative, it specifies a position measured from the end of the
03838 * string.
03839 * @return A new string that contains all the characters of string from and including
03840 * <tt>begin</tt>, and up to but not including <tt>end</tt>.
03841 * @see #slice(Object, Object)
03842 * @see #substr(Object)
03843 * @see #substr(Object, Object)
03844 * @see #substring(Object)
03845 * @see #substring(Object, Object)
03846 * @see ArrayLike#slice(Object)
03847 * @see ArrayLike#slice(Object, Object)
03848 * @see ArrayLike#slice(Vars)
03849 * @see jsx.core.StringLikes#slice(StringLike, Object, Object)
03850 * @see jsx.core.StringLikes#slice(String, Object, Object)
03851 * @since 1.0
03852 * @javascript Re-compilers must convert the instance invocation of this method directly
03853 * into a JavaScript invocation on its current primitive instance without changing the
03854 * method name, but expanding variable arguments, if any, into comma-separated values.
03855 */03856 publicfinaljava.lang.Stringslice(Objectbegin,Objectend){03857 returnJs.s().stringLike(var()).slice(begin,end);03858 }03859 /**
03860 * <p>Creates and returns an array of substrings of the current string. These
03861 * substrings are created by searching the string from start to end for text that
03862 * matches <tt>separator</tt> and breaking the string before and after that
03863 * matching text. The <tt>separator</tt> text is not included in any of the
03864 * returned substrings, except as noted at the end of this section. Note that if the
03865 * <tt>separator</tt> matches the beginning of the string, the first element of
03866 * the returned array will be an empty string, the text that appears before the
03867 * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of
03868 * the string, the last element of the array will be the empty string.</p>
03869 * <p>If <tt>separator</tt> is undefined, the current string is not split at all,
03870 * and the returned array contains only a single, unbroken string element. If
03871 * <tt>separator</tt> is the empty string or a regular expression that matches
03872 * the empty string, the string is broken between each character, and the returned
03873 * array has the same length as the string does. Note that this is a special case
03874 * because the empty strings before the first character and after the last character
03875 * are not matched.</p>
03876 * <p>As noted earlier, the substrings in the array returned by this invocation do not
03877 * contain the delimiting text <tt>separator</tt> used to split the string. However,
03878 * if <tt>separator</tt> is a regular expression that contains parenthesized
03879 * subexpressions, the substrings that match those parenthesized subexpressions
03880 * (but not the text that matches the regular expression as a whole) are included in
03881 * the returned array.</p>
03882 * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or
03883 * {@link ArrayLike#join(Object)} method.</p>
03884 * @param separator The string or regular expression at which the current string splits.
03885 * @return An array of strings, created by splitting string into substrings at the
03886 * boundaries specified by <tt>separator</tt>. The substrings in the returned
03887 * array do not include <tt>separator</tt> itself, except in the case noted in the
03888 * above description.
03889 * @see #split(Object, Object)
03890 * @see ArrayLike#join()
03891 * @see ArrayLike#join(Object)
03892 * @see jsx.core.StringLikes#split(StringLike, Object)
03893 * @see jsx.core.StringLikes#split(String, Object)
03894 * @since 1.0
03895 * @javascript Re-compilers must convert the instance invocation of this method directly
03896 * into a JavaScript invocation on its current primitive instance without changing the
03897 * method name, but expanding variable arguments, if any, into comma-separated values.
03898 */03899 publicfinalArrayLike<?>split(Objectseparator){03900 returnJs.s().stringLike(var()).split(separator);03901 }03902 /**
03903 * <p>Creates and returns an array of as many as <tt>limit</tt> substrings of the
03904 * current string. These substrings are created by searching the string from start to
03905 * end for text that matches <tt>separator</tt> and breaking the string before and
03906 * after that matching text. The <tt>separator</tt> text is not included in any of
03907 * the returned substrings, except as noted at the end of this section. Note that if
03908 * the <tt>separator</tt> matches the beginning of the string, the first element
03909 * of the returned array will be an empty string, the text that appears before the
03910 * <tt>separator</tt>. Similarly, if the <tt>separator</tt> matches the end of
03911 * the string, the last element of the array (assuming no conflicting <tt>limit</tt>)
03912 * will be the empty string.</p>
03913 * <p>If <tt>separator</tt> is undefined, the current string is not split at all,
03914 * and the returned array contains only a single, unbroken string element. If
03915 * <tt>separator</tt> is the empty string or a regular expression that matches
03916 * the empty string, the string is broken between each character, and the returned
03917 * array has the same length as the string does, assuming no smaller <tt>limit</tt>
03918 * is specified. Note that this is a special case because the empty strings before
03919 * the first character and after the last character are not matched.</p>
03920 * <p>As noted earlier, the substrings in the array returned by this invocation do not
03921 * contain the delimiting text <tt>separator</tt> used to split the string. However,
03922 * if <tt>separator</tt> is a regular expression that contains parenthesized
03923 * subexpressions, the substrings that match those parenthesized subexpressions
03924 * (but not the text that matches the regular expression as a whole) are included in
03925 * the returned array.</p>
03926 * <p>Note that this method is the inverse of the {@link ArrayLike#join()} or
03927 * {@link ArrayLike#join(Object)} method.</p>
03928 * @param separator The string or regular expression at which the current string splits.
03929 * @param limit This optional integer specifies the maximum length of the returned
03930 * array. If defined, no more than this number of substrings will be returned.
03931 * If undefined, the entire string will be split, regardless of its length.
03932 * @return An array of strings, created by splitting string into substrings at the
03933 * boundaries specified by <tt>separator</tt>. The substrings in the returned
03934 * array do not include <tt>separator</tt> itself, except in the case noted in the
03935 * above description.
03936 * @see #split(Object)
03937 * @see ArrayLike#join()
03938 * @see ArrayLike#join(Object)
03939 * @see jsx.core.StringLikes#split(StringLike, Object, Object)
03940 * @see jsx.core.StringLikes#split(String, Object, Object)
03941 * @since 1.0
03942 * @javascript Re-compilers must convert the instance invocation of this method directly
03943 * into a JavaScript invocation on its current primitive instance without changing the
03944 * method name, but expanding variable arguments, if any, into comma-separated values.
03945 */03946 publicfinalArrayLike<?>split(Objectseparator,Objectlimit){03947 returnJs.s().stringLike(var()).split(separator,limit);03948 }03949 /**
03950 * <p>Extracts and returns a substring of the current string without modifying it.</p>
03951 * <p>Note that this method has not been standardized by ECMAScript and is therefore
03952 * deprecated</p>
03953 * @param start The start position of the substring. If this argument is negative, it
03954 * specifies a position measured from the end of the string: -1 specifies the last character,
03955 * -2 specifies the second-to-last character, and so on.
03956 * @return A copy of the portion of the current string starting at and including the character
03957 * specified by <tt>start</tt> to the end of the string.
03958 * @see #substr(Object)
03959 * @see #slice(Object)
03960 * @see #slice(Object, Object)
03961 * @see #substring(Object)
03962 * @see #substring(Object, Object)
03963 * @see jsx.core.StringLikes#substr(StringLike, Object)
03964 * @see jsx.core.StringLikes#substr(String, Object)
03965 * @since 1.0
03966 * @javascript Re-compilers must convert the instance invocation of this method directly
03967 * into a JavaScript invocation on its current primitive instance without changing the
03968 * method name, but expanding variable arguments, if any, into comma-separated values.
03969 */03970 publicfinaljava.lang.Stringsubstr(Objectstart){03971 returnJs.s().stringLike(var()).substr(start);03972 }03973 /**
03974 * <p>Extracts and returns a substring of the current string without modifying it.</p>
03975 * <p>Note this method specifies the desired substring with a character position and a
03976 * <tt>length</tt>. This provides a useful alternative to
03977 * {@link StringLike#substring(Object, Object)}, which specify a substring with two
03978 * character positions. Note, however, that this method has not been standardized by
03979 * ECMAScript and is therefore deprecated</p>
03980 * @param start The start position of the substring. If this argument is negative, it
03981 * specifies a position measured from the end of the string: -1 specifies the last character,
03982 * -2 specifies the second-to-last character, and so on.
03983 * @param length The number of characters in the substring. If this argument is undefined,
03984 * the returned substring includes all characters from the starting position to the end of
03985 * the string.
03986 * @return A copy of the portion of the current string starting at and including the character
03987 * specified by <tt>start</tt> and continuing for <tt>length</tt> characters,
03988 * or to the end of the string if <tt>length</tt> is undefined.
03989 * @see #substr(Object)
03990 * @see #slice(Object)
03991 * @see #slice(Object, Object)
03992 * @see #substring(Object)
03993 * @see #substring(Object, Object)
03994 * @see jsx.core.StringLikes#substr(StringLike, Object, Object)
03995 * @see jsx.core.StringLikes#substr(String, Object, Object)
03996 * @since 1.0
03997 * @javascript Re-compilers must convert the instance invocation of this method directly
03998 * into a JavaScript invocation on its current primitive instance without changing the
03999 * method name, but expanding variable arguments, if any, into comma-separated values.
04000 */04001 publicfinaljava.lang.Stringsubstr(Objectstart,Objectlength){04002 returnJs.s().stringLike(var()).substr(start,length);04003 }04004 /**
04005 * <p>Returns a substring of the current string consisting of the characters from
04006 * position <tt>from</tt> to the end of the string. The character at position
04007 * <tt>from</tt> is included.</p>
04008 * <p>It is important to remember that the character at position <tt>from</tt> is
04009 * included in the substring.</p>
04010 * <p>Note that {@link StringLike#slice(Object)} and the nonstandard
04011 * {@link StringLike#substr(Object)} can also extract substrings from a string.
04012 * Unlike those methods, this method does not accept negative arguments.</p>
04013 * @param from A nonnegative integer that specifies the position within the current
04014 * string of the first character of the desired substring.
04015 * @return A substring of the current string containing characters copied from
04016 * position <tt>from</tt> to the end of the current string.
04017 * @see #substring(Object, Object)
04018 * @see #charAt(Object)
04019 * @see #indexOf(Object)
04020 * @see #indexOf(Object, Object)
04021 * @see #lastIndexOf(Object)
04022 * @see #lastIndexOf(Object, Object)
04023 * @see #slice(Object)
04024 * @see #slice(Object, Object)
04025 * @see #substr(Object)
04026 * @see #substr(Object, Object)
04027 * @see jsx.core.StringLikes#substring(StringLike, Object)
04028 * @see jsx.core.StringLikes#substring(String, Object)
04029 * @since 1.0
04030 * @javascript Re-compilers must convert the instance invocation of this method directly
04031 * into a JavaScript invocation on its current primitive instance without changing the
04032 * method name, but expanding variable arguments, if any, into comma-separated values.
04033 */04034 publicfinaljava.lang.Stringsubstring(Objectfrom){04035 returnJs.s().stringLike(var()).substring(from);04036 }04037 /**
04038 * <p>Returns a substring of the current string consisting of the characters between
04039 * positions <tt>from</tt> and <tt>to</tt>. The character at position <tt>from</tt>
04040 * is included, but the character at position <tt>to</tt> is not included.</p>
04041 * <p>If <tt>from</tt> equals <tt>to</tt>, this method returns an empty
04042 * (length 0) string. If <tt>from</tt> is greater than <tt>to</tt>, this method
04043 * first swaps the two arguments and then returns the substring between them.</p>
04044 * <p>It is important to remember that the character at position <tt>from</tt> is
04045 * included in the substring but that the character at position <tt>to</tt> is
04046 * not included in the substring. While this may seem arbitrary or counter-intuitive,
04047 * a notable feature of this system is that the length of the returned substring is
04048 * always equal to <tt>to - from</tt>.</p>
04049 * <p>Note that {@link StringLike#slice(Object, Object)} and the nonstandard
04050 * {@link StringLike#substr(Object, Object)} can also extract substrings from a string.
04051 * Unlike those methods, this method does not accept negative arguments.</p>
04052 * @param from A nonnegative integer that specifies the position within the current
04053 * string of the first character of the desired substring.
04054 * @param to A nonnegative optional integer that is one greater than the position of
04055 * the last character of the desired substring. If this argument is undefined, the
04056 * returned substring runs to the end of the string.
04057 * @return A new string, of length <tt>to - from</tt>, which contains a substring
04058 * of the current string. The new string contains characters copied from positions
04059 * <tt>from</tt> to <tt>to</tt> - 1 of the string.
04060 * @see #substring(Object)
04061 * @see #charAt(Object)
04062 * @see #indexOf(Object)
04063 * @see #indexOf(Object, Object)
04064 * @see #lastIndexOf(Object)
04065 * @see #lastIndexOf(Object, Object)
04066 * @see #slice(Object)
04067 * @see #slice(Object, Object)
04068 * @see #substr(Object)
04069 * @see #substr(Object, Object)
04070 * @see jsx.core.StringLikes#substring(StringLike, Object, Object)
04071 * @see jsx.core.StringLikes#substring(String, Object, Object)
04072 * @since 1.0
04073 * @javascript Re-compilers must convert the instance invocation of this method directly
04074 * into a JavaScript invocation on its current primitive instance without changing the
04075 * method name, but expanding variable arguments, if any, into comma-separated values.
04076 */04077 publicfinaljava.lang.Stringsubstring(Objectfrom,Objectto){04078 returnJs.s().stringLike(var()).substring(from,to);04079 }04080 /**
04081 * <p>Returns a copy of string, with each upper-case letter converted to its lower-case
04082 * equivalent, if it has one.</p>
04083 * @return A copy of string, with each upper-case letter converted to its lower-case
04084 * equivalent, if it has one.
04085 * @see #toLocaleLowerCase()
04086 * @see #toLocaleUpperCase()
04087 * @see #toUpperCase()
04088 * @see jsx.core.StringLikes#toLowerCase(StringLike)
04089 * @see jsx.core.StringLikes#toLowerCase(String)
04090 * @since 1.0
04091 * @javascript Re-compilers must convert the instance invocation of this method directly
04092 * into a JavaScript invocation on its current primitive instance without changing the
04093 * method name, but expanding variable arguments, if any, into comma-separated values.
04094 */04095 publicfinaljava.lang.StringtoLowerCase(){04096 returnJs.s().stringLike(var()).toLowerCase();04097 }04098 /**
04099 * <p>Returns a copy of string, with each lower-case letter converted to its upper-case
04100 * equivalent, if it has one.</p>
04101 * @return A copy of string, with each lower-case letter converted to its upper-case
04102 * equivalent, if it has one.
04103 * @see #toLocaleLowerCase()
04104 * @see #toLocaleUpperCase()
04105 * @see #toLowerCase()
04106 * @see jsx.core.StringLikes#toUpperCase(StringLike)
04107 * @see jsx.core.StringLikes#toUpperCase(String)
04108 * @since 1.0
04109 * @javascript Re-compilers must convert the instance invocation of this method directly
04110 * into a JavaScript invocation on its current primitive instance without changing the
04111 * method name, but expanding variable arguments, if any, into comma-separated values.
04112 */04113 publicfinaljava.lang.StringtoUpperCase(){04114 returnJs.s().stringLike(var()).toUpperCase();04115 }04116 /**
04117 * <p>Returns a copy of the current string, converted to lower-case letters in a
04118 * locale-specific way. Only a few languages, such as Turkish, have locale-specific
04119 * case mappings, so this method usually returns the same value as
04120 * {@link #toLowerCase()}.</p>
04121 * @return A copy of the current string, converted to lower-case letters in a
04122 * locale-specific way.
04123 * @see #toLocaleUpperCase()
04124 * @see #toLowerCase()
04125 * @see #toUpperCase()
04126 * @see jsx.core.StringLikes#toLocaleLowerCase(StringLike)
04127 * @see jsx.core.StringLikes#toLocaleLowerCase(String)
04128 * @since 1.0
04129 * @javascript Re-compilers must convert the instance invocation of this method directly
04130 * into a JavaScript invocation on its current primitive instance without changing the
04131 * method name, but expanding variable arguments, if any, into comma-separated values.
04132 */04133 publicfinaljava.lang.StringtoLocaleLowerCase(){04134 returnJs.s().stringLike(var()).toLocaleLowerCase();04135 }04136 /**
04137 * <p>Returns a copy of the current string, converted to upper-case letters in a
04138 * locale-specific way. Only a few languages, such as Turkish, have locale-specific
04139 * case mappings, so this method usually returns the same value as
04140 * {@link #toUpperCase()}.</p>
04141 * @return A copy of the current string, converted to upper-case letters in a
04142 * locale-specific way.
04143 * @see #toLocaleLowerCase()
04144 * @see #toLowerCase()
04145 * @see #toUpperCase()
04146 * @see jsx.core.StringLikes#toLocaleUpperCase(StringLike)
04147 * @see jsx.core.StringLikes#toLocaleUpperCase(String)
04148 * @since 1.0
04149 * @javascript Re-compilers must convert the instance invocation of this method directly
04150 * into a JavaScript invocation on its current primitive instance without changing the
04151 * method name, but expanding variable arguments, if any, into comma-separated values.
04152 */04153 publicfinaljava.lang.StringtoLocaleUpperCase(){04154 returnJs.s().stringLike(var()).toLocaleUpperCase();04155 }04156 }04157 04158 /**
04159 * <p>An <b>opaque</b> class resembling JavaScript primitive number values.</p>
04160 *
04161 * @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>
04162 *
04163 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
04164 * generated into the target codes. Re-compilers must exit with error on the operations of
04165 * accessing that kind of class objects.
04166 */04167 04168 publicstaticabstractclassNumerical<T>extendsValue<T>04169 {04170 protectedNumerical(Tvalue){04171 super(value);04172 }04173 04174 /**
04175 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
04176 * a string operand, resembling the addition operator in JavaScript.</p>
04177 * <p>If one value is a string, the other is converted to a string, and the two
04178 * strings are then concatenated. Object operands are converted to numbers or strings
04179 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
04180 * method and/or the {@link Js#toString(Object)} method on the object.</p>
04181 * @param other A value or object.
04182 * @return The sum or concatenation of the values.
04183 * @since 1.0
04184 * @javascript Re-compilers must replace the instance invocation of this method with the
04185 * JavaScript expression:
04186 * <pre>p + other</pre>
04187 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04188 */04189 publicfinalNumberadd(java.lang.Numberother){04190 returnnewNumber((java.lang.Number)Js.add(var(),other));04191 }04192 04193 /**
04194 * <p>Adds the current primitive instance to a numeric operand or concatenates it with
04195 * a string operand, resembling the addition operator in JavaScript.</p>
04196 * <p>If one value is a string, the other is converted to a string, and the two
04197 * strings are then concatenated. Object operands are converted to numbers or strings
04198 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
04199 * method and/or the {@link Js#toString(Object)} method on the object.</p>
04200 * @param other A value or object.
04201 * @return The sum or concatenation of the values.
04202 * @since 1.0
04203 * @javascript Re-compilers must replace the instance invocation of this method with the
04204 * JavaScript expression:
04205 * <pre>p + other</pre>
04206 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04207 */04208 publicfinalNumberadd(Value<?extendsjava.lang.Number>other){04209 returnnewNumber((java.lang.Number)Js.add(var(),other.var()));04210 }04211 04212 /**
04213 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
04214 * operation on the two values: it returns <tt>true</tt> if and only if both its first
04215 * operand and its second operand are <tt>true</tt>. If one or both of these operands
04216 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
04217 * <p>In JavaScript, depending on the value of the left-side expression, the operator
04218 * may or may not evaluate the right-side expression. The actual behavior of the operator
04219 * is somewhat more complicated. It starts by evaluating its first operand, the expression
04220 * on its left. If the value of this expression can be converted to <tt>false</tt>
04221 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
04222 * the operator returns the value of the left-side expression. Otherwise, it evaluates
04223 * its second operand, the expression on its right, and returns the value of that
04224 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
04225 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
04226 * returning the unconverted value of the left-side expression.</p>
04227 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04228 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04229 * anonymously, returning the actual expression in the method overriding
04230 * {@link Var#var()}.</p>
04231 * <p>Sometimes, this operation probably does not do what the programmers intended.
04232 * To avoid problems, do not use expressions with side effects (assignments, increments,
04233 * decrements, and function calls) for the second operand unless you are quite sure
04234 * you know exactly what you are doing.</p>
04235 * <p>Despite the fairly confusing way that this operation actually works, it is
04236 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
04237 * Although it does not actually return a boolean value, the value it returns can always
04238 * be converted to a boolean value.</p>
04239 * <p>Note that, this method is probably useful in emulation codes just for perfect
04240 * re-compilations. However, in most cases you can use the logical AND operator of the
04241 * Java language like this:
04242 * <pre>Js.be(var) && Js.be(other)</pre>
04243 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04244 * JavaScript expression since the Java compilers generally used are free to compile
04245 * the expression into any byte codes they think efficient, making it too hard for the
04246 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04247 * @param other A value or object.
04248 * @return The logical AND of the two operands.
04249 * @since 1.0
04250 * @javascript Re-compilers must replace the instance invocation of this method with the
04251 * JavaScript expression:
04252 * <pre>p && other</pre>
04253 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04254 */04255 publicNumerical<?>and(java.lang.Characterother){04256 return!Js.be(var())?this:newCharacter(other);04257 }04258 04259 /**
04260 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
04261 * operation on the two values: it returns <tt>true</tt> if and only if both its first
04262 * operand and its second operand are <tt>true</tt>. If one or both of these operands
04263 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
04264 * <p>In JavaScript, depending on the value of the left-side expression, the operator
04265 * may or may not evaluate the right-side expression. The actual behavior of the operator
04266 * is somewhat more complicated. It starts by evaluating its first operand, the expression
04267 * on its left. If the value of this expression can be converted to <tt>false</tt>
04268 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
04269 * the operator returns the value of the left-side expression. Otherwise, it evaluates
04270 * its second operand, the expression on its right, and returns the value of that
04271 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
04272 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
04273 * returning the unconverted value of the left-side expression.</p>
04274 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04275 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04276 * anonymously, returning the actual expression in the method overriding
04277 * {@link Var#var()}.</p>
04278 * <p>Sometimes, this operation probably does not do what the programmers intended.
04279 * To avoid problems, do not use expressions with side effects (assignments, increments,
04280 * decrements, and function calls) for the second operand unless you are quite sure
04281 * you know exactly what you are doing.</p>
04282 * <p>Despite the fairly confusing way that this operation actually works, it is
04283 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
04284 * Although it does not actually return a boolean value, the value it returns can always
04285 * be converted to a boolean value.</p>
04286 * <p>Note that, this method is probably useful in emulation codes just for perfect
04287 * re-compilations. However, in most cases you can use the logical AND operator of the
04288 * Java language like this:
04289 * <pre>Js.be(var) && Js.be(other)</pre>
04290 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04291 * JavaScript expression since the Java compilers generally used are free to compile
04292 * the expression into any byte codes they think efficient, making it too hard for the
04293 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04294 * @param other A value or object.
04295 * @return The logical AND of the two operands.
04296 * @since 1.0
04297 * @javascript Re-compilers must replace the instance invocation of this method with the
04298 * JavaScript expression:
04299 * <pre>p && other</pre>
04300 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04301 */04302 publicNumerical<?>and(java.lang.Numberother){04303 return!Js.be(var())?this:newNumber(other);04304 }04305 04306 /**
04307 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
04308 * operation on the two values: it returns <tt>true</tt> if and only if both its first
04309 * operand and its second operand are <tt>true</tt>. If one or both of these operands
04310 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
04311 * <p>In JavaScript, depending on the value of the left-side expression, the operator
04312 * may or may not evaluate the right-side expression. The actual behavior of the operator
04313 * is somewhat more complicated. It starts by evaluating its first operand, the expression
04314 * on its left. If the value of this expression can be converted to <tt>false</tt>
04315 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
04316 * the operator returns the value of the left-side expression. Otherwise, it evaluates
04317 * its second operand, the expression on its right, and returns the value of that
04318 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
04319 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
04320 * returning the unconverted value of the left-side expression.</p>
04321 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04322 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04323 * anonymously, returning the actual expression in the method overriding
04324 * {@link Var#var()}.</p>
04325 * <p>Sometimes, this operation probably does not do what the programmers intended.
04326 * To avoid problems, do not use expressions with side effects (assignments, increments,
04327 * decrements, and function calls) for the second operand unless you are quite sure
04328 * you know exactly what you are doing.</p>
04329 * <p>Despite the fairly confusing way that this operation actually works, it is
04330 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
04331 * Although it does not actually return a boolean value, the value it returns can always
04332 * be converted to a boolean value.</p>
04333 * <p>Note that, this method is probably useful in emulation codes just for perfect
04334 * re-compilations. However, in most cases you can use the logical AND operator of the
04335 * Java language like this:
04336 * <pre>Js.be(var) && Js.be(other)</pre>
04337 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04338 * JavaScript expression since the Java compilers generally used are free to compile
04339 * the expression into any byte codes they think efficient, making it too hard for the
04340 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04341 * @param other A value or object.
04342 * @return The logical AND of the two operands.
04343 * @since 1.0
04344 * @javascript Re-compilers must replace the instance invocation of this method with the
04345 * JavaScript expression:
04346 * <pre>p && other</pre>
04347 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04348 */04349 publicfinalNumerical<?>and(Numerical<?>other){04350 Objectv=other.var();04351 return!Js.be(var())?this:vinstanceofjava.lang.Character?04352 newCharacter((java.lang.Character)v):newNumber((java.lang.Number)v);04353 }04354 04355 /**
04356 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
04357 * operation on the two values: it returns <tt>true</tt> if and only if both its first
04358 * operand and its second operand are <tt>true</tt>. If one or both of these operands
04359 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
04360 * <p>In JavaScript, depending on the value of the left-side expression, the operator
04361 * may or may not evaluate the right-side expression. The actual behavior of the operator
04362 * is somewhat more complicated. It starts by evaluating its first operand, the expression
04363 * on its left. If the value of this expression can be converted to <tt>false</tt>
04364 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
04365 * the operator returns the value of the left-side expression. Otherwise, it evaluates
04366 * its second operand, the expression on its right, and returns the value of that
04367 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
04368 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
04369 * returning the unconverted value of the left-side expression.</p>
04370 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04371 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04372 * anonymously, returning the actual expression in the method overriding
04373 * {@link Var#var()}.</p>
04374 * <p>Sometimes, this operation probably does not do what the programmers intended.
04375 * To avoid problems, do not use expressions with side effects (assignments, increments,
04376 * decrements, and function calls) for the second operand unless you are quite sure
04377 * you know exactly what you are doing.</p>
04378 * <p>Despite the fairly confusing way that this operation actually works, it is
04379 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
04380 * Although it does not actually return a boolean value, the value it returns can always
04381 * be converted to a boolean value.</p>
04382 * <p>Note that, this method is probably useful in emulation codes just for perfect
04383 * re-compilations. However, in most cases you can use the logical AND operator of the
04384 * Java language like this:
04385 * <pre>Js.be(var) && Js.be(other)</pre>
04386 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04387 * JavaScript expression since the Java compilers generally used are free to compile
04388 * the expression into any byte codes they think efficient, making it too hard for the
04389 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04390 * @param other A value or object.
04391 * @return The logical AND of the two operands.
04392 * @since 1.0
04393 * @javascript Re-compilers must replace the instance invocation of this method with the
04394 * JavaScript expression:
04395 * <pre>p && other</pre>
04396 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04397 */04398 publicfinalJsNumberand(JsNumberother){04399 returnJs.and(valueOf(),other);04400 }04401 04402 /**
04403 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
04404 * operation on the two values: it returns <tt>true</tt> if either the first operand or
04405 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
04406 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
04407 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
04408 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
04409 * its first operand, the expression on its left. If the value of this expression can
04410 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
04411 * expression. Otherwise, it evaluates its second operand, the expression on its right,
04412 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
04413 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
04414 * and doesn't return the unconverted value of the left-side expression.</p>
04415 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04416 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04417 * anonymously, returning the actual expression in the method overriding
04418 * {@link Var#var()}.</p>
04419 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
04420 * operands that include side effects, unless you purposely want to use the fact that
04421 * the right-side expression may not be evaluated in JavaScript.</p>
04422 * <p>Even when this operation is used with operands that are not boolean values, it
04423 * can still be considered a Boolean OR operator because its return value, whatever the
04424 * type, can be converted to a boolean value.</p>
04425 * <p>Note that, this method is probably useful in emulation codes just for perfect
04426 * re-compilations. However, in most cases you can use the logical OR operator of the
04427 * Java language like this:
04428 * <pre>Js.be(var) || Js.be(other)</pre>
04429 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04430 * JavaScript expression since the Java compilers generally used are free to compile
04431 * the expression into any byte codes they think efficient, making it too hard for the
04432 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04433 * @param other A value or object.
04434 * @return The logical OR of the two operands.
04435 * @since 1.0
04436 * @javascript Re-compilers must replace the instance invocation of this method with the
04437 * JavaScript expression:
04438 * <pre>p || other</pre>
04439 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04440 */04441 publicNumerical<?>or(java.lang.Characterother){04442 returnJs.be(var())?this:newCharacter(other);04443 }04444 04445 /**
04446 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
04447 * operation on the two values: it returns <tt>true</tt> if either the first operand or
04448 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
04449 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
04450 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
04451 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
04452 * its first operand, the expression on its left. If the value of this expression can
04453 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
04454 * expression. Otherwise, it evaluates its second operand, the expression on its right,
04455 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
04456 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
04457 * and doesn't return the unconverted value of the left-side expression.</p>
04458 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04459 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04460 * anonymously, returning the actual expression in the method overriding
04461 * {@link Var#var()}.</p>
04462 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
04463 * operands that include side effects, unless you purposely want to use the fact that
04464 * the right-side expression may not be evaluated in JavaScript.</p>
04465 * <p>Even when this operation is used with operands that are not boolean values, it
04466 * can still be considered a Boolean OR operator because its return value, whatever the
04467 * type, can be converted to a boolean value.</p>
04468 * <p>Note that, this method is probably useful in emulation codes just for perfect
04469 * re-compilations. However, in most cases you can use the logical OR operator of the
04470 * Java language like this:
04471 * <pre>Js.be(var) || Js.be(other)</pre>
04472 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04473 * JavaScript expression since the Java compilers generally used are free to compile
04474 * the expression into any byte codes they think efficient, making it too hard for the
04475 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04476 * @param other A value or object.
04477 * @return The logical OR of the two operands.
04478 * @since 1.0
04479 * @javascript Re-compilers must replace the instance invocation of this method with the
04480 * JavaScript expression:
04481 * <pre>p || other</pre>
04482 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04483 */04484 publicNumerical<?>or(java.lang.Numberother){04485 returnJs.be(var())?this:newNumber(other);04486 }04487 04488 /**
04489 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
04490 * operation on the two values: it returns <tt>true</tt> if either the first operand or
04491 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
04492 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
04493 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
04494 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
04495 * its first operand, the expression on its left. If the value of this expression can
04496 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
04497 * expression. Otherwise, it evaluates its second operand, the expression on its right,
04498 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
04499 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
04500 * and doesn't return the unconverted value of the left-side expression.</p>
04501 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04502 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04503 * anonymously, returning the actual expression in the method overriding
04504 * {@link Var#var()}.</p>
04505 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
04506 * operands that include side effects, unless you purposely want to use the fact that
04507 * the right-side expression may not be evaluated in JavaScript.</p>
04508 * <p>Even when this operation is used with operands that are not boolean values, it
04509 * can still be considered a Boolean OR operator because its return value, whatever the
04510 * type, can be converted to a boolean value.</p>
04511 * <p>Note that, this method is probably useful in emulation codes just for perfect
04512 * re-compilations. However, in most cases you can use the logical OR operator of the
04513 * Java language like this:
04514 * <pre>Js.be(var) || Js.be(other)</pre>
04515 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04516 * JavaScript expression since the Java compilers generally used are free to compile
04517 * the expression into any byte codes they think efficient, making it too hard for the
04518 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04519 * @param other A value or object.
04520 * @return The logical OR of the two operands.
04521 * @since 1.0
04522 * @javascript Re-compilers must replace the instance invocation of this method with the
04523 * JavaScript expression:
04524 * <pre>p || other</pre>
04525 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04526 */04527 publicfinalNumerical<?>or(Numerical<?>other){04528 Objectv=other.var();04529 returnJs.be(var())?this:vinstanceofjava.lang.Character?04530 newCharacter((java.lang.Character)v):newNumber((java.lang.Number)v);04531 }04532 04533 /**
04534 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
04535 * operation on the two values: it returns <tt>true</tt> if either the first operand or
04536 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
04537 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
04538 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
04539 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
04540 * its first operand, the expression on its left. If the value of this expression can
04541 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
04542 * expression. Otherwise, it evaluates its second operand, the expression on its right,
04543 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
04544 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
04545 * and doesn't return the unconverted value of the left-side expression.</p>
04546 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
04547 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
04548 * anonymously, returning the actual expression in the method overriding
04549 * {@link Var#var()}.</p>
04550 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
04551 * operands that include side effects, unless you purposely want to use the fact that
04552 * the right-side expression may not be evaluated in JavaScript.</p>
04553 * <p>Even when this operation is used with operands that are not boolean values, it
04554 * can still be considered a Boolean OR operator because its return value, whatever the
04555 * type, can be converted to a boolean value.</p>
04556 * <p>Note that, this method is probably useful in emulation codes just for perfect
04557 * re-compilations. However, in most cases you can use the logical OR operator of the
04558 * Java language like this:
04559 * <pre>Js.be(var) || Js.be(other)</pre>
04560 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04561 * JavaScript expression since the Java compilers generally used are free to compile
04562 * the expression into any byte codes they think efficient, making it too hard for the
04563 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04564 * @param other A value or object.
04565 * @return The logical OR of the two operands.
04566 * @since 1.0
04567 * @javascript Re-compilers must replace the instance invocation of this method with the
04568 * JavaScript expression:
04569 * <pre>p || other</pre>
04570 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04571 */04572 publicfinalNumberor(JsNumberother){04573 returnnewNumber(Js.or(valueOf(),other));04574 }04575 04576 /**
04577 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
04578 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
04579 * operand, otherwise.</p>
04580 * <p>The first operand of the conditional operation must be (or be convertible to) a
04581 * boolean value. Usually this is the result of a comparison operation. The second and
04582 * third operands may have any value. The value returned by the conditional operation
04583 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
04584 * the value of the conditional expression is the value of the second operand. If the
04585 * first operand is <tt>false</tt>, the value of the conditional expression is the
04586 * value of the third operand.</p>
04587 * <p>To make the second and third operands really late-evaluated or not evaluated in
04588 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
04589 * {@link Var} anonymously, returning the actual expression in the method overriding
04590 * {@link Var#var()}.</p>
04591 * <p>Note that, this method is probably useful in emulation codes just for perfect
04592 * re-compilations. However, in most cases you can use the conditional operator of the
04593 * Java language like this:
04594 * <pre>Js.be(test) ? var : other</pre>
04595 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04596 * JavaScript expression since the Java compilers generally used are free to compile
04597 * the expression into any byte codes they think efficient, making it too hard for the
04598 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04599 * @param other A value or object.
04600 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
04601 * the third operand.
04602 * @since 1.0
04603 * @javascript Re-compilers must replace the instance invocation of this method with the
04604 * JavaScript expression:
04605 * <pre>test ? p : other</pre>
04606 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04607 */04608 publicNumerical<?>cond(Objecttest,java.lang.Characterother){04609 returnJs.be(test)?this:newCharacter(other);04610 }04611 04612 /**
04613 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
04614 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
04615 * operand, otherwise.</p>
04616 * <p>The first operand of the conditional operation must be (or be convertible to) a
04617 * boolean value. Usually this is the result of a comparison operation. The second and
04618 * third operands may have any value. The value returned by the conditional operation
04619 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
04620 * the value of the conditional expression is the value of the second operand. If the
04621 * first operand is <tt>false</tt>, the value of the conditional expression is the
04622 * value of the third operand.</p>
04623 * <p>To make the second and third operands really late-evaluated or not evaluated in
04624 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
04625 * {@link Var} anonymously, returning the actual expression in the method overriding
04626 * {@link Var#var()}.</p>
04627 * <p>Note that, this method is probably useful in emulation codes just for perfect
04628 * re-compilations. However, in most cases you can use the conditional operator of the
04629 * Java language like this:
04630 * <pre>Js.be(test) ? var : other</pre>
04631 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04632 * JavaScript expression since the Java compilers generally used are free to compile
04633 * the expression into any byte codes they think efficient, making it too hard for the
04634 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04635 * @param other A value or object.
04636 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
04637 * the third operand.
04638 * @since 1.0
04639 * @javascript Re-compilers must replace the instance invocation of this method with the
04640 * JavaScript expression:
04641 * <pre>test ? p : other</pre>
04642 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04643 */04644 publicNumerical<?>cond(Objecttest,java.lang.Numberother){04645 returnJs.be(test)?this:newNumber(other);04646 }04647 04648 /**
04649 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
04650 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
04651 * operand, otherwise.</p>
04652 * <p>The first operand of the conditional operation must be (or be convertible to) a
04653 * boolean value. Usually this is the result of a comparison operation. The second and
04654 * third operands may have any value. The value returned by the conditional operation
04655 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
04656 * the value of the conditional expression is the value of the second operand. If the
04657 * first operand is <tt>false</tt>, the value of the conditional expression is the
04658 * value of the third operand.</p>
04659 * <p>To make the second and third operands really late-evaluated or not evaluated in
04660 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
04661 * {@link Var} anonymously, returning the actual expression in the method overriding
04662 * {@link Var#var()}.</p>
04663 * <p>Note that, this method is probably useful in emulation codes just for perfect
04664 * re-compilations. However, in most cases you can use the conditional operator of the
04665 * Java language like this:
04666 * <pre>Js.be(test) ? var : other</pre>
04667 * which is definitely late-evaluated but not necessarily re-compiled into an expected
04668 * JavaScript expression since the Java compilers generally used are free to compile
04669 * the expression into any byte codes they think efficient, making it too hard for the
04670 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
04671 * @param other A value or object.
04672 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
04673 * the third operand.
04674 * @since 1.0
04675 * @javascript Re-compilers must replace the instance invocation of this method with the
04676 * JavaScript expression:
04677 * <pre>test ? p : other</pre>
04678 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
04679 */04680 publicfinalNumerical<?>cond(Objecttest,Numerical<?>other){04681 Objectv=other.var();04682 returnJs.be(test)?this:vinstanceofjava.lang.Character?04683 newCharacter((java.lang.Character)v):newNumber((java.lang.Number)v);04684 }04685 04686 /**
04687 * <p>Returns the primitive value associated with the current instance, if there is one.</p>
04688 * @return The primitive value associated with the current instance.
04689 * @see #toString()
04690 * @since 1.0
04691 * @javascript Re-compilers must convert the instance invocation of this method directly
04692 * into a JavaScript invocation on its current instance without changing the method
04693 * name, but expanding variable arguments, if any, into comma-separated values.
04694 */04695 @Override04696 publicjava.lang.NumbervalueOf(){04697 return(java.lang.Number)Js.valueOf(var());04698 }04699 /**
04700 * <p>Converts the current number to a string using exponential notation.</p>
04701 * @return A string representation of the current number, in exponential notation. The
04702 * fractional part of the number is rounded, or padded with zeros, as necessary, so that
04703 * it has the specified length.
04704 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04705 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04706 * {@link js.core.JsTypeError} for JS Simulation.
04707 * @see #toExponential(Object)
04708 * @see #toFixed()
04709 * @see #toFixed(Object)
04710 * @see #toLocaleString()
04711 * @see #toPrecision()
04712 * @see #toPrecision(Object)
04713 * @see #toString()
04714 * @see #toString(Object)
04715 * @see jsx.core.NumberLikes#toExponential(NumberLike)
04716 * @see jsx.core.NumberLikes#toExponential(Number)
04717 * @since 1.0
04718 * @javascript Re-compilers must convert the instance invocation of this method directly
04719 * into a JavaScript invocation on its current primitive instance without changing the
04720 * method name, but expanding variable arguments, if any, into comma-separated values.
04721 */04722 publicfinaljava.lang.StringtoExponential(){04723 returnJs.s().numberLike(valueOf()).toExponential();04724 }04725 /**
04726 * <p>Converts the current number to a string using exponential notation with the
04727 * specified number of digits after the decimal place.</p>
04728 * @param digits The number of digits that appears after the decimal point. This may be a
04729 * value between 0 and 20, inclusive, and implementations may optionally support a larger
04730 * range of values. If this argument is undefined, as many digits as necessary are used.
04731 * @return A string representation of the current number, in exponential notation,
04732 * with one digit before the decimal place and <tt>digits</tt> digits after the
04733 * decimal place. The fractional part of the number is rounded, or padded with zeros,
04734 * as necessary, so that it has the specified length.
04735 * @throws RuntimeException JavaScript throws a <tt>RangeError</tt> if
04736 * <tt>digits</tt> is too small or too large. See {@link Js#err(Object)} and
04737 * {@link js.core.JsRangeError} for JS Simulation. Values between 0 and 20, inclusive,
04738 * will not cause a <tt>RangeError</tt>. Implementations are allowed to support
04739 * larger and smaller values as well.
04740 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04741 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04742 * {@link js.core.JsTypeError} for JS Simulation.
04743 * @see #toExponential()
04744 * @see #toFixed()
04745 * @see #toFixed(Object)
04746 * @see #toLocaleString()
04747 * @see #toPrecision()
04748 * @see #toPrecision(Object)
04749 * @see #toString()
04750 * @see #toString(Object)
04751 * @see jsx.core.NumberLikes#toExponential(NumberLike, Object)
04752 * @see jsx.core.NumberLikes#toExponential(Number, Object)
04753 * @since 1.0
04754 * @javascript Re-compilers must convert the instance invocation of this method directly
04755 * into a JavaScript invocation on its current primitive instance without changing the
04756 * method name, but expanding variable arguments, if any, into comma-separated values.
04757 */04758 publicfinaljava.lang.StringtoExponential(Objectdigits){04759 returnJs.s().numberLike(valueOf()).toExponential(digits);04760 }04761 /**
04762 * <p>Converts the current number to a string without digits after the decimal place.</p>
04763 * @return A string representation of the current number that does not use exponential
04764 * notation and has no digits after the decimal place. The number is rounded if
04765 * necessary. If the current number is greater than 1e+21, this method simply calls
04766 * {@link #toString()} and returns a string in exponential notation.
04767 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04768 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04769 * {@link js.core.JsTypeError} for JS Simulation.
04770 * @see jsx.core.NumberLikes#toFixed(NumberLike)
04771 * @see jsx.core.NumberLikes#toFixed(NumberLike, Object)
04772 * @see jsx.core.NumberLikes#toFixed(Number)
04773 * @see jsx.core.NumberLikes#toFixed(Number, Object)
04774 * @see #toFixed(Object)
04775 * @see #toExponential()
04776 * @see #toExponential(Object)
04777 * @see #toLocaleString()
04778 * @see #toPrecision()
04779 * @see #toPrecision(Object)
04780 * @see #toString()
04781 * @see #toString(Object)
04782 * @see jsx.core.NumberLikes#toFixed(NumberLike)
04783 * @see jsx.core.NumberLikes#toFixed(Number)
04784 * @since 1.0
04785 * @javascript Re-compilers must convert the instance invocation of this method directly
04786 * into a JavaScript invocation on its current primitive instance without changing the
04787 * method name, but expanding variable arguments, if any, into comma-separated values.
04788 */04789 publicfinaljava.lang.StringtoFixed(){04790 returnJs.s().numberLike(valueOf()).toFixed();04791 }04792 /**
04793 * <p>Converts the current number to a string that contains a specified number of
04794 * digits after the decimal place.</p>
04795 * @param digits The number of digits to appear after the decimal point; this may be a
04796 * value between 0 and 20, inclusive, and implementations may optionally support a
04797 * larger range of values. If this argument is undefined, it is treated as 0.
04798 * @return A string representation of the current number that does not use exponential
04799 * notation and has exactly <tt>digits</tt> digits after the decimal place. The number
04800 * is rounded if necessary, and the fractional part is padded with zeros if necessary so
04801 * that it has the specified length. If the current number is greater than 1e+21, this
04802 * method simply calls {@link #toString()} and returns a string in exponential
04803 * notation.
04804 * @throws RuntimeException JavaScript throws a <tt>RangeError</tt> if
04805 * <tt>digits</tt> is too small or too large. See {@link Js#err(Object)} and
04806 * {@link js.core.JsRangeError} for JS Simulation. Values between 0 and 20, inclusive,
04807 * will not cause a <tt>RangeError</tt>. Implementations are allowed to support
04808 * larger and smaller values as well.
04809 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04810 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04811 * {@link js.core.JsTypeError} for JS Simulation.
04812 * @see #toFixed()
04813 * @see #toExponential()
04814 * @see #toExponential(Object)
04815 * @see #toLocaleString()
04816 * @see #toPrecision()
04817 * @see #toPrecision(Object)
04818 * @see #toString()
04819 * @see #toString(Object)
04820 * @see jsx.core.NumberLikes#toFixed(NumberLike, Object)
04821 * @see jsx.core.NumberLikes#toFixed(Number, Object)
04822 * @since 1.0
04823 * @javascript Re-compilers must convert the instance invocation of this method directly
04824 * into a JavaScript invocation on its current primitive instance without changing the
04825 * method name, but expanding variable arguments, if any, into comma-separated values.
04826 */04827 publicfinaljava.lang.StringtoFixed(Objectdigits){04828 returnJs.s().numberLike(valueOf()).toFixed(digits);04829 }04830 /**
04831 * <p>Converts the current number to a string.</p>
04832 * <p>This method simply calls {@link #toString()} to convert the number to a base-10
04833 * value.</p>
04834 * @return A string representation of the current number. The number is rounded or
04835 * padded with zeros as necessary.
04836 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04837 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04838 * {@link js.core.JsTypeError} for JS Simulation.
04839 * @see #toPrecision(Object)
04840 * @see #toExponential()
04841 * @see #toExponential(Object)
04842 * @see #toFixed()
04843 * @see #toFixed(Object)
04844 * @see #toLocaleString()
04845 * @see #toString()
04846 * @see #toString(Object)
04847 * @see jsx.core.NumberLikes#toPrecision(NumberLike)
04848 * @see jsx.core.NumberLikes#toPrecision(Number)
04849 * @since 1.0
04850 * @javascript Re-compilers must convert the instance invocation of this method directly
04851 * into a JavaScript invocation on its current primitive instance without changing the
04852 * method name, but expanding variable arguments, if any, into comma-separated values.
04853 */04854 publicfinaljava.lang.StringtoPrecision(){04855 returnJs.s().numberLike(valueOf()).toPrecision();04856 }04857 /**
04858 * <p>Converts the current number to a string using the specified number of significant
04859 * digits. Uses exponential or fixed-point notation depending on the size of the number
04860 * and the number of significant digits specified.</p>
04861 * @param precision The number of significant digits to appear in the returned string.
04862 * This may be a value between 1 and 21, inclusive. Implementations are allowed to
04863 * optionally support larger and smaller values of precision. If this argument is
04864 * undefined, the {@link #toString()} method is used instead to convert the number to
04865 * a base-10 value.
04866 * @return A string representation of the current number that contains
04867 * <tt>precision</tt> significant digits. If <tt>precision</tt> is large
04868 * enough to include all the digits of the integer part of the number, the returned
04869 * string uses fixed-point notation. Otherwise, exponential notation is used with one
04870 * digit before the decimal place and <tt>precision - 1</tt> digits after the
04871 * decimal place. The number is rounded or padded with zeros as necessary.
04872 * @throws RuntimeException JavaScript throws a <tt>RangeError</tt> if
04873 * <tt>digits</tt> is too small or too large. See {@link Js#err(Object)} and
04874 * {@link js.core.JsRangeError} for JS Simulation. Values between 1 and 20, inclusive,
04875 * will not cause a <tt>RangeError</tt>. Implementations are allowed to support
04876 * larger and smaller values as well.
04877 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04878 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04879 * {@link js.core.JsTypeError} for JS Simulation.
04880 * @see #toPrecision()
04881 * @see #toExponential()
04882 * @see #toExponential(Object)
04883 * @see #toFixed()
04884 * @see #toFixed(Object)
04885 * @see #toLocaleString()
04886 * @see #toString()
04887 * @see #toString(Object)
04888 * @see jsx.core.NumberLikes#toPrecision(NumberLike, Object)
04889 * @see jsx.core.NumberLikes#toPrecision(Number, Object)
04890 * @since 1.0
04891 * @javascript Re-compilers must convert the instance invocation of this method directly
04892 * into a JavaScript invocation on its current primitive instance without changing the
04893 * method name, but expanding variable arguments, if any, into comma-separated values.
04894 */04895 publicfinaljava.lang.StringtoPrecision(Objectprecision){04896 returnJs.s().numberLike(valueOf()).toPrecision(precision);04897 }04898 /**
04899 * <p>Converts the current number to a string using local number-formatting conventions.</p>
04900 * @return An implementation-dependent string representation of the current number,
04901 * formatted according to local conventions, which may affect such things as the
04902 * punctuation characters used for the decimal point and the thousands separator.
04903 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04904 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04905 * {@link js.core.JsTypeError} for JS Simulation.
04906 * @see #toString()
04907 * @see #toString(Object)
04908 * @see #toExponential()
04909 * @see #toExponential(Object)
04910 * @see #toFixed()
04911 * @see #toFixed(Object)
04912 * @see #toPrecision()
04913 * @see #toPrecision(Object)
04914 * @since 1.0
04915 * @javascript Re-compilers must convert the instance invocation of this method directly
04916 * into a JavaScript invocation on its current primitive instance without changing the
04917 * method name, but expanding variable arguments, if any, into comma-separated values.
04918 */04919 publicfinaljava.lang.StringtoLocaleString(){04920 returnJs.s().numberLike(valueOf()).toLocaleString();04921 }04922 /**
04923 * <p>Converts the current number to a string. When the <tt>radix</tt> argument is
04924 * undefined or is specified as 10, the number is converted to a base-10 string.</p>
04925 * <p>Although the ECMAScript specification does not require implementations to honor
04926 * any other values for radix, all implementations in common use accept values between
04927 * 2 and 36.</p>
04928 * @param radix An optional argument that specifies the radix, or base, between 2 and 36,
04929 * in which the number should be represented. If undefined, base 10 is used. Note,
04930 * however, that the ECMAScript specification allows an implementation to return any
04931 * value if this argument is specified as any value other than 10.
04932 * @return A string representation of the current number, in the specified base.
04933 * @throws RuntimeException JavaScript throws a <tt>TypeError</tt> if this method
04934 * is invoked on an instance that is not a number. See {@link Js#err(Object)} and
04935 * {@link js.core.JsTypeError} for JS Simulation.
04936 * @see #toString()
04937 * @see #toExponential()
04938 * @see #toExponential(Object)
04939 * @see #toFixed()
04940 * @see #toFixed(Object)
04941 * @see #toPrecision()
04942 * @see #toPrecision(Object)
04943 * @see #toLocaleString()
04944 * @since 1.0
04945 * @javascript Re-compilers must convert the instance invocation of this method directly
04946 * into a JavaScript invocation on its current primitive instance without changing the
04947 * method name, but expanding variable arguments, if any, into comma-separated values.
04948 */04949 publicfinaljava.lang.StringtoString(Objectradix){04950 returnJs.s().numberLike(valueOf()).toString(radix);04951 }04952 }04953 04954 /**
04955 * <p>An <b>opaque</b> class resembling JavaScript primitive unsigned short number values.</p>
04956 *
04957 * @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>
04958 *
04959 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
04960 * generated into the target codes. Re-compilers must exit with error on the operations of
04961 * accessing that kind of class objects.
04962 */04963 04964 publicstaticfinalclassCharacterextendsNumerical<java.lang.Character>implementsNumberLike<java.lang.Number>04965 {04966 /**
04967 * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
04968 * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>.
04969 * This class and the subclasses of this class are used to declare either <b>opaque</b>
04970 * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the
04971 * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their
04972 * constructors are used to define the fields inside <b>opaque</b> classes. Under
04973 * either circumstance, the field names must be exactly same as the member names, as
04974 * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly
04975 * based on the field names.</p>
04976 *
04977 * @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>
04978 *
04979 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
04980 * in the target codes. Re-compilers must exit with error on operations accessing that kind
04981 * of class objects.
04982 * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
04983 * {@link js.Var.Member} or its subclasses to the JavaScript identifier:
04984 * <pre>q.m</pre>
04985 * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
04986 * resolved from the instance of the enclosing member. Re-compilers must resolve an
04987 * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than
04988 * {@link js.Var.Member} and its subclasses to the JavaScript identifier:
04989 * <pre>m</pre>
04990 * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
04991 * error on the access to <b>opaque</b> fields declared by this class under any other
04992 * circumstances.
04993 */04994 publicstaticfinalclassMemberextendsValue.Member<java.lang.Character>04995 {04996 /**
04997 * <p>Internally constructs a member based on a qualifying member.</p>
04998 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
04999 * or <b>internal</b> classes or class members.</p>
05000 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
05001 * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields
05002 * declared in the declaring class of this constructor itself or its subclasses.
05003 * Under this circumstance, the field names must be exactly same as the member
05004 * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type
05005 * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
05006 * to their names appending to the name resolved from the specified qualifying
05007 * member with a dot in between.</p>
05008 * @param q A qualifying member
05009 * @param mid The ID of the member to construct
05010 * @since 1.0
05011 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
05012 */05013 publicMember(JsObject.Memberq,Midmid){05014 super(q,mid);05015 }05016 /**
05017 * <p>Internally constructs a member without a qualifying member.</p>
05018 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
05019 * or <b>internal</b> classes or class members.</p>
05020 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
05021 * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields,
05022 * declared in <b>opaque</b> types other than the declaring class of this constructor
05023 * itself and its subclasses. Under this circumstance, the field names must be
05024 * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
05025 * types are generally resolved by re-compilers directly to identifiers of their names.</p>
05026 * @param mid The ID of the member to construct
05027 * @since 1.0
05028 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
05029 */05030 publicMember(Midmid){05031 super(mid);05032 }05033 }05034 05035 /**
05036 * <p>Returns the primitive value associated with the current instance, if there is one.</p>
05037 * @return The primitive value associated with the current instance.
05038 * @see #toString()
05039 * @since 1.0
05040 * @javascript Re-compilers must convert the instance invocation of this method directly
05041 * into a JavaScript invocation on its current instance without changing the method
05042 * name, but expanding variable arguments, if any, into comma-separated values.
05043 */05044 @Override05045 publicfinaljava.lang.NumbervalueOf(){05046 returnJs.valueOf(var());05047 }05048 05049 /**
05050 * <p>Constructs a primitive character instance from a primitive character value.</p>
05051 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05052 * wrap primitive data types are also "primitive" to JS.</p>
05053 * @since 1.0
05054 * @javascript Re-compilers must ignore the construction operation of this constructor,
05055 * that is, replacing it with its only argument.
05056 */05057 publicCharacter(java.lang.Charactervalue){05058 super(value);05059 }05060 /**
05061 * <p>Constructs a primitive character instance from a primitive value.</p>
05062 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05063 * wrap primitive data types are also "primitive" to JS.</p>
05064 * @since 1.0
05065 * @javascript Re-compilers must ignore the construction operation of this constructor,
05066 * that is, replacing it with its only argument.
05067 */05068 publicCharacter(Charactervalue){05069 super(value==null?null:value.var());05070 }05071 /**
05072 * <p>Constructs a primitive character instance from a primitive value.</p>
05073 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05074 * wrap primitive data types are also "primitive" to JS.</p>
05075 * @since 1.0
05076 * @javascript Re-compilers must ignore the construction operation of this constructor,
05077 * that is, replacing it with its only argument.
05078 */05079 publicCharacter(java.lang.Bytevalue){05080 super(value==null?null:(char)value.byteValue());05081 }05082 /**
05083 * <p>Constructs a primitive character instance from a primitive value.</p>
05084 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05085 * wrap primitive data types are also "primitive" to JS.</p>
05086 * @since 1.0
05087 * @javascript Re-compilers must ignore the construction operation of this constructor,
05088 * that is, replacing it with its only argument.
05089 */05090 publicCharacter(Bytevalue){05091 super(Js.undefined(value)?null:(char)value.var().byteValue());05092 }05093 /**
05094 * <p>Constructs a primitive character instance from a primitive value.</p>
05095 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05096 * wrap primitive data types are also "primitive" to JS.</p>
05097 * @since 1.0
05098 * @javascript Re-compilers must ignore the construction operation of this constructor,
05099 * that is, replacing it with its only argument.
05100 */05101 publicCharacter(java.lang.Shortvalue){05102 super(value==null?null:(char)value.shortValue());05103 }05104 /**
05105 * <p>Constructs a primitive character instance from a primitive value.</p>
05106 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05107 * wrap primitive data types are also "primitive" to JS.</p>
05108 * @since 1.0
05109 * @javascript Re-compilers must ignore the construction operation of this constructor,
05110 * that is, replacing it with its only argument.
05111 */05112 publicCharacter(Shortvalue){05113 super(Js.undefined(value)?null:(char)value.var().shortValue());05114 }05115 /**
05116 * <p>Constructs a primitive character instance from a primitive value.</p>
05117 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05118 * wrap primitive data types are also "primitive" to JS.</p>
05119 * @since 1.0
05120 * @javascript Re-compilers must ignore the construction operation of this constructor,
05121 * that is, replacing it with its only argument.
05122 */05123 publicCharacter(java.lang.Numbervalue){05124 super((char)value.shortValue());05125 }05126 /**
05127 * <p>Constructs a primitive character instance from a primitive value.</p>
05128 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
05129 * wrap primitive data types are also "primitive" to JS.</p>
05130 * @since 1.0
05131 * @javascript Re-compilers must ignore the construction operation of this constructor,
05132 * that is, replacing it with its only argument.
05133 */05134 publicCharacter(Var<?extendsjava.lang.Number>value){05135 super((char)value.var().shortValue());05136 }05137 05138 /**
05139 * <p>Performs unary negation, resembling the unary minus operator in JavaScript.</p>
05140 * <p>This operation converts a positive value to an equivalently negative value, and
05141 * vice versa. If the operand is not a number, it attempts to convert it to one.</p>
05142 * @return The negation of the current primitive instance.
05143 * @since 1.0
05144 * @javascript Re-compilers must replace the instance invocation of this method with the
05145 * JavaScript expression:
05146 * <pre>-p</pre>
05147 * where <tt>p</tt> is the current primitive instance of the invocation of this
05148 * method.
05149 */05150 publicfinalCharacterneg(){05151 returnnewCharacter((char)Js.neg(this).shortValue());05152 }05153 05154 /**
05155 * <p>Increases the current primitive instance by 1 and then returns the current
05156 * primitive instance, resembling the pre-increment operator in JavaScript.</p>
05157 * @return The current primitive instance increased by 1.
05158 * @since 1.0
05159 * @javascript A re-compiler is expected to replace the instance invocation of this
05160 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05161 * <pre>++p</pre>
05162 * where <tt>p</tt> is the primitive value of the current primitive instance of the
05163 * invocation of this method.
05164 */05165 publicfinalCharacterinc(){05166 var((char)Js.add(var(),1).shortValue());05167 returnthis;05168 }05169 05170 /**
05171 * <p>Decreases the current primitive instance by 1 and then returns the current
05172 * primitive instance, resembling the pre-decrement operator in JavaScript.</p>
05173 * @return The current primitive instance increased by 1.
05174 * @since 1.0
05175 * @javascript A re-compiler is expected to replace the instance invocation of this
05176 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05177 * <pre>--p</pre>
05178 * where <tt>p</tt> is the primitive value of the current primitive instance of the
05179 * invocation of this method.
05180 */05181 publicfinalCharacterdec(){05182 var((char)Js.sub(var(),1).shortValue());05183 returnthis;05184 }05185 05186 /**
05187 * <p>Returns a copy of the current primitive instance and then increases the
05188 * current primitive instance by 1, resembling the post-increment operator in
05189 * JavaScript.</p>
05190 * @return A copy of the original primitive instance.
05191 * @since 1.0
05192 * @javascript A re-compiler is expected to replace the instance invocation of this
05193 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05194 * <pre>p++</pre>
05195 * where <tt>p</tt> is the primitive value of the current primitive instance of the
05196 * invocation of this method.
05197 */05198 publicfinalCharacterincp(){05199 java.lang.Characterv=var();05200 var((char)Js.add(v,1).shortValue());05201 returnthis;05202 }05203 05204 /**
05205 * <p>Returns a copy of the current primitive instance and then decreases the
05206 * current primitive instance by 1, resembling the post-decrement operator in
05207 * JavaScript.</p>
05208 * @return A copy of the undecremented primitive instance.
05209 * @since 1.0
05210 * @javascript A re-compiler is expected to replace the instance invocation of this
05211 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05212 * <pre>p--</pre>
05213 * where <tt>p</tt> is the primitive value of the current primitive instance of the
05214 * invocation of this method.
05215 */05216 publicfinalCharacterdecp(){05217 java.lang.Characterv=var();05218 var((char)Js.sub(v,1).shortValue());05219 returnthis;05220 }05221 05222 /**
05223 * <p>Adds a numeric operand to the current primitive instance and returns the
05224 * numeric operand, resembling the assignment-with-addition operator in JavaScript.</p>
05225 * <p>If one value is a string, the other is converted to a string, and the two
05226 * strings are then concatenated. Object operands are converted to numbers or strings
05227 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
05228 * method and/or the {@link Js#toString(Object)} method on the object.</p>
05229 * @param value A value or object.
05230 * @return The <tt>char</tt> value of the argument.
05231 * @since 1.0
05232 * @javascript A re-compiler is expected to replace the instance invocation of this
05233 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05234 * <pre>p += (char)value</pre>
05235 * where <tt>p</tt> is the integer value of the current primitive instance of the
05236 * invocation of this method.
05237 */05238 publicfinalCharacteraadd(Objectvalue){05239 Objectv=Js.valueOf(value);05240 var(05241 vinstanceofjava.lang.Character?05242 (char)Js.add(this.var(),(java.lang.Character)v).shortValue():05243 (char)Js.add(this.var(),(java.lang.Number)v).shortValue()05244 );05245 returnthis;05246 }05247 05248 /**
05249 * <p>Subtracts a numeric operand from the current primitive instance and returns the
05250 * numeric operand, resembling the assignment-with-subtraction operator in JavaScript.</p>
05251 * <p>If used with non-numeric values, this operation attempts to convert them to
05252 * numbers.</p>
05253 * @param value A value or object.
05254 * @return The <tt>char</tt> value of the argument.
05255 * @since 1.0
05256 * @javascript A re-compiler is expected to replace the instance invocation of this
05257 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05258 * <pre>p -= (char)value</pre>
05259 * where <tt>p</tt> is the integer value of the current primitive instance of the
05260 * invocation of this method.
05261 */05262 publicfinalCharacterasub(Objectvalue){05263 Objectv=Js.valueOf(value);05264 var(05265 vinstanceofjava.lang.Character?05266 (char)Js.sub(var(),(java.lang.Character)v).shortValue():05267 (char)Js.sub(var(),(java.lang.Number)v).shortValue()05268 );05269 returnthis;05270 }05271 05272 /**
05273 * <p>Multiplies a numeric operand to the current primitive instance and returns the
05274 * numeric operand, resembling the assignment-with-multiplication operator in JavaScript.</p>
05275 * <p>If used with non-numeric values, this operation attempts to convert them to
05276 * numbers.</p>
05277 * @param value A value or object.
05278 * @return The <tt>char</tt> value of the argument.
05279 * @since 1.0
05280 * @javascript A re-compiler is expected to replace the instance invocation of this
05281 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05282 * <pre>p *= (char)value</pre>
05283 * where <tt>p</tt> is the integer value of the current primitive instance of the
05284 * invocation of this method.
05285 */05286 publicfinalCharacteramul(Objectvalue){05287 Objectv=Js.valueOf(value);05288 var(vinstanceofjava.lang.Character?05289 (char)Js.mul(var(),(java.lang.Character)v).shortValue():05290 (char)Js.mul(var(),(java.lang.Number)v).shortValue()05291 );05292 returnthis;05293 }05294 05295 /**
05296 * <p>Divides, by a numeric operand, the current primitive instance and returns the
05297 * numeric operand, resembling the assignment-with-division operator in JavaScript.</p>
05298 * <p>Used with non-numeric values, this operation attempts to convert them to
05299 * numbers. If you are used to programming languages that distinguish between integer
05300 * and floating-point numbers, you might expect to get an integer result when you
05301 * divide one integer by another. In JavaScript, however, all numbers are floating-point,
05302 * so all division operations have floating-point results. Division by zero yields positive
05303 * or negative infinity, while <tt>0/0</tt> evaluates to <tt>NaN</tt>.</p>
05304 * @param value A value or object.
05305 * @return The <tt>char</tt> value of the argument.
05306 * @since 1.0
05307 * @javascript A re-compiler is expected to replace the instance invocation of this
05308 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05309 * <pre>p /= (char)value</pre>
05310 * where <tt>p</tt> is the integer value of the current primitive instance of the
05311 * invocation of this method.
05312 */05313 publicfinalCharacteradiv(Objectvalue){05314 Objectv=Js.valueOf(value);05315 var(vinstanceofjava.lang.Character?05316 (char)Js.div(var(),(java.lang.Character)v).shortValue():05317 (char)Js.div(var(),(java.lang.Number)v).shortValue()05318 );05319 returnthis;05320 }05321 05322 /**
05323 * <p>Modulo operates a numeric operand onto the current primitive instance and
05324 * returns the numeric operand, resembling the assignment-with-modulo operator in
05325 * JavaScript.</p>
05326 * <p>The operation computes the remainder when the current primitive instance is
05327 * divided by the operand a certain number of times. If used with non-numeric values,
05328 * the operation attempts to convert them to numbers. The sign of the result is the
05329 * same as the sign of the current primitive instance.</p>
05330 * <p>This operation is typically used with integer values, it also works for
05331 * floating-point values.</p>
05332 * @param value A value or object.
05333 * @return The <tt>char</tt> value of the argument.
05334 * @since 1.0
05335 * @javascript A re-compiler is expected to replace the instance invocation of this
05336 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05337 * <pre>p %= (char)value</pre>
05338 * where <tt>p</tt> is the integer value of the current primitive instance of the
05339 * invocation of this method.
05340 */05341 publicfinalCharacteramod(Objectvalue){05342 Objectv=Js.valueOf(value);05343 var(vinstanceofjava.lang.Character?05344 (char)Js.mod(var(),(java.lang.Character)v).shortValue():05345 (char)Js.mod(var(),(java.lang.Number)v).shortValue()05346 );05347 returnthis;05348 }05349 05350 /**
05351 * <p>Assignment-with-shift-left operation, resembling that of JavaScript, moves all bits in the
05352 * current primitive instance to the left by the number of places specified in the
05353 * second operand, which should be an integer between 0 and 31.</p>
05354 * <p>A zero is used for the new first bit, and the value of the 32nd bit is lost.
05355 * Shifting a value left by one position is equivalent to multiplying by 2, shifting
05356 * two positions is equivalent to multiplying by 4, etc.</p>
05357 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05358 * operation requires numeric operands that have integer values. It operate on the integer
05359 * operands using a 32-bit integer representation instead of the equivalent floating-point
05360 * representation.</p>
05361 * <p>If this bitwise operation is used with values that are not integers or are too
05362 * large to fit in a 32-bit integer representation, it simply coerces the values to
05363 * 32-bit integers by dropping any fractional part of the value or any bits beyond
05364 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
05365 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
05366 * yields a number in the appropriate range.</p>
05367 * @param n The number of bits to shift.
05368 * @return The shifted primitive instance.
05369 * @since 1.0
05370 * @javascript A re-compiler is expected to replace the instance invocation of this
05371 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05372 * <pre>p <<= n & 0x3f</pre>
05373 * where <tt>p</tt> is the integer value of the current primitive instance of the
05374 * invocation of this method.
05375 */05376 publicfinalCharacterashl(intn){05377 var((char)Js.shl(this,n));05378 returnthis;05379 }05380 05381 /**
05382 * <p>Assignment-with-shift-right operation, resembling that of JavaScript, moves all bits in the
05383 * current primitive instance to the right by the number of places specified in the
05384 * second operand (an integer between 0 and 31). Bits that are shifted off the right
05385 * are lost. The bits filled in on the left depend on the sign bit of the original
05386 * value, in order to preserve the sign of the result. If the current primitive
05387 * instance is positive, the result has zeros placed in the high bits; if the current
05388 * primitive instance is negative, the result has ones placed in the high bits.</p>
05389 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
05390 * remainder), shifting right two places is equivalent to integer division by 4, and
05391 * so on.</p>
05392 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05393 * operation requires numeric operands that have integer values. It operate on the integer
05394 * operands using a 32-bit integer representation instead of the equivalent floating-point
05395 * representation.</p>
05396 * <p>If this bitwise operation is used with values that are not integers or are too
05397 * large to fit in a 32-bit integer representation, it simply coerces the values to
05398 * 32-bit integers by dropping any fractional part of the value or any bits beyond
05399 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
05400 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
05401 * yields a number in the appropriate range.</p>
05402 * @param n The number of bits to shift.
05403 * @return The shifted primitive instance.
05404 * @since 1.0
05405 * @javascript A re-compiler is expected to replace the instance invocation of this
05406 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05407 * <pre>p >>= n & 0x3f</pre>
05408 * where <tt>p</tt> is the integer value of the current primitive instance of the
05409 * invocation of this method.
05410 */05411 publicfinalCharacterashr(intn){05412 var((char)Js.shr(this,n));05413 returnthis;05414 }05415 05416 /**
05417 * <p>Assignment-with-shift-right-unsigned operation, resembling that of JavaScript, moves all bits in
05418 * the current primitive instance to the right by the number of places specified in the
05419 * second operand (an integer between 0 and 31). Bits that are shifted off the right
05420 * are lost. The result has zeros placed in the high bits.</p>
05421 * <p>This operation is just like {@link #shr(int)}, except that the bits shifted
05422 * in on the left are always zero, regardless of the sign of the current primitive instance.</p>
05423 * <p>Shifting a value right one place is equivalent to dividing by 2 (discarding the
05424 * remainder), shifting right two places is equivalent to integer division by 4, and
05425 * so on.</p>
05426 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05427 * operation requires numeric operands that have integer values. It operate on the integer
05428 * operands using a 32-bit integer representation instead of the equivalent floating-point
05429 * representation.</p>
05430 * <p>If this bitwise operation is used with values that are not integers or are too
05431 * large to fit in a 32-bit integer representation, it simply coerces the values to
05432 * 32-bit integers by dropping any fractional part of the value or any bits beyond
05433 * the 32nd. The shift operation requires a (right-side) operand between 0 and 31. After
05434 * converting this operand to a 32-bit integer, it drops any bits beyond the 5th, which
05435 * yields a number in the appropriate range.</p>
05436 * @param n The number of bits to shift.
05437 * @return The shifted primitive instance.
05438 * @since 1.0
05439 * @javascript A re-compiler is expected to replace the instance invocation of this
05440 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05441 * <pre>p >>>= n & 0x3f</pre>
05442 * where <tt>p</tt> is the integer value of the current primitive instance of the
05443 * invocation of this method.
05444 */05445 publicfinalCharacterashru(intn){05446 var((char)Js.shru(this,n));05447 returnthis;05448 }05449 05450 /**
05451 * <p>Assignment-with-bitwise-AND operation, resembling that of JavaScript, performs a boolean AND
05452 * operation on each bit of the integer arguments. A bit is set in the result only if
05453 * the corresponding bit is set in both operands.</p>
05454 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05455 * operation requires numeric operands that have integer values. It operate on the integer
05456 * operands using a 32-bit integer representation instead of the equivalent floating-point
05457 * representation.</p>
05458 * <p>If this bitwise operation is used with operands that are not integers or are too
05459 * large to fit in a 32-bit integer representation, it simply coerces the operands to
05460 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
05461 * the 32nd.</p>
05462 * @param value A numeric value.
05463 * @return The bitwise-AND of the two operands.
05464 * @since 1.0
05465 * @javascript A re-compiler is expected to replace the instance invocation of this
05466 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05467 * <pre>p &= (char)value</pre>
05468 * where <tt>p</tt> is the integer value of the current primitive instance of the
05469 * invocation of this method.
05470 */05471 publicfinalCharacteraand(Objectvalue){05472 var((char)Js.band(this,value));05473 returnthis;05474 }05475 05476 /**
05477 * <p>Assignment-with-bitwise-OR operation, resembling that of JavaScript, performs a boolean OR operation
05478 * on each bit of the integer arguments. A bit is set in the result if the corresponding
05479 * bit is set in one or both of the operands.</p>
05480 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05481 * operation requires numeric operands that have integer values. It operate on the integer
05482 * operands using a 32-bit integer representation instead of the equivalent floating-point
05483 * representation.</p>
05484 * <p>If this bitwise operation is used with operands that are not integers or are too
05485 * large to fit in a 32-bit integer representation, it simply coerces the operands to
05486 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
05487 * the 32nd.</p>
05488 * @param value A numeric value.
05489 * @return The bitwise-OR of the two operands.
05490 * @since 1.0
05491 * @javascript A re-compiler is expected to replace the instance invocation of this
05492 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05493 * <pre>p |= (char)value</pre>
05494 * where <tt>p</tt> is the integer value of the current primitive instance of the
05495 * invocation of this method.
05496 */05497 publicfinalCharacteraor(Objectvalue){05498 var((char)Js.bor(this,value));05499 returnthis;05500 }05501 05502 /**
05503 * <p>Assignment-with-bitwise-XOR operation, resembling that of JavaScript, performs a boolean exclusive
05504 * OR operation on each bit of the integer arguments. Exclusive OR means that either
05505 * operand one is <tt>true</tt> or operand two is <tt>true</tt>, but not both. A bit is
05506 * set in this operation's result if a corresponding bit is set in one (but not both)
05507 * of the two operands.</p>
05508 * <p>Despite the fact that all numbers in JavaScript are floating-point numbers, the bitwise
05509 * operation requires numeric operands that have integer values. It operate on the integer
05510 * operands using a 32-bit integer representation instead of the equivalent floating-point
05511 * representation.</p>
05512 * <p>If this bitwise operation is used with operands that are not integers or are too
05513 * large to fit in a 32-bit integer representation, it simply coerces the operands to
05514 * 32-bit integers by dropping any fractional part of the operand or any bits beyond
05515 * the 32nd.</p>
05516 * @param value A numeric value.
05517 * @return The bitwise-exclusive-OR of the two operands.
05518 * @since 1.0
05519 * @javascript A re-compiler is expected to replace the instance invocation of this
05520 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
05521 * <pre>p ^= (char)value</pre>
05522 * where <tt>p</tt> is the integer value of the current primitive instance of the
05523 * invocation of this method.
05524 */05525 publicfinalCharacteraxor(Objectvalue){05526 var((char)Js.xor(this,value));05527 returnthis;05528 }05529 05530 /**
05531 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
05532 * operation on the two values: it returns <tt>true</tt> if and only if both its first
05533 * operand and its second operand are <tt>true</tt>. If one or both of these operands
05534 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
05535 * <p>In JavaScript, depending on the value of the left-side expression, the operator
05536 * may or may not evaluate the right-side expression. The actual behavior of the operator
05537 * is somewhat more complicated. It starts by evaluating its first operand, the expression
05538 * on its left. If the value of this expression can be converted to <tt>false</tt>
05539 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
05540 * the operator returns the value of the left-side expression. Otherwise, it evaluates
05541 * its second operand, the expression on its right, and returns the value of that
05542 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
05543 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
05544 * returning the unconverted value of the left-side expression.</p>
05545 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05546 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05547 * anonymously, returning the actual expression in the method overriding
05548 * {@link Var#var()}.</p>
05549 * <p>Sometimes, this operation probably does not do what the programmers intended.
05550 * To avoid problems, do not use expressions with side effects (assignments, increments,
05551 * decrements, and function calls) for the second operand unless you are quite sure
05552 * you know exactly what you are doing.</p>
05553 * <p>Despite the fairly confusing way that this operation actually works, it is
05554 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
05555 * Although it does not actually return a boolean value, the value it returns can always
05556 * be converted to a boolean value.</p>
05557 * <p>Note that, this method is probably useful in emulation codes just for perfect
05558 * re-compilations. However, in most cases you can use the logical AND operator of the
05559 * Java language like this:
05560 * <pre>Js.be(var) && Js.be(other)</pre>
05561 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05562 * JavaScript expression since the Java compilers generally used are free to compile
05563 * the expression into any byte codes they think efficient, making it too hard for the
05564 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05565 * @param other A value or object.
05566 * @return The logical AND of the two operands.
05567 * @since 1.0
05568 * @javascript Re-compilers must replace the instance invocation of this method with the
05569 * JavaScript expression:
05570 * <pre>p && other</pre>
05571 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05572 */05573 @Override05574 publicfinalCharacterand(java.lang.Characterother){05575 returnnewCharacter(Js.and(this,other));05576 }05577 05578 /**
05579 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
05580 * operation on the two values: it returns <tt>true</tt> if and only if both its first
05581 * operand and its second operand are <tt>true</tt>. If one or both of these operands
05582 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
05583 * <p>In JavaScript, depending on the value of the left-side expression, the operator
05584 * may or may not evaluate the right-side expression. The actual behavior of the operator
05585 * is somewhat more complicated. It starts by evaluating its first operand, the expression
05586 * on its left. If the value of this expression can be converted to <tt>false</tt>
05587 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
05588 * the operator returns the value of the left-side expression. Otherwise, it evaluates
05589 * its second operand, the expression on its right, and returns the value of that
05590 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
05591 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
05592 * returning the unconverted value of the left-side expression.</p>
05593 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05594 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05595 * anonymously, returning the actual expression in the method overriding
05596 * {@link Var#var()}.</p>
05597 * <p>Sometimes, this operation probably does not do what the programmers intended.
05598 * To avoid problems, do not use expressions with side effects (assignments, increments,
05599 * decrements, and function calls) for the second operand unless you are quite sure
05600 * you know exactly what you are doing.</p>
05601 * <p>Despite the fairly confusing way that this operation actually works, it is
05602 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
05603 * Although it does not actually return a boolean value, the value it returns can always
05604 * be converted to a boolean value.</p>
05605 * <p>Note that, this method is probably useful in emulation codes just for perfect
05606 * re-compilations. However, in most cases you can use the logical AND operator of the
05607 * Java language like this:
05608 * <pre>Js.be(var) && Js.be(other)</pre>
05609 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05610 * JavaScript expression since the Java compilers generally used are free to compile
05611 * the expression into any byte codes they think efficient, making it too hard for the
05612 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05613 * @param other A value or object.
05614 * @return The logical AND of the two operands.
05615 * @since 1.0
05616 * @javascript Re-compilers must replace the instance invocation of this method with the
05617 * JavaScript expression:
05618 * <pre>p && other</pre>
05619 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05620 */05621 publicfinalCharacterand(Value<java.lang.Character>other){05622 returnnewCharacter(Js.and(this,other));05623 }05624 05625 /**
05626 * <p>Logical AND operation, resembling that of JavaScript, performs the Boolean AND
05627 * operation on the two values: it returns <tt>true</tt> if and only if both its first
05628 * operand and its second operand are <tt>true</tt>. If one or both of these operands
05629 * is <tt>false</tt>, it returns <tt>false</tt>.</p>
05630 * <p>In JavaScript, depending on the value of the left-side expression, the operator
05631 * may or may not evaluate the right-side expression. The actual behavior of the operator
05632 * is somewhat more complicated. It starts by evaluating its first operand, the expression
05633 * on its left. If the value of this expression can be converted to <tt>false</tt>
05634 * (for example, if the left operand evaluates to <tt>null</tt>, 0, "", or undefined),
05635 * the operator returns the value of the left-side expression. Otherwise, it evaluates
05636 * its second operand, the expression on its right, and returns the value of that
05637 * expression. In JavaScript 1.0 and JavaScript 1.1, if the left-side expression
05638 * evaluates to <tt>false</tt>, the && operator returns <tt>false</tt> rather than
05639 * returning the unconverted value of the left-side expression.</p>
05640 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05641 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05642 * anonymously, returning the actual expression in the method overriding
05643 * {@link Var#var()}.</p>
05644 * <p>Sometimes, this operation probably does not do what the programmers intended.
05645 * To avoid problems, do not use expressions with side effects (assignments, increments,
05646 * decrements, and function calls) for the second operand unless you are quite sure
05647 * you know exactly what you are doing.</p>
05648 * <p>Despite the fairly confusing way that this operation actually works, it is
05649 * easiest, and perfectly safe, to think of it as merely a Boolean algebra operator.
05650 * Although it does not actually return a boolean value, the value it returns can always
05651 * be converted to a boolean value.</p>
05652 * <p>Note that, this method is probably useful in emulation codes just for perfect
05653 * re-compilations. However, in most cases you can use the logical AND operator of the
05654 * Java language like this:
05655 * <pre>Js.be(var) && Js.be(other)</pre>
05656 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05657 * JavaScript expression since the Java compilers generally used are free to compile
05658 * the expression into any byte codes they think efficient, making it too hard for the
05659 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05660 * @param other A value or object.
05661 * @return The logical AND of the two operands.
05662 * @since 1.0
05663 * @javascript Re-compilers must replace the instance invocation of this method with the
05664 * JavaScript expression:
05665 * <pre>p && other</pre>
05666 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05667 */05668 publicfinalCharacterand(Characterother){05669 returnnewCharacter(Js.and(this,other));05670 }05671 05672 /**
05673 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
05674 * operation on the two values: it returns <tt>true</tt> if either the first operand or
05675 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
05676 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
05677 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
05678 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
05679 * its first operand, the expression on its left. If the value of this expression can
05680 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
05681 * expression. Otherwise, it evaluates its second operand, the expression on its right,
05682 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
05683 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
05684 * and doesn't return the unconverted value of the left-side expression.</p>
05685 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05686 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05687 * anonymously, returning the actual expression in the method overriding
05688 * {@link Var#var()}.</p>
05689 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
05690 * operands that include side effects, unless you purposely want to use the fact that
05691 * the right-side expression may not be evaluated in JavaScript.</p>
05692 * <p>Even when this operation is used with operands that are not boolean values, it
05693 * can still be considered a Boolean OR operator because its return value, whatever the
05694 * type, can be converted to a boolean value.</p>
05695 * <p>Note that, this method is probably useful in emulation codes just for perfect
05696 * re-compilations. However, in most cases you can use the logical OR operator of the
05697 * Java language like this:
05698 * <pre>Js.be(var) || Js.be(other)</pre>
05699 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05700 * JavaScript expression since the Java compilers generally used are free to compile
05701 * the expression into any byte codes they think efficient, making it too hard for the
05702 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05703 * @param other A value or object.
05704 * @return The logical OR of the two operands.
05705 * @since 1.0
05706 * @javascript Re-compilers must replace the instance invocation of this method with the
05707 * JavaScript expression:
05708 * <pre>p || other</pre>
05709 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05710 */05711 @Override05712 publicfinalCharacteror(java.lang.Characterother){05713 returnnewCharacter(Js.or(this,other));05714 }05715 05716 /**
05717 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
05718 * operation on the two values: it returns <tt>true</tt> if either the first operand or
05719 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
05720 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
05721 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
05722 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
05723 * its first operand, the expression on its left. If the value of this expression can
05724 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
05725 * expression. Otherwise, it evaluates its second operand, the expression on its right,
05726 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
05727 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
05728 * and doesn't return the unconverted value of the left-side expression.</p>
05729 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05730 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05731 * anonymously, returning the actual expression in the method overriding
05732 * {@link Var#var()}.</p>
05733 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
05734 * operands that include side effects, unless you purposely want to use the fact that
05735 * the right-side expression may not be evaluated in JavaScript.</p>
05736 * <p>Even when this operation is used with operands that are not boolean values, it
05737 * can still be considered a Boolean OR operator because its return value, whatever the
05738 * type, can be converted to a boolean value.</p>
05739 * <p>Note that, this method is probably useful in emulation codes just for perfect
05740 * re-compilations. However, in most cases you can use the logical OR operator of the
05741 * Java language like this:
05742 * <pre>Js.be(var) || Js.be(other)</pre>
05743 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05744 * JavaScript expression since the Java compilers generally used are free to compile
05745 * the expression into any byte codes they think efficient, making it too hard for the
05746 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05747 * @param other A value or object.
05748 * @return The logical OR of the two operands.
05749 * @since 1.0
05750 * @javascript Re-compilers must replace the instance invocation of this method with the
05751 * JavaScript expression:
05752 * <pre>p || other</pre>
05753 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05754 */05755 publicfinalCharacteror(Value<java.lang.Character>other){05756 returnnewCharacter(Js.or(this,other));05757 }05758 05759 /**
05760 * <p>Logical OR operation, resembling that of JavaScript, performs the Boolean OR
05761 * operation on the two values: it returns <tt>true</tt> if either the first operand or
05762 * the second operand is <tt>true</tt>, or if both are <tt>true</tt>. If both operands
05763 * are <tt>false</tt>, it returns <tt>false</tt>.</p>
05764 * <p>In JavaScript, although the || operator is most often used simply as a Boolean OR
05765 * operator, it, like the && operator, has more complex behavior. It starts by evaluating
05766 * its first operand, the expression on its left. If the value of this expression can
05767 * be converted to <tt>true</tt>, it returns the unconverted value of the left-side
05768 * expression. Otherwise, it evaluates its second operand, the expression on its right,
05769 * and returns the value of that expression. In JavaScript 1.0 and JavaScript 1.1, if the
05770 * left-side expression can be converted to <tt>true</tt>, the operator returns <tt>true</tt>
05771 * and doesn't return the unconverted value of the left-side expression.</p>
05772 * <p>To make the second operand really late-evaluated or not evaluated in JS Simulation
05773 * mode, resembling what happens in JavaScript, you may have to extend {@link Var}
05774 * anonymously, returning the actual expression in the method overriding
05775 * {@link Var#var()}.</p>
05776 * <p>As with the {@link #and(Object)} operation, you should avoid right-side
05777 * operands that include side effects, unless you purposely want to use the fact that
05778 * the right-side expression may not be evaluated in JavaScript.</p>
05779 * <p>Even when this operation is used with operands that are not boolean values, it
05780 * can still be considered a Boolean OR operator because its return value, whatever the
05781 * type, can be converted to a boolean value.</p>
05782 * <p>Note that, this method is probably useful in emulation codes just for perfect
05783 * re-compilations. However, in most cases you can use the logical OR operator of the
05784 * Java language like this:
05785 * <pre>Js.be(var) || Js.be(other)</pre>
05786 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05787 * JavaScript expression since the Java compilers generally used are free to compile
05788 * the expression into any byte codes they think efficient, making it too hard for the
05789 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05790 * @param other A value or object.
05791 * @return The logical OR of the two operands.
05792 * @since 1.0
05793 * @javascript Re-compilers must replace the instance invocation of this method with the
05794 * JavaScript expression:
05795 * <pre>p || other</pre>
05796 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05797 */05798 publicfinalCharacteror(Characterother){05799 returnnewCharacter(Js.or(this,other));05800 }05801 05802 /**
05803 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
05804 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
05805 * operand, otherwise.</p>
05806 * <p>The first operand of the conditional operation must be (or be convertible to) a
05807 * boolean value. Usually this is the result of a comparison operation. The second and
05808 * third operands may have any value. The value returned by the conditional operation
05809 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
05810 * the value of the conditional expression is the value of the second operand. If the
05811 * first operand is <tt>false</tt>, the value of the conditional expression is the
05812 * value of the third operand.</p>
05813 * <p>To make the second and third operands really late-evaluated or not evaluated in
05814 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
05815 * {@link Var} anonymously, returning the actual expression in the method overriding
05816 * {@link Var#var()}.</p>
05817 * <p>Note that, this method is probably useful in emulation codes just for perfect
05818 * re-compilations. However, in most cases you can use the conditional operator of the
05819 * Java language like this:
05820 * <pre>Js.be(test) ? var : other</pre>
05821 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05822 * JavaScript expression since the Java compilers generally used are free to compile
05823 * the expression into any byte codes they think efficient, making it too hard for the
05824 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05825 * @param other A value or object.
05826 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
05827 * the third operand.
05828 * @since 1.0
05829 * @javascript Re-compilers must replace the instance invocation of this method with the
05830 * JavaScript expression:
05831 * <pre>test ? p : other</pre>
05832 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05833 */05834 @Override05835 publicfinalCharactercond(Objecttest,java.lang.Characterother){05836 returnJs.be(test)?this:newCharacter(other);05837 }05838 05839 /**
05840 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
05841 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
05842 * operand, otherwise.</p>
05843 * <p>The first operand of the conditional operation must be (or be convertible to) a
05844 * boolean value. Usually this is the result of a comparison operation. The second and
05845 * third operands may have any value. The value returned by the conditional operation
05846 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
05847 * the value of the conditional expression is the value of the second operand. If the
05848 * first operand is <tt>false</tt>, the value of the conditional expression is the
05849 * value of the third operand.</p>
05850 * <p>To make the second and third operands really late-evaluated or not evaluated in
05851 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
05852 * {@link Var} anonymously, returning the actual expression in the method overriding
05853 * {@link Var#var()}.</p>
05854 * <p>Note that, this method is probably useful in emulation codes just for perfect
05855 * re-compilations. However, in most cases you can use the conditional operator of the
05856 * Java language like this:
05857 * <pre>Js.be(test) ? var : other</pre>
05858 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05859 * JavaScript expression since the Java compilers generally used are free to compile
05860 * the expression into any byte codes they think efficient, making it too hard for the
05861 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05862 * @param other A value or object.
05863 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
05864 * the third operand.
05865 * @since 1.0
05866 * @javascript Re-compilers must replace the instance invocation of this method with the
05867 * JavaScript expression:
05868 * <pre>test ? p : other</pre>
05869 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05870 */05871 publicfinalCharactercond(Objecttest,Value<java.lang.Character>other){05872 returnJs.be(test)?this:newCharacter(other.var());05873 }05874 05875 /**
05876 * <p>Conditional operation, resembling the ternary operator of JavaScript, returns the
05877 * second operand if the first operand evaluates to <tt>true</tt>; Returns the third
05878 * operand, otherwise.</p>
05879 * <p>The first operand of the conditional operation must be (or be convertible to) a
05880 * boolean value. Usually this is the result of a comparison operation. The second and
05881 * third operands may have any value. The value returned by the conditional operation
05882 * depends on the boolean value of the first operand. If that operand is <tt>true</tt>,
05883 * the value of the conditional expression is the value of the second operand. If the
05884 * first operand is <tt>false</tt>, the value of the conditional expression is the
05885 * value of the third operand.</p>
05886 * <p>To make the second and third operands really late-evaluated or not evaluated in
05887 * JS Simulation mode, resembling what happens in JavaScript, you may have to extend
05888 * {@link Var} anonymously, returning the actual expression in the method overriding
05889 * {@link Var#var()}.</p>
05890 * <p>Note that, this method is probably useful in emulation codes just for perfect
05891 * re-compilations. However, in most cases you can use the conditional operator of the
05892 * Java language like this:
05893 * <pre>Js.be(test) ? var : other</pre>
05894 * which is definitely late-evaluated but not necessarily re-compiled into an expected
05895 * JavaScript expression since the Java compilers generally used are free to compile
05896 * the expression into any byte codes they think efficient, making it too hard for the
05897 * re-compilers to reconvert the byte codes to an expression in JavaScript.</p>
05898 * @param other A value or object.
05899 * @return The second operand if the first operand evaluates to <tt>true</tt>; Otherwise,
05900 * the third operand.
05901 * @since 1.0
05902 * @javascript Re-compilers must replace the instance invocation of this method with the
05903 * JavaScript expression:
05904 * <pre>test ? p : other</pre>
05905 * where <tt>p</tt> is the current primitive instance of the invocation of this method.
05906 */05907 publicfinalCharactercond(Objecttest,Characterother){05908 returnJs.be(test)?this:other;05909 }05910 }05911 05912 /**
05913 * <p>An <b>opaque</b> class resembling JavaScript primitive number values.</p>
05914 *
05915 * @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>
05916 *
05917 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
05918 * generated into the target codes. Re-compilers must exit with error on the operations of
05919 * accessing that kind of class objects.
05920 */05921 05922 publicstaticfinalclassNumberextendsNumerical<java.lang.Number>implementsNumberLike<java.lang.Number>05923 {05924 /**
05925 * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
05926 * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>.
05927 * This class and the subclasses of this class are used to declare either <b>opaque</b>
05928 * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the
05929 * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their
05930 * constructors are used to define the fields inside <b>opaque</b> classes. Under
05931 * either circumstance, the field names must be exactly same as the member names, as
05932 * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly
05933 * based on the field names.</p>
05934 *
05935 * @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>
05936 *
05937 * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
05938 * in the target codes. Re-compilers must exit with error on operations accessing that kind
05939 * of class objects.
05940 * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
05941 * {@link js.Var.Member} or its subclasses to the JavaScript identifier:
05942 * <pre>q.m</pre>
05943 * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
05944 * resolved from the instance of the enclosing member. Re-compilers must resolve an
05945 * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than
05946 * {@link js.Var.Member} and its subclasses to the JavaScript identifier:
05947 * <pre>m</pre>
05948 * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
05949 * error on the access to <b>opaque</b> fields declared by this class under any other
05950 * circumstances.
05951 */05952 publicstaticfinalclassMemberextendsValue.Member<java.lang.Number>05953 {05954 /**
05955 * <p>Internally constructs a member based on a qualifying member.</p>
05956 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
05957 * or <b>internal</b> classes or class members.</p>
05958 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
05959 * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields
05960 * declared in the declaring class of this constructor itself or its subclasses.
05961 * Under this circumstance, the field names must be exactly same as the member
05962 * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type
05963 * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
05964 * to their names appending to the name resolved from the specified qualifying
05965 * member with a dot in between.</p>
05966 * @param q A qualifying member
05967 * @param mid The ID of the member to construct
05968 * @since 1.0
05969 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
05970 */05971 publicMember(JsObject.Memberq,Midmid){05972 super(q,mid);05973 }05974 /**
05975 * <p>Internally constructs a member without a qualifying member.</p>
05976 * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
05977 * or <b>internal</b> classes or class members.</p>
05978 * <p>Note that, this constructor is <b>internal</b> but its declaring class is
05979 * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields,
05980 * declared in <b>opaque</b> types other than the declaring class of this constructor
05981 * itself and its subclasses. Under this circumstance, the field names must be
05982 * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
05983 * types are generally resolved by re-compilers directly to identifiers of their names.</p>
05984 * @param mid The ID of the member to construct
05985 * @since 1.0
05986 * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
05987 */05988 publicMember(Midmid){05989 super(mid);05990 }05991 /**
05992 * <p>Sets a new value to the property, represented by the current member instance,
05993 * of an object.</p>
05994 * @param o The base object
05995 * @param v The new value to set
05996 * @return The new value
05997 * @since 1.0
05998 * @javascript Re-compilers must convert the instance invocation of this method into
05999 * the JavaScript expression:
06000 * <pre>o.m = v</pre>
06001 * where <tt>m</tt> is the identifier name resolved from the current member
06002 * instance of the invocation.
06003 */06004 publicjava.lang.Numberwith(ObjectLikeo,Var<?extendsjava.lang.Number>v){06005 returnwith(o,v.var());06006 }06007 /**
06008 * <p>Sets a new value to the property, represented by the current member instance,
06009 * of an object.</p>
06010 * @param o The base object
06011 * @param v The new value to set
06012 * @return The new value
06013 * @since 1.0
06014 * @javascript Re-compilers must convert the instance invocation of this method into
06015 * the JavaScript expression:
06016 * <pre>o.m = v</pre>
06017 * where <tt>m</tt> is the identifier name resolved from the current member
06018 * instance of the invocation.
06019 */06020 publicjava.lang.Numberwith(ObjectLikeo,JsNumberv){06021 returnwith(o,v.valueOf());06022 }06023 }06024 06025 /**
06026 * <p>Constructs a primitive number instance from a primitive value.</p>
06027 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
06028 * wrap primitive data types are also "primitive" to JS.</p>
06029 * @since 1.0
06030 * @javascript Re-compilers must ignore the construction operation of this constructor,
06031 * that is, replacing it with its only argument.
06032 */06033 publicNumber(java.lang.Numbervalue){06034 super(value);06035 }06036 /**
06037 * <p>Constructs a primitive number instance from a primitive value.</p>
06038 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
06039 * wrap primitive data types are also "primitive" to JS.</p>
06040 * @since 1.0
06041 * @javascript Re-compilers must ignore the construction operation of this constructor,
06042 * that is, replacing it with its only argument.
06043 */06044 publicNumber(Var<?extendsjava.lang.Number>value){06045 super(value==null?null:value.var());06046 }06047 /**
06048 * <p>Constructs a primitive number instance from a primitive value.</p>
06049 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
06050 * wrap primitive data types are also "primitive" to JS.</p>
06051 * @since 1.0
06052 * @javascript Re-compilers must ignore the construction operation of this constructor,
06053 * that is, replacing it with its only argument.
06054 */06055 publicNumber(java.lang.Charactervalue){06056 super(value==null?null:(short)value.charValue());06057 }06058 /**
06059 * <p>Constructs a primitive number instance from a primitive value.</p>
06060 * <p>Note that, The Java class <tt>java.lang.String</tt> and Java basic classes that
06061 * wrap primitive data types are also "primitive" to JS.</p>
06062 * @since 1.0
06063 * @javascript Re-compilers must ignore the construction operation of this constructor,
06064 * that is, replacing it with its only argument.
06065 */06066 publicNumber(Charactervalue){06067 super(Js.undefined(value)?null:(short)value.var().charValue());06068 }06069 06070 /**
06071 * <p>Returns the primitive value associated with the current instance, if there is one.</p>
06072 * @return The primitive value associated with the current instance.
06073 * @see #toString()
06074 * @since 1.0
06075 * @javascript Re-compilers must convert the instance invocation of this method directly
06076 * into a JavaScript invocation on its current instance without changing the method
06077 * name, but expanding variable arguments, if any, into comma-separated values.
06078 */06079 @Override06080 publicfinaljava.lang.NumbervalueOf(){06081 returnvar();06082 }06083 06084 /**
06085 * <p>Performs unary negation, resembling the unary minus operator in JavaScript.</p>
06086 * <p>This operation converts a positive value to an equivalently negative value, and
06087 * vice versa. If the operand is not a number, it attempts to convert it to one.</p>
06088 * @return The negation of the current primitive instance.
06089 * @since 1.0
06090 * @javascript Re-compilers must replace the instance invocation of this method with the
06091 * JavaScript expression:
06092 * <pre>-p</pre>
06093 * where <tt>p</tt> is the current primitive instance of the invocation of this
06094 * method.
06095 */06096 publicfinalNumberneg(){06097 returnnewNumber(Js.neg(this));06098 }06099 06100 /**
06101 * <p>Increases the current primitive instance by 1 and then returns the current
06102 * primitive instance, resembling the pre-increment operator in JavaScript.</p>
06103 * @return The current primitive instance increased by 1.
06104 * @since 1.0
06105 * @javascript A re-compiler is expected to replace the instance invocation of this
06106 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06107 * <pre>++p</pre>
06108 * where <tt>p</tt> is the primitive value of the current primitive instance of the
06109 * invocation of this method.
06110 */06111 publicfinalNumberinc(){06112 var(Js.add(var(),1));06113 returnthis;06114 }06115 06116 /**
06117 * <p>Decreases the current primitive instance by 1 and then returns the current
06118 * primitive instance, resembling the pre-decrement operator in JavaScript.</p>
06119 * @return The current primitive instance increased by 1.
06120 * @since 1.0
06121 * @javascript A re-compiler is expected to replace the instance invocation of this
06122 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06123 * <pre>--p</pre>
06124 * where <tt>p</tt> is the primitive value of the current primitive instance of the
06125 * invocation of this method.
06126 */06127 publicfinalNumberdec(){06128 var(Js.sub(var(),1));06129 returnthis;06130 }06131 06132 /**
06133 * <p>Returns a copy of the current primitive instance and then increases the
06134 * current primitive instance by 1, resembling the post-increment operator in
06135 * JavaScript.</p>
06136 * @return A copy of the original primitive instance.
06137 * @since 1.0
06138 * @javascript A re-compiler is expected to replace the instance invocation of this
06139 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06140 * <pre>p++</pre>
06141 * where <tt>p</tt> is the primitive value of the current primitive instance of the
06142 * invocation of this method.
06143 */06144 publicfinalNumberincp(){06145 java.lang.Numberv=var();06146 var(Js.add(v,1));06147 returnthis;06148 }06149 06150 /**
06151 * <p>Returns a copy of the current primitive instance and then decreases the
06152 * current primitive instance by 1, resembling the post-decrement operator in
06153 * JavaScript.</p>
06154 * @return A copy of the undecremented primitive instance.
06155 * @since 1.0
06156 * @javascript A re-compiler is expected to replace the instance invocation of this
06157 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06158 * <pre>p--</pre>
06159 * where <tt>p</tt> is the primitive value of the current primitive instance of the
06160 * invocation of this method.
06161 */06162 publicfinalNumberdecp(){06163 java.lang.Numberv=var();06164 var(Js.sub(v,1));06165 returnthis;06166 }06167 06168 /**
06169 * <p>Adds a numeric operand to the current primitive instance and returns the
06170 * numeric operand, resembling the assignment-with-addition operator in JavaScript.</p>
06171 * <p>If one value is a string, the other is converted to a string, and the two
06172 * strings are then concatenated. Object operands are converted to numbers or strings
06173 * that can be added or concatenated. The conversion is performed by {@link Js#valueOf(Object)}
06174 * method and/or the {@link Js#toString(Object)} method on the object.</p>
06175 * @param value A value or object.
06176 * @return The numeric value of the argument.
06177 * @since 1.0
06178 * @javascript A re-compiler is expected to replace the instance invocation of this
06179 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06180 * <pre>p += value</pre>
06181 * where <tt>p</tt> is the integer value of the current primitive instance of the
06182 * invocation of this method.
06183 */06184 publicfinalNumberaadd(Objectvalue){06185 Objectv=Js.valueOf(value);06186 var(vinstanceofjava.lang.Character?06187 Js.add(var(),(java.lang.Character)v):06188 Js.add(var(),(java.lang.Number)v)06189 );06190 returnthis;06191 }06192 06193 /**
06194 * <p>Subtracts a numeric operand from the current primitive instance and returns the
06195 * numeric operand, resembling the assignment-with-subtraction operator in JavaScript.</p>
06196 * <p>If used with non-numeric values, this operation attempts to convert them to
06197 * numbers.</p>
06198 * @param value A value or object.
06199 * @return The numeric value of the argument.
06200 * @since 1.0
06201 * @javascript A re-compiler is expected to replace the instance invocation of this
06202 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06203 * <pre>p -= value</pre>
06204 * where <tt>p</tt> is the integer value of the current primitive instance of the
06205 * invocation of this method.
06206 */06207 publicfinalNumberasub(Objectvalue){06208 Objectv=Js.valueOf(value);06209 var(vinstanceofjava.lang.Character?06210 Js.sub(var(),(java.lang.Character)v):06211 Js.sub(var(),(java.lang.Number)v)06212 );06213 returnthis;06214 }06215 06216 /**
06217 * <p>Multiplies a numeric operand to the current primitive instance and returns the
06218 * numeric operand, resembling the assignment-with-multiplication operator in JavaScript.</p>
06219 * <p>If used with non-numeric values, this operation attempts to convert them to
06220 * numbers.</p>
06221 * @param value A value or object.
06222 * @return The numeric value of the argument.
06223 * @since 1.0
06224 * @javascript A re-compiler is expected to replace the instance invocation of this
06225 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06226 * <pre>p *= value</pre>
06227 * where <tt>p</tt> is the integer value of the current primitive instance of the
06228 * invocation of this method.
06229 */06230 publicfinalNumberamul(Objectvalue){06231 Objectv=Js.valueOf(value);06232 var(vinstanceofjava.lang.Character?06233 Js.mul(var(),(java.lang.Character)v):06234 Js.mul(var(),(java.lang.Number)v)06235 );06236 returnthis;06237 }06238 06239 /**
06240 * <p>Divides, by a numeric operand, the current primitive instance and returns the
06241 * numeric operand, resembling the assignment-with-division operator in JavaScript.</p>
06242 * <p>Used with non-numeric values, this operation attempts to convert them to
06243 * numbers. If you are used to programming languages that distinguish between integer
06244 * and floating-point numbers, you might expect to get an integer result when you
06245 * divide one integer by another. In JavaScript, however, all numbers are floating-point,
06246 * so all division operations have floating-point results. Division by zero yields positive
06247 * or negative infinity, while <tt>0/0</tt> evaluates to <tt>NaN</tt>.</p>
06248 * @param value A value or object.
06249 * @return The numeric value of the argument.
06250 * @since 1.0
06251 * @javascript A re-compiler is expected to replace the instance invocation of this
06252 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06253 * <pre>p /= value</pre>
06254 * where <tt>p</tt> is the integer value of the current primitive instance of the
06255 * invocation of this method.
06256 */06257 publicfinalNumberadiv(Objectvalue){06258 Objectv=Js.valueOf(value);06259 var(vinstanceofjava.lang.Character?06260 Js.div(var(),(java.lang.Character)v):06261 Js.div(var(),(java.lang.Number)v)06262 );06263 returnthis;06264 }06265 06266 /**
06267 * <p>Modulo operates a numeric operand onto the current primitive instance and
06268 * returns the numeric operand, resembling the assignment-with-modulo operator in
06269 * JavaScript.</p>
06270 * <p>The operation computes the remainder when the current primitive instance is
06271 * divided by the operand a certain number of times. If used with non-numeric values,
06272 * the operation attempts to convert them to numbers. The sign of the result is the
06273 * same as the sign of the current primitive instance.</p>
06274 * <p>This operation is typically used with integer values, it also works for
06275 * floating-point values.</p>
06276 * @param value A value or object.
06277 * @return The numeric value of the argument.
06278 * @since 1.0
06279 * @javascript A re-compiler is expected to replace the instance invocation of this
06280 * method with the equivalent JavaScript expression as re-compiled from the Java expression:
06281 * <pre>p %= value</pre>
06282 * where <tt>p</tt> is the integer value of the current primitive instance of the
06283 * invocation of this method.
06284 */06285 publicfinalNumberamod(Objectvalue){06286 Objectv=Js.valueOf(value);06287 var(vinstanceofjava.lang.Character?06288 Js.mod(var(),(java.lang.Character