0001 
0002 /*
0003  *  Descripter 1.0 - Java Script Engines
0004  *  Copyright (C) 2010-2015  Jianjun Liu (J.J.Liu)
0005  *  
0006  *  This program is free software: you can redistribute it and/or modify
0007  *  it under the terms of the GNU Affero General Public License as published by
0008  *  the Free Software Foundation, either version 3 of the License, or
0009  *  (at your option) any later version.
0010  *  
0011  *  This program is distributed in the hope that it will be useful,
0012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  *  GNU Affero General Public License for more details.
0015  *  
0016  *  You should have received a copy of the GNU Affero General Public License
0017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 package org.descripter.js.api;
0021 
0022 import org.descripter.js.*;
0023 import org.descripter.js.api.core.*;
0024 import org.descripter.js.api.global.*;
0025 
0026 /**
0027  * <p>Facilitates with the core features of a JavaScript engine.</p>
0028  * 
0029  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.descripter.org" target="_blank">http://www.descripter.org</a>
0030  * @since Descripter 1.0
0031  */
0032 public class Core extends Global<Core>
0033 {
0034     /**
0035      * <p>The runtime {@link Key} for the <tt>undefined</tt> identifier or property.</p>
0036      * @since Descripter 1.0
0037      */
0038     public final Key _undefined             = key("undefined");
0039     /**
0040      * <p>The runtime {@link Key} for the <tt>this</tt> identifier or property.</p>
0041      * @since Descripter 1.0
0042      */
0043     public final Key _this                  = key("this");
0044     /**
0045      * <p>The runtime {@link Key} for the <tt>null</tt> identifier or property.</p>
0046      * @since Descripter 1.0
0047      */
0048     public final Key _null                  = key("null");
0049 
0050     /**
0051      * <p>The runtime {@link Key} for the <tt>Array</tt> identifier or property.</p>
0052      * @since Descripter 1.0
0053      */
0054     public final Key _Array                 = key("Array");
0055     /**
0056      * <p>The runtime {@link Key} for the <tt>Boolean</tt> identifier or property.</p>
0057      * @since Descripter 1.0
0058      */
0059     public final Key _Boolean               = key("Boolean");
0060     /**
0061      * <p>The runtime {@link Key} for the <tt>Date</tt> identifier or property.</p>
0062      * @since Descripter 1.0
0063      */
0064     public final Key _Date                  = key("Date");
0065     /**
0066      * <p>The runtime {@link Key} for the <tt>Error</tt> identifier or property.</p>
0067      * @since Descripter 1.0
0068      */
0069     public final Key _Error                 = key("Error");
0070     /**
0071      * <p>The runtime {@link Key} for the <tt>Function</tt> identifier or property.</p>
0072      * @since Descripter 1.0
0073      */
0074     public final Key _Function              = key("Function");
0075     /**
0076      * <p>The runtime {@link Key} for the <tt>Math</tt> identifier or property.</p>
0077      * @since Descripter 1.0
0078      */
0079     public final Key _Math                  = key("Math");
0080     /**
0081      * <p>The runtime {@link Key} for the <tt>Number</tt> identifier or property.</p>
0082      * @since Descripter 1.0
0083      */
0084     public final Key _Number                = key("Number");
0085     /**
0086      * <p>The runtime {@link Key} for the <tt>Object</tt> identifier or property.</p>
0087      * @since Descripter 1.0
0088      */
0089     public final Key _Object                = key("Object");
0090     /**
0091      * <p>The runtime {@link Key} for the <tt>RegExp</tt> identifier or property.</p>
0092      * @since Descripter 1.0
0093      */
0094     public final Key _RegExp                = key("RegExp");
0095     /**
0096      * <p>The runtime {@link Key} for the <tt>String</tt> identifier or property.</p>
0097      * @since Descripter 1.0
0098      */
0099     public final Key _String                = key("String");
0100     /**
0101      * <p>The runtime {@link Key} for the <tt>SyntaxError</tt> identifier or property.</p>
0102      * @since Descripter 1.0
0103      */
0104     public final Key _SyntaxError           = key("SyntaxError");
0105     /**
0106      * <p>The runtime {@link Key} for the <tt>TypeError</tt> identifier or property.</p>
0107      * @since Descripter 1.0
0108      */
0109     public final Key _TypeError             = key("TypeError");
0110     /**
0111      * <p>The runtime {@link Key} for the <tt>URIError</tt> identifier or property.</p>
0112      * @since Descripter 1.0
0113      */
0114     public final Key _URIError              = key("URIError");
0115 
0116     /**
0117      * <p>The runtime {@link Key} for the <tt>apply</tt> identifier or property.</p>
0118      * @since Descripter 1.0
0119      */
0120     public final Key _apply                 = key("apply");
0121     /**
0122      * <p>The runtime {@link Key} for the <tt>arguments</tt> identifier or property.</p>
0123      * @since Descripter 1.0
0124      */
0125     public final Key _arguments             = key("arguments");
0126     /**
0127      * <p>The runtime {@link Key} for the <tt>call</tt> identifier or property.</p>
0128      * @since Descripter 1.0
0129      */
0130     public final Key _call                  = key("call");
0131     /**
0132      * <p>The runtime {@link Key} for the <tt>callee</tt> identifier or property.</p>
0133      * @since Descripter 1.0
0134      */
0135     public final Key _callee                = key("callee");
0136     /**
0137      * <p>The runtime {@link Key} for the <tt>caller</tt> identifier or property.</p>
0138      * @since Descripter 1.0
0139      */
0140     public final Key _caller                = key("caller");
0141     /**
0142      * <p>The runtime {@link Key} for the <tt>constructor</tt> identifier or property.</p>
0143      * @since Descripter 1.0
0144      */
0145     public final Key _constructor           = key("constructor");
0146     /**
0147      * <p>The runtime {@link Key} for the <tt>index</tt> identifier or property.</p>
0148      * @since Descripter 1.0
0149      */
0150     public final Key _index                 = key("index");
0151     /**
0152      * <p>The runtime {@link Key} for the <tt>input</tt> identifier or property.</p>
0153      * @since Descripter 1.0
0154      */
0155     public final Key _input                 = key("input");
0156     /**
0157      * <p>The runtime {@link Key} for the <tt>length</tt> identifier or property.</p>
0158      * @since Descripter 1.0
0159      */
0160     public final Key _length                = key("length");
0161     /**
0162      * <p>The runtime {@link Key} for the <tt>prototype</tt> identifier or property.</p>
0163      * @since Descripter 1.0
0164      */
0165     public final Key _prototype             = key("prototype");
0166 
0167     /**
0168      * <p>The runtime {@link Key} for the <tt>hasOwnProperty</tt> identifier or property.</p>
0169      * @since Descripter 1.0
0170      */
0171     public final Key _hasOwnProperty        = key("hasOwnProperty");
0172     /**
0173      * <p>The runtime {@link Key} for the <tt>isPrototypeOf</tt> identifier or property.</p>
0174      * @since Descripter 1.0
0175      */
0176     public final Key _isPrototypeOf         = key("isPrototypeOf");
0177     /**
0178      * <p>The runtime {@link Key} for the <tt>propertyIsEnumerable</tt> identifier or property.</p>
0179      * @since Descripter 1.0
0180      */
0181     public final Key _propertyIsEnumerable  = key("propertyIsEnumerable");
0182     /**
0183      * <p>The runtime {@link Key} for the <tt>toLocaleString</tt> identifier or property.</p>
0184      * @since Descripter 1.0
0185      */
0186     public final Key _toLocaleString        = key("toLocaleString");
0187     /**
0188      * <p>The runtime {@link Key} for the <tt>toSource</tt> identifier or property.</p>
0189      * @since Descripter 1.0
0190      */
0191     public final Key _toSource              = key("toSource");
0192     /**
0193      * <p>The runtime {@link Key} for the <tt>toString</tt> identifier or property.</p>
0194      * @since Descripter 1.0
0195      */
0196     public final Key _toString              = key("toString");
0197     /**
0198      * <p>The runtime {@link Key} for the <tt>valueOf</tt> identifier or property.</p>
0199      * @since Descripter 1.0
0200      */
0201     public final Key _valueOf               = key("valueOf");
0202 
0203     /**
0204      * <p>The runtime {@link Key} for the <tt>concat</tt> identifier or property.</p>
0205      * @since Descripter 1.0
0206      */
0207     public final Key _concat                = key("concat");
0208     /**
0209      * <p>The runtime {@link Key} for the <tt>join</tt> identifier or property.</p>
0210      * @since Descripter 1.0
0211      */
0212     public final Key _join                  = key("join");
0213     /**
0214      * <p>The runtime {@link Key} for the <tt>pop</tt> identifier or property.</p>
0215      * @since Descripter 1.0
0216      */
0217     public final Key _pop                   = key("pop");
0218     /**
0219      * <p>The runtime {@link Key} for the <tt>push</tt> identifier or property.</p>
0220      * @since Descripter 1.0
0221      */
0222     public final Key _push                  = key("push");
0223     /**
0224      * <p>The runtime {@link Key} for the <tt>reverse</tt> identifier or property.</p>
0225      * @since Descripter 1.0
0226      */
0227     public final Key _reverse               = key("reverse");
0228     /**
0229      * <p>The runtime {@link Key} for the <tt>shift</tt> identifier or property.</p>
0230      * @since Descripter 1.0
0231      */
0232     public final Key _shift                 = key("shift");
0233     /**
0234      * <p>The runtime {@link Key} for the <tt>slice</tt> identifier or property.</p>
0235      * @since Descripter 1.0
0236      */
0237     public final Key _slice                 = key("slice");
0238     /**
0239      * <p>The runtime {@link Key} for the <tt>sort</tt> identifier or property.</p>
0240      * @since Descripter 1.0
0241      */
0242     public final Key _sort                  = key("sort");
0243     /**
0244      * <p>The runtime {@link Key} for the <tt>splice</tt> identifier or property.</p>
0245      * @since Descripter 1.0
0246      */
0247     public final Key _splice                = key("splice");
0248     /**
0249      * <p>The runtime {@link Key} for the <tt>unshift</tt> identifier or property.</p>
0250      * @since Descripter 1.0
0251      */
0252     public final Key _unshift               = key("unshift");
0253 
0254     /**
0255      * <p>The runtime {@link Key} for the <tt>getDate</tt> identifier or property.</p>
0256      * @since Descripter 1.0
0257      */
0258     public final Key _getDate               = key("getDate");
0259     /**
0260      * <p>The runtime {@link Key} for the <tt>getUTCDate</tt> identifier or property.</p>
0261      * @since Descripter 1.0
0262      */
0263     public final Key _getUTCDate            = key("getUTCDate");
0264     /**
0265      * <p>The runtime {@link Key} for the <tt>getDay</tt> identifier or property.</p>
0266      * @since Descripter 1.0
0267      */
0268     public final Key _getDay                = key("getDay");
0269     /**
0270      * <p>The runtime {@link Key} for the <tt>getUTCDay</tt> identifier or property.</p>
0271      * @since Descripter 1.0
0272      */
0273     public final Key _getUTCDay             = key("getUTCDay");
0274     /**
0275      * <p>The runtime {@link Key} for the <tt>getFullYear</tt> identifier or property.</p>
0276      * @since Descripter 1.0
0277      */
0278     public final Key _getFullYear           = key("getFullYear");
0279     /**
0280      * <p>The runtime {@link Key} for the <tt>getUTCFullYear</tt> identifier or property.</p>
0281      * @since Descripter 1.0
0282      */
0283     public final Key _getUTCFullYear        = key("getUTCFullYear");
0284     /**
0285      * <p>The runtime {@link Key} for the <tt>getHours</tt> identifier or property.</p>
0286      * @since Descripter 1.0
0287      */
0288     public final Key _getHours              = key("getHours");
0289     /**
0290      * <p>The runtime {@link Key} for the <tt>getUTCHours</tt> identifier or property.</p>
0291      * @since Descripter 1.0
0292      */
0293     public final Key _getUTCHours           = key("getUTCHours");
0294     /**
0295      * <p>The runtime {@link Key} for the <tt>getMilliseconds</tt> identifier or property.</p>
0296      * @since Descripter 1.0
0297      */
0298     public final Key _getMilliseconds       = key("getMilliseconds");
0299     /**
0300      * <p>The runtime {@link Key} for the <tt>getUTCMilliseconds</tt> identifier or property.</p>
0301      * @since Descripter 1.0
0302      */
0303     public final Key _getUTCMilliseconds    = key("getUTCMilliseconds");
0304     /**
0305      * <p>The runtime {@link Key} for the <tt>getMinutes</tt> identifier or property.</p>
0306      * @since Descripter 1.0
0307      */
0308     public final Key _getMinutes            = key("getMinutes");
0309     /**
0310      * <p>The runtime {@link Key} for the <tt>getUTCMinutes</tt> identifier or property.</p>
0311      * @since Descripter 1.0
0312      */
0313     public final Key _getUTCMinutes         = key("getUTCMinutes");
0314     /**
0315      * <p>The runtime {@link Key} for the <tt>getMonth</tt> identifier or property.</p>
0316      * @since Descripter 1.0
0317      */
0318     public final Key _getMonth              = key("getMonth");
0319     /**
0320      * <p>The runtime {@link Key} for the <tt>getUTCMonth</tt> identifier or property.</p>
0321      * @since Descripter 1.0
0322      */
0323     public final Key _getUTCMonth           = key("getUTCMonth");
0324     /**
0325      * <p>The runtime {@link Key} for the <tt>getSeconds</tt> identifier or property.</p>
0326      * @since Descripter 1.0
0327      */
0328     public final Key _getSeconds            = key("getSeconds");
0329     /**
0330      * <p>The runtime {@link Key} for the <tt>getUTCSeconds</tt> identifier or property.</p>
0331      * @since Descripter 1.0
0332      */
0333     public final Key _getUTCSeconds         = key("getUTCSeconds");
0334     /**
0335      * <p>The runtime {@link Key} for the <tt>getTime</tt> identifier or property.</p>
0336      * @since Descripter 1.0
0337      */
0338     public final Key _getTime               = key("getTime");
0339     /**
0340      * <p>The runtime {@link Key} for the <tt>getTimezoneOffset</tt> identifier or property.</p>
0341      * @since Descripter 1.0
0342      */
0343     public final Key _getTimezoneOffset     = key("getTimezoneOffset");
0344     /**
0345      * <p>The runtime {@link Key} for the <tt>getYear</tt> identifier or property.</p>
0346      * @since Descripter 1.0
0347      */
0348     public final Key _getYear               = key("getYear");
0349     /**
0350      * <p>The runtime {@link Key} for the <tt>setDate</tt> identifier or property.</p>
0351      * @since Descripter 1.0
0352      */
0353     public final Key _setDate               = key("setDate");
0354     /**
0355      * <p>The runtime {@link Key} for the <tt>setUTCDate</tt> identifier or property.</p>
0356      * @since Descripter 1.0
0357      */
0358     public final Key _setUTCDate            = key("setUTCDate");
0359     /**
0360      * <p>The runtime {@link Key} for the <tt>setFullYear</tt> identifier or property.</p>
0361      * @since Descripter 1.0
0362      */
0363     public final Key _setFullYear           = key("setFullYear");
0364     /**
0365      * <p>The runtime {@link Key} for the <tt>setUTCFullYear</tt> identifier or property.</p>
0366      * @since Descripter 1.0
0367      */
0368     public final Key _setUTCFullYear        = key("setUTCFullYear");
0369     /**
0370      * <p>The runtime {@link Key} for the <tt>setHours</tt> identifier or property.</p>
0371      * @since Descripter 1.0
0372      */
0373     public final Key _setHours              = key("setHours");
0374     /**
0375      * <p>The runtime {@link Key} for the <tt>setUTCHours</tt> identifier or property.</p>
0376      * @since Descripter 1.0
0377      */
0378     public final Key _setUTCHours           = key("setUTCHours");
0379     /**
0380      * <p>The runtime {@link Key} for the <tt>setMilliseconds</tt> identifier or property.</p>
0381      * @since Descripter 1.0
0382      */
0383     public final Key _setMilliseconds       = key("setMilliseconds");
0384     /**
0385      * <p>The runtime {@link Key} for the <tt>setUTCMilliseconds</tt> identifier or property.</p>
0386      * @since Descripter 1.0
0387      */
0388     public final Key _setUTCMilliseconds    = key("setUTCMilliseconds");
0389     /**
0390      * <p>The runtime {@link Key} for the <tt>setMinutes</tt> identifier or property.</p>
0391      * @since Descripter 1.0
0392      */
0393     public final Key _setMinutes            = key("setMinutes");
0394     /**
0395      * <p>The runtime {@link Key} for the <tt>setUTCMinutes</tt> identifier or property.</p>
0396      * @since Descripter 1.0
0397      */
0398     public final Key _setUTCMinutes         = key("setUTCMinutes");
0399     /**
0400      * <p>The runtime {@link Key} for the <tt>setMonth</tt> identifier or property.</p>
0401      * @since Descripter 1.0
0402      */
0403     public final Key _setMonth              = key("setMonth");
0404     /**
0405      * <p>The runtime {@link Key} for the <tt>setUTCMonth</tt> identifier or property.</p>
0406      * @since Descripter 1.0
0407      */
0408     public final Key _setUTCMonth           = key("setUTCMonth");
0409     /**
0410      * <p>The runtime {@link Key} for the <tt>setSeconds</tt> identifier or property.</p>
0411      * @since Descripter 1.0
0412      */
0413     public final Key _setSeconds            = key("setSeconds");
0414     /**
0415      * <p>The runtime {@link Key} for the <tt>setUTCSeconds</tt> identifier or property.</p>
0416      * @since Descripter 1.0
0417      */
0418     public final Key _setUTCSeconds         = key("setUTCSeconds");
0419     /**
0420      * <p>The runtime {@link Key} for the <tt>setTime</tt> identifier or property.</p>
0421      * @since Descripter 1.0
0422      */
0423     public final Key _setTime               = key("setTime");
0424     /**
0425      * <p>The runtime {@link Key} for the <tt>setYear</tt> identifier or property.</p>
0426      * @since Descripter 1.0
0427      */
0428     public final Key _setYear               = key("setYear");
0429     /**
0430      * <p>The runtime {@link Key} for the <tt>toDateString</tt> identifier or property.</p>
0431      * @since Descripter 1.0
0432      */
0433     public final Key _toDateString          = key("toDateString");
0434     /**
0435      * <p>The runtime {@link Key} for the <tt>toGMTString</tt> identifier or property.</p>
0436      * @since Descripter 1.0
0437      */
0438     public final Key _toGMTString           = key("toGMTString");
0439     /**
0440      * <p>The runtime {@link Key} for the <tt>toLocaleDateString</tt> identifier or property.</p>
0441      * @since Descripter 1.0
0442      */
0443     public final Key _toLocaleDateString    = key("toLocaleDateString");
0444     /**
0445      * <p>The runtime {@link Key} for the <tt>toLocaleTimeString</tt> identifier or property.</p>
0446      * @since Descripter 1.0
0447      */
0448     public final Key _toLocaleTimeString    = key("toLocaleTimeString");
0449     /**
0450      * <p>The runtime {@link Key} for the <tt>toTimeString</tt> identifier or property.</p>
0451      * @since Descripter 1.0
0452      */
0453     public final Key _toTimeString          = key("toTimeString");
0454     /**
0455      * <p>The runtime {@link Key} for the <tt>toUTCString</tt> identifier or property.</p>
0456      * @since Descripter 1.0
0457      */
0458     public final Key _toUTCString           = key("toUTCString");
0459 
0460     /**
0461      * <p>The runtime {@link Key} for the <tt>message</tt> identifier or property.</p>
0462      * @since Descripter 1.0
0463      */
0464     public final Key _message               = key("message");
0465     /**
0466      * <p>The runtime {@link Key} for the <tt>name</tt> identifier or property.</p>
0467      * @since Descripter 1.0
0468      */
0469     public final Key _name                  = key("name");
0470 
0471     /**
0472      * <p>The runtime {@link Key} for the <tt>E</tt> identifier or property.</p>
0473      * @since Descripter 1.0
0474      */
0475     public final Key _E                     = key("E");
0476     /**
0477      * <p>The runtime {@link Key} for the <tt>LN10</tt> identifier or property.</p>
0478      * @since Descripter 1.0
0479      */
0480     public final Key _LN10                  = key("LN10");
0481     /**
0482      * <p>The runtime {@link Key} for the <tt>LN2</tt> identifier or property.</p>
0483      * @since Descripter 1.0
0484      */
0485     public final Key _LN2                   = key("LN2");
0486     /**
0487      * <p>The runtime {@link Key} for the <tt>LOG10E</tt> identifier or property.</p>
0488      * @since Descripter 1.0
0489      */
0490     public final Key _LOG10E                = key("LOG10E");
0491     /**
0492      * <p>The runtime {@link Key} for the <tt>LOG2E</tt> identifier or property.</p>
0493      * @since Descripter 1.0
0494      */
0495     public final Key _LOG2E                 = key("LOG2E");
0496     /**
0497      * <p>The runtime {@link Key} for the <tt>PI</tt> identifier or property.</p>
0498      * @since Descripter 1.0
0499      */
0500     public final Key _PI                    = key("PI");
0501     /**
0502      * <p>The runtime {@link Key} for the <tt>SQRT1_2</tt> identifier or property.</p>
0503      * @since Descripter 1.0
0504      */
0505     public final Key _SQRT1_2               = key("SQRT1_2");
0506     /**
0507      * <p>The runtime {@link Key} for the <tt>SQRT2</tt> identifier or property.</p>
0508      * @since Descripter 1.0
0509      */
0510     public final Key _SQRT2                 = key("SQRT2");
0511     /**
0512      * <p>The runtime {@link Key} for the <tt>abs</tt> identifier or property.</p>
0513      * @since Descripter 1.0
0514      */
0515     public final Key _abs                   = key("abs");
0516     /**
0517      * <p>The runtime {@link Key} for the <tt>acos</tt> identifier or property.</p>
0518      * @since Descripter 1.0
0519      */
0520     public final Key _acos                  = key("acos");
0521     /**
0522      * <p>The runtime {@link Key} for the <tt>asin</tt> identifier or property.</p>
0523      * @since Descripter 1.0
0524      */
0525     public final Key _asin                  = key("asin");
0526     /**
0527      * <p>The runtime {@link Key} for the <tt>atan</tt> identifier or property.</p>
0528      * @since Descripter 1.0
0529      */
0530     public final Key _atan                  = key("atan");
0531     /**
0532      * <p>The runtime {@link Key} for the <tt>atan2</tt> identifier or property.</p>
0533      * @since Descripter 1.0
0534      */
0535     public final Key _atan2                 = key("atan2");
0536     /**
0537      * <p>The runtime {@link Key} for the <tt>ceil</tt> identifier or property.</p>
0538      * @since Descripter 1.0
0539      */
0540     public final Key _ceil                  = key("ceil");
0541     /**
0542      * <p>The runtime {@link Key} for the <tt>cos</tt> identifier or property.</p>
0543      * @since Descripter 1.0
0544      */
0545     public final Key _cos                   = key("cos");
0546     /**
0547      * <p>The runtime {@link Key} for the <tt>exp</tt> identifier or property.</p>
0548      * @since Descripter 1.0
0549      */
0550     public final Key _exp                   = key("exp");
0551     /**
0552      * <p>The runtime {@link Key} for the <tt>floor</tt> identifier or property.</p>
0553      * @since Descripter 1.0
0554      */
0555     public final Key _floor                 = key("floor");
0556     /**
0557      * <p>The runtime {@link Key} for the <tt>log</tt> identifier or property.</p>
0558      * @since Descripter 1.0
0559      */
0560     public final Key _log                   = key("log");
0561     /**
0562      * <p>The runtime {@link Key} for the <tt>max</tt> identifier or property.</p>
0563      * @since Descripter 1.0
0564      */
0565     public final Key _max                   = key("max");
0566     /**
0567      * <p>The runtime {@link Key} for the <tt>min</tt> identifier or property.</p>
0568      * @since Descripter 1.0
0569      */
0570     public final Key _min                   = key("min");
0571     /**
0572      * <p>The runtime {@link Key} for the <tt>pow</tt> identifier or property.</p>
0573      * @since Descripter 1.0
0574      */
0575     public final Key _pow                   = key("pow");
0576     /**
0577      * <p>The runtime {@link Key} for the <tt>random</tt> identifier or property.</p>
0578      * @since Descripter 1.0
0579      */
0580     public final Key _random                = key("random");
0581     /**
0582      * <p>The runtime {@link Key} for the <tt>round</tt> identifier or property.</p>
0583      * @since Descripter 1.0
0584      */
0585     public final Key _round                 = key("round");
0586     /**
0587      * <p>The runtime {@link Key} for the <tt>sin</tt> identifier or property.</p>
0588      * @since Descripter 1.0
0589      */
0590     public final Key _sin                   = key("sin");
0591     /**
0592      * <p>The runtime {@link Key} for the <tt>sinh</tt> identifier or property.</p>
0593      * @since Descripter 1.0
0594      */
0595     public final Key _sinh                  = key("sinh");  /**
0596      * <p>The runtime {@link Key} for the <tt>sqrt</tt> identifier or property.</p>
0597      * @since Descripter 1.0
0598      */
0599     public final Key _sqrt                  = key("sqrt");
0600     /**
0601      * <p>The runtime {@link Key} for the <tt>tan</tt> identifier or property.</p>
0602      * @since Descripter 1.0
0603      */
0604     public final Key _tan                   = key("tan");
0605     /**
0606      * <p>The runtime {@link Key} for the <tt>tanh</tt> identifier or property.</p>
0607      * @since Descripter 1.0
0608      */
0609     public final Key _tanh                  = key("tanh");
0610 
0611     /**
0612      * <p>The runtime {@link Key} for the <tt>MAX_VALUE</tt> identifier or property.</p>
0613      * @since Descripter 1.0
0614      */
0615     public final Key _MAX_VALUE             = key("MAX_VALUE");
0616     /**
0617      * <p>The runtime {@link Key} for the <tt>MIN_VALUE</tt> identifier or property.</p>
0618      * @since Descripter 1.0
0619      */
0620     public final Key _MIN_VALUE             = key("MIN_VALUE");
0621     /**
0622      * <p>The runtime {@link Key} for the <tt>NaN</tt> identifier or property.</p>
0623      * @since Descripter 1.0
0624      */
0625     public final Key _NaN                   = key("NaN");
0626     /**
0627      * <p>The runtime {@link Key} for the <tt>NEGATIVE_INFINITY</tt> identifier or property.</p>
0628      * @since Descripter 1.0
0629      */
0630     public final Key _NEGATIVE_INFINITY     = key("NEGATIVE_INFINITY");
0631     /**
0632      * <p>The runtime {@link Key} for the <tt>POSITIVE_INFINITY</tt> identifier or property.</p>
0633      * @since Descripter 1.0
0634      */
0635     public final Key _POSITIVE_INFINITY     = key("POSITIVE_INFINITY");
0636     /**
0637      * <p>The runtime {@link Key} for the <tt>toExponential</tt> identifier or property.</p>
0638      * @since Descripter 1.0
0639      */
0640     public final Key _toExponential         = key("toExponential");
0641     /**
0642      * <p>The runtime {@link Key} for the <tt>toFixed</tt> identifier or property.</p>
0643      * @since Descripter 1.0
0644      */
0645     public final Key _toFixed               = key("toFixed");
0646     /**
0647      * <p>The runtime {@link Key} for the <tt>toPrecision</tt> identifier or property.</p>
0648      * @since Descripter 1.0
0649      */
0650     public final Key _toPrecision           = key("toPrecision");
0651 
0652     /**
0653      * <p>The runtime {@link Key} for the <tt>index</tt> identifier or property.</p>
0654      * @since Descripter 1.0
0655      */
0656     public final Key _global                = key("index");
0657     /**
0658      * <p>The runtime {@link Key} for the <tt>ignoreCase</tt> identifier or property.</p>
0659      * @since Descripter 1.0
0660      */
0661     public final Key _ignoreCase            = key("ignoreCase");
0662     /**
0663      * <p>The runtime {@link Key} for the <tt>lastIndex</tt> identifier or property.</p>
0664      * @since Descripter 1.0
0665      */
0666     public final Key _lastIndex             = key("lastIndex");
0667     /**
0668      * <p>The runtime {@link Key} for the <tt>multiline</tt> identifier or property.</p>
0669      * @since Descripter 1.0
0670      */
0671     public final Key _multiline             = key("multiline");
0672     /**
0673      * <p>The runtime {@link Key} for the <tt>source</tt> identifier or property.</p>
0674      * @since Descripter 1.0
0675      */
0676     public final Key _source                = key("source");
0677     /**
0678      * <p>The runtime {@link Key} for the <tt>exec</tt> identifier or property.</p>
0679      * @since Descripter 1.0
0680      */
0681     public final Key _exec                  = key("exec");
0682     /**
0683      * <p>The runtime {@link Key} for the <tt>test</tt> identifier or property.</p>
0684      * @since Descripter 1.0
0685      */
0686     public final Key _test                  = key("test");
0687 
0688     /**
0689      * <p>The runtime {@link Key} for the <tt>charAt</tt> identifier or property.</p>
0690      * @since Descripter 1.0
0691      */
0692     public final Key _charAt                = key("charAt");
0693     /**
0694      * <p>The runtime {@link Key} for the <tt>charCodeAt</tt> identifier or property.</p>
0695      * @since Descripter 1.0
0696      */
0697     public final Key _charCodeAt            = key("charCodeAt");
0698     /**
0699      * <p>The runtime {@link Key} for the <tt>indexOf</tt> identifier or property.</p>
0700      * @since Descripter 1.0
0701      */
0702     public final Key _indexOf               = key("indexOf");
0703     /**
0704      * <p>The runtime {@link Key} for the <tt>lastIndexOf</tt> identifier or property.</p>
0705      * @since Descripter 1.0
0706      */
0707     public final Key _lastIndexOf           = key("lastIndexOf");
0708     /**
0709      * <p>The runtime {@link Key} for the <tt>localeCompare</tt> identifier or property.</p>
0710      * @since Descripter 1.0
0711      */
0712     public final Key _localeCompare         = key("localeCompare");
0713     /**
0714      * <p>The runtime {@link Key} for the <tt>match</tt> identifier or property.</p>
0715      * @since Descripter 1.0
0716      */
0717     public final Key _match                 = key("match");
0718     /**
0719      * <p>The runtime {@link Key} for the <tt>replace</tt> identifier or property.</p>
0720      * @since Descripter 1.0
0721      */
0722     public final Key _replace               = key("replace");
0723     /**
0724      * <p>The runtime {@link Key} for the <tt>search</tt> identifier or property.</p>
0725      * @since Descripter 1.0
0726      */
0727     public final Key _search                = key("search");
0728     /**
0729      * <p>The runtime {@link Key} for the <tt>split</tt> identifier or property.</p>
0730      * @since Descripter 1.0
0731      */
0732     public final Key _split                 = key("split");
0733     /**
0734      * <p>The runtime {@link Key} for the <tt>substr</tt> identifier or property.</p>
0735      * @since Descripter 1.0
0736      */
0737     public final Key _substr                = key("substr");
0738     /**
0739      * <p>The runtime {@link Key} for the <tt>substring</tt> identifier or property.</p>
0740      * @since Descripter 1.0
0741      */
0742     public final Key _substring             = key("substring");
0743     /**
0744      * <p>The runtime {@link Key} for the <tt>toLocaleLowerCase</tt> identifier or property.</p>
0745      * @since Descripter 1.0
0746      */
0747     public final Key _toLocaleLowerCase     = key("toLocaleLowerCase");
0748     /**
0749      * <p>The runtime {@link Key} for the <tt>toLocaleUpperCase</tt> identifier or property.</p>
0750      * @since Descripter 1.0
0751      */
0752     public final Key _toLocaleUpperCase     = key("toLocaleUpperCase");
0753     /**
0754      * <p>The runtime {@link Key} for the <tt>toLowerCase</tt> identifier or property.</p>
0755      * @since Descripter 1.0
0756      */
0757     public final Key _toLowerCase           = key("toLowerCase");
0758     /**
0759      * <p>The runtime {@link Key} for the <tt>toUpperCase</tt> identifier or property.</p>
0760      * @since Descripter 1.0
0761      */
0762     public final Key _toUpperCase           = key("toUpperCase");
0763 
0764     /**
0765      * <p>The runtime {@link Key} for the global service <tt>escape</tt>.</p>
0766      * @see #escape(Script, Object...)
0767      * @see Global#globalize(String)
0768      * @since Descripter 1.0
0769      */
0770     public final Key _escape   = globalize("escape");
0771     /**
0772      * <p>The runtime {@link Key} for the global service <tt>eval</tt>.</p>
0773      * @see #eval(Script, Object...)
0774      * @see Global#globalize(String)
0775      * @since Descripter 1.0
0776      */
0777     public final Key _eval     = globalize("eval");
0778     /**
0779      * <p>The runtime {@link Key} for the native global service <tt>print</tt>.</p>
0780      * @see #print(Script, Object...)
0781      * @see Global#globalize(String)
0782      * @since Descripter 1.0
0783      */
0784     public final Key _print    = globalize("print");
0785     /**
0786      * <p>The runtime {@link Key} for the global service <tt>unescape</tt>.</p>
0787      * @see #unescape(Script, Object...)
0788      * @see Global#globalize(String)
0789      * @since Descripter 1.0
0790      */
0791     public final Key _unescape = globalize("unescape");
0792     /**
0793      * <p>The runtime {@link Key} for the native global service <tt>compile</tt>.</p>
0794      * @see #compile(Script, Object...)
0795      * @see Global#globalize(String)
0796      * @since Descripter 1.0
0797      */
0798     public final Key _compile  = globalize("compile");
0799     /**
0800      * <p>The runtime {@link Key} for the native global service <tt>descript</tt>.</p>
0801      * @see #descript(Script, Object...)
0802      * @see Global#globalize(String)
0803      * @since Descripter 1.0
0804      */
0805     public final Key _descript = globalize("descript");
0806     /**
0807      * <p>The runtime {@link Key} for the native global service <tt>execute</tt>.</p>
0808      * @see #execute(Script, Object...)
0809      * @see Global#globalize(String)
0810      * @since Descripter 1.0
0811      */
0812     public final Key _execute  = globalize("execute");
0813 
0814     /**
0815      * <p>Constructs a stand-alone script context with core features of a JavaScript engine.</p>
0816      * @see #Core(boolean)
0817      * @since Descripter 1.0
0818      */
0819     public Core() {
0820         this(false);
0821     }
0822 
0823     /**
0824      * <p>Constructs a script context with core features of a JavaScript engine and read-only mode specified.</p>
0825      * @param readOnly <tt>true</tt> for a read-only core context; <tt>false</tt>, otherwise.
0826      * @see #Core()
0827      * @since Descripter 1.0
0828      */
0829     public Core(boolean readOnly) {
0830         super(null);
0831 
0832         System.out.println("Descripter 1.0 Core,  All right reserved.");
0833         System.out.println("Copyright (C) 2010-2012  J.J.Liu<jianjunliu@126.com> www.descripter.org");
0834 
0835         put(_null, CObject._null);
0836 
0837         Function_.create(this);
0838         Object_  .create(this);
0839         Array_   .create(this);
0840         Boolean_ .create(this);
0841         Date_    .create(this);
0842         Error_   .create(this);
0843         CMath    .create(this);
0844         Number_  .create(this);
0845         RegExp_  .create(this);
0846         String_  .create(this);
0847 
0848         readOnly(readOnly);
0849         System.out.println("Descripter 1.0 Core initialized.");
0850     }
0851 
0852     /**
0853      * <p>Gets the engine {@link Core} of this {@link Global} script context.</p>
0854      * <p>This method simply returns <tt>this</tt> object.</p>
0855      * @return The engine {@link Core} of this {@link Global} script context
0856      * @since Descripter 1.0
0857      */
0858     @Override
0859     public Core core() {
0860         return this;
0861     }
0862 
0863     /**
0864      * <p>Gets the global <tt>Array</tt> function.</p>
0865      * @return The global <tt>Array</tt> function
0866      * @see #_Array
0867      * @since Descripter 1.0
0868      */
0869     public final Array_ _Array() {
0870         return (Array_)get(_Array);
0871     }
0872 
0873     /**
0874      * <p>Gets the global <tt>Boolean</tt> function.</p>
0875      * @return The global <tt>Boolean</tt> function
0876      * @see #_Boolean
0877      * @since Descripter 1.0
0878      */
0879     public final Boolean_ _Boolean() {
0880         return (Boolean_)get(_Boolean);
0881     }
0882 
0883     /**
0884      * <p>Gets the global <tt>Function</tt> function.</p>
0885      * @return The global <tt>Function</tt> function
0886      * @see #_Function
0887      * @since Descripter 1.0
0888      */
0889     public final Function_ _Function() {
0890         return (Function_)get(_Function);
0891     }
0892 
0893     /**
0894      * <p>Gets the global <tt>Number</tt> function.</p>
0895      * @return The global <tt>Number</tt> function
0896      * @see #_Number
0897      * @since Descripter 1.0
0898      */
0899     public final Number_ _Number() {
0900         return (Number_)get(_Number);
0901     }
0902 
0903     /**
0904      * <p>Gets the global <tt>Object</tt> function.</p>
0905      * @return The global <tt>Object</tt> function
0906      * @see #_Object
0907      * @since Descripter 1.0
0908      */
0909     public final Object_ _Object() {
0910         return (Object_)get(_Object);
0911     }
0912 
0913     /**
0914      * <p>Gets the global <tt>RegExp</tt> function.</p>
0915      * @return The global <tt>RegExp</tt> function
0916      * @see #_RegExp
0917      * @since Descripter 1.0
0918      */
0919     public final RegExp_ _RegExp() {
0920         return (RegExp_)get(_RegExp);
0921     }
0922 
0923     /**
0924      * <p>Gets the global <tt>String</tt> function.</p>
0925      * @return The global <tt>String</tt> function
0926      * @see #_String
0927      * @since Descripter 1.0
0928      */
0929     public final String_ _String() {
0930         return (String_)get(_String);
0931     }
0932 
0933     /**
0934      * <p>Returns a string representation of the current object.</p>
0935      * @return The string representation of the current object
0936      * @since Descripter 1.0
0937      */
0938     @Override
0939     public String toString() {
0940         return "[Core object]";
0941     }
0942 
0943     /**
0944      * <p>Executes the script context of this type.</p>
0945      * @since Descripter 1.0
0946      */
0947     @Override
0948     public void run() {
0949     }
0950 
0951     /**
0952      * <p>Tests whether a value is the not-a-number value, simulating the JavaScript global function of 
0953      * the same name.</p>
0954      * <p>In JavaScript, This function tests its argument to determine whether it is the 
0955      * value <tt>NaN</tt>, which represents an illegal number (such as the result of 
0956      * division by zero). This function is required because comparing a <tt>NaN</tt> 
0957      * with any value, including itself, always returns <tt>false</tt>, so it is not 
0958      * possible to test for <tt>NaN</tt> with the == or === operators.</p>
0959      * <p>A common use in JavaScript of this function is to test the results of {@link #parseFloat(Script, Object[])} 
0960      * and {@link #parseInt(Script, Object[])} to determine if they represent legal numbers. You can 
0961      * also use {@link #isNaN(Script, Object[])} to check for arithmetic errors, such as division by 
0962      * zero</p>
0963      * @param script The script context that invoked this service
0964      * @param args An array of the arguments passed by the invocation
0965      * @return <tt>true</tt> if <tt>v</tt> is (or can be converted to) the special 
0966      * not-a-number value; <tt>false</tt> if <tt>v</tt> is any other value.
0967      * @since Descripter 1.0
0968      */
0969     public boolean isNaN(Script<?> script, Object ...args) {
0970         return false;
0971     }
0972 
0973     /**
0974      * <p>Parses an integer from a string, 
0975      * simulating the JavaScript global function of the same name.</p>
0976      * <p>In JavaScript, this function parses and returns the first number (with an 
0977      * optional leading minus sign) that occurs in <tt>value</tt>. Parsing stops, and 
0978      * the value is returned, when it encounters a character in <tt>value</tt> that is 
0979      * not a valid digit for the specified radix. If <tt>value</tt> does not begin with 
0980      * a number that it can parse, the function returns the not-a-number value <tt>NaN</tt>. 
0981      * Use the {@link #isNaN(Script, Object[])} function to test for this return value.</p>
0982      * @param script The script context that invoked this service
0983      * @param args An array of the arguments passed by the invocation
0984      * @return The parsed number, or <tt>NaN</tt> if <tt>value</tt> does not begin with 
0985      * a valid integer. In JavaScript 1.0, this function returns 0 instead of <tt>NaN</tt> 
0986      * when it cannot parse <tt>value</tt>.
0987      * @since Descripter 1.0
0988      */
0989     public int parseInt(Script<?> script, Object ...args) {
0990         return 0;
0991     }
0992 
0993     /**
0994      * <p>Parses a number from a string, 
0995      * simulating the JavaScript global function of the same name.</p>
0996      * <p>In JavaScript, this function parses and returns the first number that occurs in 
0997      * <tt>value</tt>. Parsing stops, and the value is returned, when it encounters a 
0998      * character in <tt>value</tt> that is not a valid part of the number. If <tt>value</tt> 
0999      * does not begin with a number that it can parse, the function returns the not-a-number 
1000      * value <tt>NaN</tt>. Test for this return value with the {@link #isNaN(Script, Object[])} 
1001      * function. If you want to parse only the integer portion of a number, use 
1002      * {@link #parseInt(Script, Object[])} instead of this one.</p>
1003      * @param script The script context that invoked this service
1004      * @param args An array of the arguments passed by the invocation
1005      * @return The parsed number, or <tt>NaN</tt> if <tt>value</tt> does not begin 
1006      * with a valid number. In JavaScript 1.0, this function returns 0 instead of <tt>NaN</tt> 
1007      * when <tt>value</tt> cannot be parsed as a number.
1008      * @since Descripter 1.0
1009      */
1010     public double parseFloat(Script<?> script, Object ...args) {
1011         return 0;
1012     }
1013 
1014     /**
1015      * <p>A native global service to emulate the JavaScript global function with the same name.</p>
1016      * <p>This method only evaluates the string representation of the first element of <tt>args</tt>.</p>
1017      * @param script The script context that invoked this service
1018      * @param args An array of the arguments passed by the invocation
1019      * @return The result of evaluation
1020      * @see #_eval
1021      * @see Global#globalize(String)
1022      * @since Descripter 1.0
1023      */
1024     public Object eval(Script<?> script, Object ...args) {
1025         return new Interpreter(script).eval(toString(args[0]));
1026     }
1027 
1028     /**
1029      * <p>A global service to emulate the JavaScript global function with the same name.</p>
1030      * <p>This method only escapes the string representation of the first element of <tt>args</tt>.</p>
1031      * @param script The script context that invoked this service
1032      * @param args An array of the arguments passed by the invocation
1033      * @return The escaped string
1034      * @see #_escape
1035      * @see Global#globalize(String)
1036      * @since Descripter 1.0
1037      */
1038     public String escape(Script<?> script, Object ...args) {
1039         return null;
1040     }
1041 
1042     /**
1043      * <p>A global service to emulate the JavaScript global function with the same name.</p>
1044      * <p>This method only unescapes the string representation of the first element of <tt>args</tt>.</p>
1045      * @param script The script context that invoked this service
1046      * @param args An array of the arguments passed by the invocation
1047      * @return The unescaped string
1048      * @see #_unescape
1049      * @see Global#globalize(String)
1050      * @since Descripter 1.0
1051      */
1052     public String unescape(Script<?> script, Object ...args) {
1053         return null;
1054     }
1055 
1056     /**
1057      * <p>A native global service for standard output.</p>
1058      * <p>This method prints the elements of <tt>args</tt> to <tt>stdio</tt> in lines.</p>
1059      * @param script The script context that invoked this service
1060      * @param args An array of the arguments passed by the invocation
1061      * @see #_print
1062      * @see Global#globalize(String)
1063      * @since Descripter 1.0
1064      */
1065     public void print(Script<?> script, Object ...args) {
1066         for (Object o : args) {
1067             System.out.print(toString(o));
1068         }
1069         System.out.println();
1070     }
1071 
1072     /**
1073      * <p>A native global service for descripting and compiling JavaScript code.</p>
1074      * <p>This method descripts and compiles the string of JavaScript source specified by the second element 
1075      * of <tt>args</tt> into a Java class with the name specified by the first element of <tt>args</tt>.</p>
1076      * @param script The script context that invoked this service
1077      * @param args An array of the arguments passed by the invocation
1078      * @return A {@link Runnable} {@link Class}
1079      * @see #_compile
1080      * @see Global#globalize(String)
1081      * @since Descripter 1.0
1082      */
1083     public Class<?> compile(Script<?> script, Object ...args) {
1084         String name = toString(args[0]);
1085         Memory memo = new Memory();
1086         if (memo.compile(name, descript(script, name, toString(args[1])))) {
1087             try {
1088                 return memo.loadClass(name);
1089             } catch (ClassNotFoundException e) {
1090                 throw new RuntimeException(e);
1091             }
1092         }
1093         return null;
1094     }
1095 
1096     /**
1097      * <p>A native global service for descripting JavaScript code.</p>
1098      * <p>This method descripts the string of JavaScript source specified by the second element of 
1099      * <tt>args</tt> into Java source with the class name specified by the first element of <tt>args</tt>.</p>
1100      * @param script The script context that invoked this service
1101      * @param args An array of the arguments passed by the invocation
1102      * @return A string of descripted Java source
1103      * @see #_descript
1104      * @see Global#globalize(String)
1105      * @since Descripter 1.0
1106      */
1107     public String descript(Script<?> script, Object ...args) {
1108         return new Descripter(script).descript(toString(args[0]), toString(args[1]));
1109     }
1110 
1111     /**
1112      * <p>A native global service for executing a {@link Runnable} {@link Class}.</p>
1113      * <p>This method only executes the {@link Runnable} {@link Class} specified by the first element of 
1114      * <tt>args</tt>.</p>
1115      * @param script The script context that invoked this service
1116      * @param args An array of the arguments passed by the invocation
1117      * @see #_execute
1118      * @see Global#globalize(String)
1119      * @since Descripter 1.0
1120      */
1121     public void execute(Script<?> script, Object ...args) {
1122         try {
1123             ((Runnable)((Class<?>)args[0]).getConstructors()[0].newInstance(
1124                     script
1125             )).run();
1126         } catch (Exception e) {
1127             throw new RuntimeException(e);
1128         }
1129     }
1130 }