Source Code Cross Referenced for ScriptObject.java in  » Scripting » oscript-2.10.4 » oscript » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » oscript 2.10.4 » oscript.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*=============================================================================
0002:         *     Copyright Texas Instruments 2000-2004.  All Rights Reserved.
0003:         *   
0004:         * This program is free software; you can redistribute it and/or
0005:         * modify it under the terms of the GNU Lesser General Public
0006:         * License as published by the Free Software Foundation; either
0007:         * version 2 of the License, or (at your option) any later version.
0008:         * 
0009:         * This program is distributed in the hope that it will be useful,
0010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012:         * Lesser General Public License for more details.
0013:         * 
0014:         * You should have received a copy of the GNU Lesser General Public
0015:         * License along with this library; if not, write to the Free Software
0016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0017:         * 
0018:         * $ProjectHeader: OSCRIPT 0.155 Fri, 20 Dec 2002 18:34:22 -0800 rclark $
0019:         */
0020:
0021:        package oscript.data;
0022:
0023:        import oscript.exceptions.*;
0024:        import oscript.util.StackFrame;
0025:        import oscript.util.MemberTable;
0026:
0027:        /**
0028:         * A script-object is basically just a scope, but also provides java
0029:         * wrappers for all the methods defined in <code>Value</code>, which allows
0030:         * a lot of flexibility for script objects to extend built-in types, or
0031:         * implement built-in operators (methods), such as +, -, *, /, etc., etc.
0032:         * 
0033:         * @author Rob Clark (rob@ti.com)
0034:         */
0035:        public class ScriptObject extends BasicScope {
0036:            /**
0037:             * If this object is of a type that extends a java class, the superFxn
0038:             * must attach a java-object to this object.  The object is an instance
0039:             * of the java class wrapped by the superFxn.
0040:             */
0041:            private Object javaObject = null;
0042:
0043:            /**
0044:             * The type of the script object.
0045:             */
0046:            private Value type;
0047:
0048:            private static final Value[] EMPTY_ARRAY = new Value[] {};
0049:
0050:            /**
0051:             * The type object for an instance of ScriptObject... which can't really be
0052:             * instantiated, but this is needed internally.
0053:             */
0054:            public final static BuiltinType TYPE = BuiltinType
0055:                    .makeBuiltinType("oscript.data.ScriptObject");
0056:            public final static String PARENT_TYPE_NAME = null;
0057:            public final static String TYPE_NAME = "ScriptObject";
0058:            public final static String[] MEMBER_NAMES = new String[] {
0059:            //                        "_unhand",
0060:            //                        "_getType",
0061:            //                        "_castToJavaObject",
0062:            //                        "_castToString",
0063:            //                        "_bopInstanceOf",
0064:            //                        "_bopInstanceOfR",
0065:            //                        "_bopEquals",
0066:            //                        "_bopNotEquals",
0067:            };
0068:
0069:            /* What about members like "getType"?  Right now, we don't overload
0070:             * so it would be weird if script type overloaded that member.  We
0071:             * can't do it with the getMember("getType").callAsFunction(...)
0072:             * approach, because the getType method of OObject is not what we
0073:             * want...
0074:             * 
0075:             * For pretty much everything, if we catch an exception we call
0076:             * super.whateverMethod(with,args)... this is sorta like multiple
0077:             * inheritance for objects that subclass java types, but is needed
0078:             * to ensure that all objects in the system have the methods that
0079:             * are implemented in Value... the counterpart to this for objects
0080:             * that are instances of java types is in JavaClassWrapper, where
0081:             * it calls Value.TYPE.getTypeMemberImpl()...
0082:             * 
0083:             * what we should really do is make the getMember() call not throw
0084:             * an exception, but use the method from Value... hmmm... but when
0085:             * I was doing that I was getting an "object not instance of
0086:             * delaring class" type error from JavaMethodWrapper...
0087:             */
0088:
0089:            /*=======================================================================*/
0090:            /**
0091:             * Class Constructor.  Construct a element in the scope chain.  This
0092:             * constructs a "function" element in the scope chain.  This is
0093:             * called from the <code>Function</code> class when a function is 
0094:             * evaluated.
0095:             * 
0096:             * @param type         the type of the object
0097:             * @param previous     previous in environment scope chain
0098:             * @param smit         shared member idx table
0099:             */
0100:            ScriptObject(Value type, Scope previous,
0101:                    oscript.util.SymbolTable smit) {
0102:                super (previous, smit, new OArray(smit.size()));
0103:                this .type = type;
0104:            }
0105:
0106:            /* Needed to make JavaClassWrapper happy...
0107:             */
0108:            public Value _getType() {
0109:                return super .getType();
0110:            }
0111:
0112:            /*=======================================================================*/
0113:            /**
0114:             * Get the type of this object.  The returned type doesn't have to take
0115:             * into account the possibility of a script type extending a built-in
0116:             * type, since that is handled by {@link #getType}.
0117:             * 
0118:             * @return the object's type
0119:             */
0120:            protected Value getTypeImpl() {
0121:                return type;
0122:            }
0123:
0124:            /*=======================================================================*/
0125:            /**
0126:             * Return the object used for implementing <i>synchronized</i>.  For a
0127:             * normal script object, the object is it's own monitor.  For a java
0128:             * object, it is the java object rather than the {@link JavaObjectWrapper}.
0129:             * 
0130:             * @return the object to synchronize on
0131:             */
0132:            public Object getMonitor() {
0133:                return (javaObject != null) ? javaObject : super .getMonitor();
0134:            }
0135:
0136:            private static final int CASTTOBOOLEAN = Symbol.getSymbol(
0137:                    "castToBoolean").getId();
0138:
0139:            /*=======================================================================*/
0140:            /**
0141:             * Convert this object to a native java <code>boolean</code> value.
0142:             * 
0143:             * @return a boolean value
0144:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0145:             */
0146:            public boolean castToBoolean() throws PackagedScriptObjectException {
0147:                return getMember(CASTTOBOOLEAN).callAsFunction(EMPTY_ARRAY)
0148:                        .castToBoolean();
0149:            }
0150:
0151:            public boolean _castToBoolean()
0152:                    throws PackagedScriptObjectException {
0153:                return super .castToBoolean();
0154:            }
0155:
0156:            private static final int CASTTOSTRING = Symbol.getSymbol(
0157:                    "castToString").getId();
0158:            private static final int TOSTRING = Symbol.getSymbol("toString")
0159:                    .getId();
0160:
0161:            /*=======================================================================*/
0162:            /**
0163:             * Convert this object to a native java <code>String</code> value.
0164:             * 
0165:             * @return a String value
0166:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0167:             */
0168:            public String castToString() throws PackagedScriptObjectException {
0169:                return getMember(CASTTOSTRING).callAsFunction(EMPTY_ARRAY)
0170:                        .castToString();
0171:                // handled specially for objects that subclass java types:
0172:                //     try
0173:                //     {
0174:                //       return getMember(CASTTOSTRING).callAsFunction(EMPTY_ARRAY).castToString();
0175:                //     }
0176:                //     catch(PackagedScriptObjectException e)
0177:                //     {
0178:                //       // this causes infinite loop due to Value::toString() calling castToString()...
0179:                //       try
0180:                //       {
0181:                //         return getMember(TOSTRING).callAsFunction(EMPTY_ARRAY).castToString();
0182:                //       }
0183:                //       catch(PackagedScriptObjectException e2)
0184:                //       {
0185:                //         throw e;
0186:                //       }
0187:                //     }
0188:            }
0189:
0190:            public String _castToString() throws PackagedScriptObjectException {
0191:                return super .castToString();
0192:            }
0193:
0194:            private static final int CASTTOEXACTNUMBER = Symbol.getSymbol(
0195:                    "castToExactNumber").getId();
0196:
0197:            /*=======================================================================*/
0198:            /**
0199:             * Convert this object to a native java <code>long</code> value.
0200:             * 
0201:             * @return a long value
0202:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0203:             */
0204:            public long castToExactNumber()
0205:                    throws PackagedScriptObjectException {
0206:                return getMember(CASTTOEXACTNUMBER).callAsFunction(EMPTY_ARRAY)
0207:                        .castToExactNumber();
0208:            }
0209:
0210:            public long _castToExactNumber()
0211:                    throws PackagedScriptObjectException {
0212:                return super .castToExactNumber();
0213:            }
0214:
0215:            private static final int CASTTOINEXACTNUMBER = Symbol.getSymbol(
0216:                    "castToInexactNumber").getId();
0217:
0218:            /*=======================================================================*/
0219:            /**
0220:             * Convert this object to a native java <code>double</code> value.
0221:             * 
0222:             * @return a double value
0223:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0224:             */
0225:            public double castToInexactNumber()
0226:                    throws PackagedScriptObjectException {
0227:                return getMember(CASTTOINEXACTNUMBER).callAsFunction(
0228:                        EMPTY_ARRAY).castToInexactNumber();
0229:            }
0230:
0231:            public double _castToInexactNumber()
0232:                    throws PackagedScriptObjectException {
0233:                return super .castToInexactNumber();
0234:            }
0235:
0236:            /*=======================================================================*/
0237:            /**
0238:             * Convert this object to a native java <code>Object</code> value.
0239:             * 
0240:             * @return a java object
0241:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0242:             */
0243:            public Object castToJavaObject()
0244:                    throws PackagedScriptObjectException {
0245:                // XXX what about script objects implementing castToJavaObject?  Should 
0246:                //     that be allowed?
0247:
0248:                if (javaObject != null) {
0249:                    return javaObject;
0250:                } else {
0251:                    return super .castToJavaObject();
0252:                }
0253:            }
0254:
0255:            /*=======================================================================*/
0256:            /**
0257:             * Set the java-object associated with a script object... this is used
0258:             * when a script type subclasses a java type.
0259:             * 
0260:             * @param javaObject   the java-object
0261:             */
0262:            public void __setJavaObject(Object javaObject) {
0263:                this .javaObject = javaObject;
0264:            }
0265:
0266:            static final int _BOPCAST = Symbol.getSymbol("_bopCast").getId();
0267:            private static final int BOPCAST = Symbol.getSymbol("bopCast")
0268:                    .getId();
0269:            private static final int BOPCASTR = Symbol.getSymbol("bopCastR")
0270:                    .getId();
0271:
0272:            /*=======================================================================*/
0273:            /**
0274:             * Perform the cast operation, <code>(a)b</code> is equivalent to <code>a.bopCast(b)</code>
0275:             * 
0276:             * @param val          the other value
0277:             * @return the result
0278:             * @throws PackagedScriptObjectException(NoSuchMemberException)
0279:             */
0280:            public Value bopCast(Value val)
0281:                    throws PackagedScriptObjectException {
0282:                return getMember(BOPCAST).callAsFunction(new Value[] { val });
0283:            }
0284:
0285:            public Value _bopCast(Value val)
0286:                    throws PackagedScriptObjectException {
0287:                return super .bopCast(val);
0288:            }
0289:
0290:            public Value bopCastR(Value val, PackagedScriptObjectException e)
0291:                    throws PackagedScriptObjectException {
0292:                return getMember(BOPCASTR)
0293:                        .callAsFunction(
0294:                                new Value[] { val,
0295:                                        JavaBridge.convertToScriptObject(e) });
0296:            }
0297:
0298:            public Value _bopCastR(Value val, PackagedScriptObjectException e)
0299:                    throws PackagedScriptObjectException {
0300:                return super .bopCastR(val, e);
0301:            }
0302:
0303:            private static final int BOPINSTANCEOF = Symbol.getSymbol(
0304:                    "bopInstanceOf").getId();
0305:            private static final int BOPINSTANCEOFR = Symbol.getSymbol(
0306:                    "bopInstanceOfR").getId();
0307:
0308:            /*=======================================================================*/
0309:            /**
0310:             * Perform the instanceof operation.
0311:             * 
0312:             * @param val          the other value
0313:             * @return the result
0314:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0315:             */
0316:            public Value bopInstanceOf(Value val)
0317:                    throws PackagedScriptObjectException {
0318:                return getMember(BOPINSTANCEOF).callAsFunction(
0319:                        new Value[] { val });
0320:            }
0321:
0322:            public Value _bopInstanceOf(Value val)
0323:                    throws PackagedScriptObjectException {
0324:                return super .bopInstanceOf(val);
0325:            }
0326:
0327:            public Value bopInstanceOfR(Value val,
0328:                    PackagedScriptObjectException e)
0329:                    throws PackagedScriptObjectException {
0330:                return getMember(BOPINSTANCEOFR)
0331:                        .callAsFunction(
0332:                                new Value[] { val,
0333:                                        JavaBridge.convertToScriptObject(e) });
0334:            }
0335:
0336:            public Value _bopInstanceOfR(Value val,
0337:                    PackagedScriptObjectException e)
0338:                    throws PackagedScriptObjectException {
0339:                return super .bopInstanceOfR(val, e);
0340:            }
0341:
0342:            private static final int BOPLOGICALOR = Symbol.getSymbol(
0343:                    "bopLogicalOr").getId();
0344:            private static final int BOPLOGICALORR = Symbol.getSymbol(
0345:                    "bopLogicalOrR").getId();
0346:
0347:            /*=======================================================================*/
0348:            /**
0349:             * Perform the logical OR operation.
0350:             * 
0351:             * @param val          the other value
0352:             * @return the result
0353:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0354:             */
0355:            public Value bopLogicalOr(Value val)
0356:                    throws PackagedScriptObjectException {
0357:                return getMember(BOPLOGICALOR).callAsFunction(
0358:                        new Value[] { val });
0359:            }
0360:
0361:            public Value _bopLogicalOr(Value val)
0362:                    throws PackagedScriptObjectException {
0363:                return super .bopLogicalOr(val);
0364:            }
0365:
0366:            public Value bopLogicalOrR(Value val,
0367:                    PackagedScriptObjectException e)
0368:                    throws PackagedScriptObjectException {
0369:                return getMember(BOPLOGICALORR)
0370:                        .callAsFunction(
0371:                                new Value[] { val,
0372:                                        JavaBridge.convertToScriptObject(e) });
0373:            }
0374:
0375:            public Value _bopLogicalOrR(Value val,
0376:                    PackagedScriptObjectException e)
0377:                    throws PackagedScriptObjectException {
0378:                return super .bopLogicalOrR(val, e);
0379:            }
0380:
0381:            private static final int BOPLOGICALAND = Symbol.getSymbol(
0382:                    "bopLogicalAnd").getId();
0383:            private static final int BOPLOGICALANDR = Symbol.getSymbol(
0384:                    "bopLogicalAndR").getId();
0385:
0386:            /*=======================================================================*/
0387:            /**
0388:             * Perform the logical AND operation.
0389:             * 
0390:             * @param val          the other value
0391:             * @return the result
0392:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0393:             */
0394:            public Value bopLogicalAnd(Value val)
0395:                    throws PackagedScriptObjectException {
0396:                return getMember(BOPLOGICALAND).callAsFunction(
0397:                        new Value[] { val });
0398:            }
0399:
0400:            public Value _bopLogicalAnd(Value val)
0401:                    throws PackagedScriptObjectException {
0402:                return super .bopLogicalAnd(val);
0403:            }
0404:
0405:            public Value bopLogicalAndR(Value val,
0406:                    PackagedScriptObjectException e)
0407:                    throws PackagedScriptObjectException {
0408:                return getMember(BOPLOGICALANDR)
0409:                        .callAsFunction(
0410:                                new Value[] { val,
0411:                                        JavaBridge.convertToScriptObject(e) });
0412:            }
0413:
0414:            public Value _bopLogicalAndR(Value val,
0415:                    PackagedScriptObjectException e)
0416:                    throws PackagedScriptObjectException {
0417:                return super .bopLogicalAndR(val, e);
0418:            }
0419:
0420:            private static final int BOPBITWISEOR = Symbol.getSymbol(
0421:                    "bopBitwiseOr").getId();
0422:            private static final int BOPBITWISEORR = Symbol.getSymbol(
0423:                    "bopBitwiseOrR").getId();
0424:
0425:            /*=======================================================================*/
0426:            /**
0427:             * Perform the bitwise OR operation.
0428:             * 
0429:             * @param val          the other value
0430:             * @return the result
0431:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0432:             */
0433:            public Value bopBitwiseOr(Value val)
0434:                    throws PackagedScriptObjectException {
0435:                return getMember(BOPBITWISEOR).callAsFunction(
0436:                        new Value[] { val });
0437:            }
0438:
0439:            public Value _bopBitwiseOr(Value val)
0440:                    throws PackagedScriptObjectException {
0441:                return super .bopBitwiseOr(val);
0442:            }
0443:
0444:            public Value bopBitwiseOrR(Value val,
0445:                    PackagedScriptObjectException e)
0446:                    throws PackagedScriptObjectException {
0447:                return getMember(BOPBITWISEORR)
0448:                        .callAsFunction(
0449:                                new Value[] { val,
0450:                                        JavaBridge.convertToScriptObject(e) });
0451:            }
0452:
0453:            public Value _bopBitwiseOrR(Value val,
0454:                    PackagedScriptObjectException e)
0455:                    throws PackagedScriptObjectException {
0456:                return super .bopBitwiseOrR(val, e);
0457:            }
0458:
0459:            private static final int BOPBITWISEXOR = Symbol.getSymbol(
0460:                    "bopBitwiseXor").getId();
0461:            private static final int BOPBITWISEXORR = Symbol.getSymbol(
0462:                    "bopBitwiseXorR").getId();
0463:
0464:            /*=======================================================================*/
0465:            /**
0466:             * Perform the bitwise XOR operation.
0467:             * 
0468:             * @param val          the other value
0469:             * @return the result
0470:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0471:             */
0472:            public Value bopBitwiseXor(Value val)
0473:                    throws PackagedScriptObjectException {
0474:                return getMember(BOPBITWISEXOR).callAsFunction(
0475:                        new Value[] { val });
0476:            }
0477:
0478:            public Value _bopBitwiseXor(Value val)
0479:                    throws PackagedScriptObjectException {
0480:                return super .bopBitwiseXor(val);
0481:            }
0482:
0483:            public Value bopBitwiseXorR(Value val,
0484:                    PackagedScriptObjectException e)
0485:                    throws PackagedScriptObjectException {
0486:                return getMember(BOPBITWISEXORR)
0487:                        .callAsFunction(
0488:                                new Value[] { val,
0489:                                        JavaBridge.convertToScriptObject(e) });
0490:            }
0491:
0492:            public Value _bopBitwiseXorR(Value val,
0493:                    PackagedScriptObjectException e)
0494:                    throws PackagedScriptObjectException {
0495:                return super .bopBitwiseXorR(val, e);
0496:            }
0497:
0498:            private static final int BOPBITEWISEAND = Symbol.getSymbol(
0499:                    "bopBitewiseAnd").getId();
0500:            private static final int BOPBITEWISEANDR = Symbol.getSymbol(
0501:                    "bopBitewiseAndR").getId();
0502:
0503:            /*=======================================================================*/
0504:            /**
0505:             * Perform the bitwise AND operation.
0506:             * 
0507:             * @param val          the other value
0508:             * @return the result
0509:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0510:             */
0511:            public Value bopBitwiseAnd(Value val)
0512:                    throws PackagedScriptObjectException {
0513:                return getMember(BOPBITEWISEAND).callAsFunction(
0514:                        new Value[] { val });
0515:            }
0516:
0517:            public Value _bopBitwiseAnd(Value val)
0518:                    throws PackagedScriptObjectException {
0519:                return super .bopBitwiseAnd(val);
0520:            }
0521:
0522:            public Value bopBitwiseAndR(Value val,
0523:                    PackagedScriptObjectException e)
0524:                    throws PackagedScriptObjectException {
0525:                return getMember(BOPBITEWISEANDR)
0526:                        .callAsFunction(
0527:                                new Value[] { val,
0528:                                        JavaBridge.convertToScriptObject(e) });
0529:            }
0530:
0531:            public Value _bopBitwiseAndR(Value val,
0532:                    PackagedScriptObjectException e)
0533:                    throws PackagedScriptObjectException {
0534:                return super .bopBitwiseAndR(val, e);
0535:            }
0536:
0537:            private static final int BOPEQUALS = Symbol.getSymbol("bopEquals")
0538:                    .getId();
0539:            private static final int BOPEQUALSR = Symbol
0540:                    .getSymbol("bopEqualsR").getId();
0541:
0542:            /*=======================================================================*/
0543:            /**
0544:             * Perform the "==" operation.
0545:             * 
0546:             * @param val          the other value
0547:             * @return the result
0548:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0549:             */
0550:            public Value bopEquals(Value val)
0551:                    throws PackagedScriptObjectException {
0552:                return getMember(BOPEQUALS).callAsFunction(new Value[] { val });
0553:            }
0554:
0555:            public Value _bopEquals(Value val)
0556:                    throws PackagedScriptObjectException {
0557:                return super .bopEquals(val);
0558:            }
0559:
0560:            public Value bopEqualsR(Value val, PackagedScriptObjectException e)
0561:                    throws PackagedScriptObjectException {
0562:                return getMember(BOPEQUALSR)
0563:                        .callAsFunction(
0564:                                new Value[] { val,
0565:                                        JavaBridge.convertToScriptObject(e) });
0566:            }
0567:
0568:            public Value _bopEqualsR(Value val, PackagedScriptObjectException e)
0569:                    throws PackagedScriptObjectException {
0570:                return super .bopEqualsR(val, e);
0571:            }
0572:
0573:            private static final int BOPNOTEQUALS = Symbol.getSymbol(
0574:                    "bopNotEquals").getId();
0575:            private static final int BOPNOTEQUALSR = Symbol.getSymbol(
0576:                    "bopNotEqualsR").getId();
0577:
0578:            /*=======================================================================*/
0579:            /**
0580:             * Perform the "!=" operation.
0581:             * 
0582:             * @param val          the other value
0583:             * @return the result
0584:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0585:             */
0586:            public Value bopNotEquals(Value val)
0587:                    throws PackagedScriptObjectException {
0588:                return getMember(BOPNOTEQUALS).callAsFunction(
0589:                        new Value[] { val });
0590:            }
0591:
0592:            public Value _bopNotEquals(Value val)
0593:                    throws PackagedScriptObjectException {
0594:                return super .bopNotEquals(val);
0595:            }
0596:
0597:            public Value bopNotEqualsR(Value val,
0598:                    PackagedScriptObjectException e)
0599:                    throws PackagedScriptObjectException {
0600:                return getMember(BOPNOTEQUALSR)
0601:                        .callAsFunction(
0602:                                new Value[] { val,
0603:                                        JavaBridge.convertToScriptObject(e) });
0604:            }
0605:
0606:            public Value _bopNotEqualsR(Value val,
0607:                    PackagedScriptObjectException e)
0608:                    throws PackagedScriptObjectException {
0609:                return super .bopNotEqualsR(val, e);
0610:            }
0611:
0612:            private static final int BOPLESSTHAN = Symbol.getSymbol(
0613:                    "bopLessThan").getId();
0614:            private static final int BOPLESSTHANR = Symbol.getSymbol(
0615:                    "bopLessThanR").getId();
0616:
0617:            /*=======================================================================*/
0618:            /**
0619:             * Perform the "<" operation.
0620:             * 
0621:             * @param val          the other value
0622:             * @return the result
0623:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0624:             */
0625:            public Value bopLessThan(Value val)
0626:                    throws PackagedScriptObjectException {
0627:                return getMember(BOPLESSTHAN).callAsFunction(
0628:                        new Value[] { val });
0629:            }
0630:
0631:            public Value _bopLessThan(Value val)
0632:                    throws PackagedScriptObjectException {
0633:                return super .bopLessThan(val);
0634:            }
0635:
0636:            public Value bopLessThanR(Value val, PackagedScriptObjectException e)
0637:                    throws PackagedScriptObjectException {
0638:                return getMember(BOPLESSTHANR)
0639:                        .callAsFunction(
0640:                                new Value[] { val,
0641:                                        JavaBridge.convertToScriptObject(e) });
0642:            }
0643:
0644:            public Value _bopLessThanR(Value val,
0645:                    PackagedScriptObjectException e)
0646:                    throws PackagedScriptObjectException {
0647:                return super .bopLessThanR(val, e);
0648:            }
0649:
0650:            private static final int BOPGREATERTHAN = Symbol.getSymbol(
0651:                    "bopGreaterThan").getId();
0652:            private static final int BOPGREATERTHANR = Symbol.getSymbol(
0653:                    "bopGreaterThanR").getId();
0654:
0655:            /*=======================================================================*/
0656:            /**
0657:             * Perform the ">" operation.
0658:             * 
0659:             * @param val          the other value
0660:             * @return the result
0661:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0662:             */
0663:            public Value bopGreaterThan(Value val)
0664:                    throws PackagedScriptObjectException {
0665:                return getMember(BOPGREATERTHAN).callAsFunction(
0666:                        new Value[] { val });
0667:            }
0668:
0669:            public Value _bopGreaterThan(Value val)
0670:                    throws PackagedScriptObjectException {
0671:                return super .bopGreaterThan(val);
0672:            }
0673:
0674:            public Value bopGreaterThanR(Value val,
0675:                    PackagedScriptObjectException e)
0676:                    throws PackagedScriptObjectException {
0677:                return getMember(BOPGREATERTHANR)
0678:                        .callAsFunction(
0679:                                new Value[] { val,
0680:                                        JavaBridge.convertToScriptObject(e) });
0681:            }
0682:
0683:            public Value _bopGreaterThanR(Value val,
0684:                    PackagedScriptObjectException e)
0685:                    throws PackagedScriptObjectException {
0686:                return super .bopGreaterThanR(val, e);
0687:            }
0688:
0689:            private static final int BOPLESSTHANOREQUALS = Symbol.getSymbol(
0690:                    "bopLessThanOrEquals").getId();
0691:            private static final int BOPLESSTHANOREQUALSR = Symbol.getSymbol(
0692:                    "bopLessThanOrEqualsR").getId();
0693:
0694:            /*=======================================================================*/
0695:            /**
0696:             * Perform the "<=" operation.
0697:             * 
0698:             * @param val          the other value
0699:             * @return the result
0700:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0701:             */
0702:            public Value bopLessThanOrEquals(Value val)
0703:                    throws PackagedScriptObjectException {
0704:                return getMember(BOPLESSTHANOREQUALS).callAsFunction(
0705:                        new Value[] { val });
0706:            }
0707:
0708:            public Value _bopLessThanOrEquals(Value val)
0709:                    throws PackagedScriptObjectException {
0710:                return super .bopLessThanOrEquals(val);
0711:            }
0712:
0713:            public Value bopLessThanOrEqualsR(Value val,
0714:                    PackagedScriptObjectException e)
0715:                    throws PackagedScriptObjectException {
0716:                return getMember(BOPLESSTHANOREQUALSR)
0717:                        .callAsFunction(
0718:                                new Value[] { val,
0719:                                        JavaBridge.convertToScriptObject(e) });
0720:            }
0721:
0722:            public Value _bopLessThanOrEqualsR(Value val,
0723:                    PackagedScriptObjectException e)
0724:                    throws PackagedScriptObjectException {
0725:                return super .bopLessThanOrEqualsR(val, e);
0726:            }
0727:
0728:            private static final int BOPGREATORTHANOREQUALS = Symbol.getSymbol(
0729:                    "bopGreatorThanOrEquals").getId();
0730:            private static final int BOPGREATORTHANOREQUALSR = Symbol
0731:                    .getSymbol("bopGreatorThanOrEqualsR").getId();
0732:
0733:            /*=======================================================================*/
0734:            /**
0735:             * Perform the ">=" operation.
0736:             * 
0737:             * @param val          the other value
0738:             * @return the result
0739:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0740:             */
0741:            public Value bopGreaterThanOrEquals(Value val)
0742:                    throws PackagedScriptObjectException {
0743:                return getMember(BOPGREATORTHANOREQUALS).callAsFunction(
0744:                        new Value[] { val });
0745:            }
0746:
0747:            public Value _bopGreaterThanOrEquals(Value val)
0748:                    throws PackagedScriptObjectException {
0749:                return super .bopGreaterThanOrEquals(val);
0750:            }
0751:
0752:            public Value bopGreaterThanOrEqualsR(Value val,
0753:                    PackagedScriptObjectException e)
0754:                    throws PackagedScriptObjectException {
0755:                return getMember(BOPGREATORTHANOREQUALSR)
0756:                        .callAsFunction(
0757:                                new Value[] { val,
0758:                                        JavaBridge.convertToScriptObject(e) });
0759:            }
0760:
0761:            public Value _bopGreaterThanOrEqualsR(Value val,
0762:                    PackagedScriptObjectException e)
0763:                    throws PackagedScriptObjectException {
0764:                return super .bopGreaterThanOrEqualsR(val, e);
0765:            }
0766:
0767:            private static final int BOPLEFTSHIFT = Symbol.getSymbol(
0768:                    "bopLeftShift").getId();
0769:            private static final int BOPLEFTSHIFTR = Symbol.getSymbol(
0770:                    "bopLeftShiftR").getId();
0771:
0772:            /*=======================================================================*/
0773:            /**
0774:             * Perform the "<<" operation.
0775:             * 
0776:             * @param val          the other value
0777:             * @return the result
0778:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0779:             */
0780:            public Value bopLeftShift(Value val)
0781:                    throws PackagedScriptObjectException {
0782:                return getMember(BOPLEFTSHIFT).callAsFunction(
0783:                        new Value[] { val });
0784:            }
0785:
0786:            public Value _bopLeftShift(Value val)
0787:                    throws PackagedScriptObjectException {
0788:                return super .bopLeftShift(val);
0789:            }
0790:
0791:            public Value bopLeftShiftR(Value val,
0792:                    PackagedScriptObjectException e)
0793:                    throws PackagedScriptObjectException {
0794:                return getMember(BOPLEFTSHIFTR)
0795:                        .callAsFunction(
0796:                                new Value[] { val,
0797:                                        JavaBridge.convertToScriptObject(e) });
0798:            }
0799:
0800:            public Value _bopLeftShiftR(Value val,
0801:                    PackagedScriptObjectException e)
0802:                    throws PackagedScriptObjectException {
0803:                return super .bopLeftShiftR(val, e);
0804:            }
0805:
0806:            private static final int BOPSIGNEDRIGHTSHIFT = Symbol.getSymbol(
0807:                    "bopSignedRightShift").getId();
0808:            private static final int BOPSIGNEDRIGHTSHIFTR = Symbol.getSymbol(
0809:                    "bopSignedRightShiftR").getId();
0810:
0811:            /*=======================================================================*/
0812:            /**
0813:             * Perform the ">>" operation.
0814:             * 
0815:             * @param val          the other value
0816:             * @return the result
0817:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0818:             */
0819:            public Value bopSignedRightShift(Value val)
0820:                    throws PackagedScriptObjectException {
0821:                return getMember(BOPSIGNEDRIGHTSHIFT).callAsFunction(
0822:                        new Value[] { val });
0823:            }
0824:
0825:            public Value _bopSignedRightShift(Value val)
0826:                    throws PackagedScriptObjectException {
0827:                return super .bopSignedRightShift(val);
0828:            }
0829:
0830:            public Value bopSignedRightShiftR(Value val,
0831:                    PackagedScriptObjectException e)
0832:                    throws PackagedScriptObjectException {
0833:                return getMember(BOPSIGNEDRIGHTSHIFTR)
0834:                        .callAsFunction(
0835:                                new Value[] { val,
0836:                                        JavaBridge.convertToScriptObject(e) });
0837:            }
0838:
0839:            public Value _bopSignedRightShiftR(Value val,
0840:                    PackagedScriptObjectException e)
0841:                    throws PackagedScriptObjectException {
0842:                return super .bopSignedRightShiftR(val, e);
0843:            }
0844:
0845:            private static final int BOPUNSIGNEDRIGHTSHIFT = Symbol.getSymbol(
0846:                    "bopUnsignedRightShift").getId();
0847:            private static final int BOPUNSIGNEDRIGHTSHIFTR = Symbol.getSymbol(
0848:                    "bopUnsignedRightShiftR").getId();
0849:
0850:            /*=======================================================================*/
0851:            /**
0852:             * Perform the ">>>" operation.
0853:             * 
0854:             * @param val          the other value
0855:             * @return the result
0856:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0857:             */
0858:            public Value bopUnsignedRightShift(Value val)
0859:                    throws PackagedScriptObjectException {
0860:                return getMember(BOPUNSIGNEDRIGHTSHIFT).callAsFunction(
0861:                        new Value[] { val });
0862:            }
0863:
0864:            public Value _bopUnsignedRightShift(Value val)
0865:                    throws PackagedScriptObjectException {
0866:                return super .bopUnsignedRightShift(val);
0867:            }
0868:
0869:            public Value bopUnsignedRightShiftR(Value val,
0870:                    PackagedScriptObjectException e)
0871:                    throws PackagedScriptObjectException {
0872:                return getMember(BOPUNSIGNEDRIGHTSHIFTR)
0873:                        .callAsFunction(
0874:                                new Value[] { val,
0875:                                        JavaBridge.convertToScriptObject(e) });
0876:            }
0877:
0878:            public Value _bopUnsignedRightShiftR(Value val,
0879:                    PackagedScriptObjectException e)
0880:                    throws PackagedScriptObjectException {
0881:                return super .bopUnsignedRightShiftR(val, e);
0882:            }
0883:
0884:            private static final int BOPPLUS = Symbol.getSymbol("bopPlus")
0885:                    .getId();
0886:            private static final int BOPPLUSR = Symbol.getSymbol("bopPlusR")
0887:                    .getId();
0888:
0889:            /*=======================================================================*/
0890:            /**
0891:             * Perform the "+" operation.
0892:             * 
0893:             * @param val          the other value
0894:             * @return the result
0895:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0896:             */
0897:            public Value bopPlus(Value val)
0898:                    throws PackagedScriptObjectException {
0899:                return getMember(BOPPLUS).callAsFunction(new Value[] { val });
0900:            }
0901:
0902:            public Value _bopPlus(Value val)
0903:                    throws PackagedScriptObjectException {
0904:                return super .bopPlus(val);
0905:            }
0906:
0907:            public Value bopPlusR(Value val, PackagedScriptObjectException e)
0908:                    throws PackagedScriptObjectException {
0909:                return getMember(BOPPLUSR)
0910:                        .callAsFunction(
0911:                                new Value[] { val,
0912:                                        JavaBridge.convertToScriptObject(e) });
0913:            }
0914:
0915:            public Value _bopPlusR(Value val, PackagedScriptObjectException e)
0916:                    throws PackagedScriptObjectException {
0917:                return super .bopPlusR(val, e);
0918:            }
0919:
0920:            private static final int BOPMINUS = Symbol.getSymbol("bopMinus")
0921:                    .getId();
0922:            private static final int BOPMINUSR = Symbol.getSymbol("bopMinusR")
0923:                    .getId();
0924:
0925:            /*=======================================================================*/
0926:            /**
0927:             * Perform the "-" operation.
0928:             * 
0929:             * @param val          the other value
0930:             * @return the result
0931:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0932:             */
0933:            public Value bopMinus(Value val)
0934:                    throws PackagedScriptObjectException {
0935:                return getMember(BOPMINUS).callAsFunction(new Value[] { val });
0936:            }
0937:
0938:            public Value _bopMinus(Value val)
0939:                    throws PackagedScriptObjectException {
0940:                return super .bopMinus(val);
0941:            }
0942:
0943:            public Value bopMinusR(Value val, PackagedScriptObjectException e)
0944:                    throws PackagedScriptObjectException {
0945:                return getMember(BOPMINUSR)
0946:                        .callAsFunction(
0947:                                new Value[] { val,
0948:                                        JavaBridge.convertToScriptObject(e) });
0949:            }
0950:
0951:            public Value _bopMinusR(Value val, PackagedScriptObjectException e)
0952:                    throws PackagedScriptObjectException {
0953:                return super .bopMinusR(val, e);
0954:            }
0955:
0956:            private static final int BOPMULTIPLY = Symbol.getSymbol(
0957:                    "bopMultiply").getId();
0958:            private static final int BOPMULTIPLYR = Symbol.getSymbol(
0959:                    "bopMultiplyR").getId();
0960:
0961:            /*=======================================================================*/
0962:            /**
0963:             * Perform the "*" operation.
0964:             * 
0965:             * @param val          the other value
0966:             * @return the result
0967:             * @throws PackagedScriptObjectException(NoSuchMethodException)
0968:             */
0969:            public Value bopMultiply(Value val)
0970:                    throws PackagedScriptObjectException {
0971:                return getMember(BOPMULTIPLY).callAsFunction(
0972:                        new Value[] { val });
0973:            }
0974:
0975:            public Value _bopMultiply(Value val)
0976:                    throws PackagedScriptObjectException {
0977:                return super .bopMultiply(val);
0978:            }
0979:
0980:            public Value bopMultiplyR(Value val, PackagedScriptObjectException e)
0981:                    throws PackagedScriptObjectException {
0982:                return getMember(BOPMULTIPLYR)
0983:                        .callAsFunction(
0984:                                new Value[] { val,
0985:                                        JavaBridge.convertToScriptObject(e) });
0986:            }
0987:
0988:            public Value _bopMultiplyR(Value val,
0989:                    PackagedScriptObjectException e)
0990:                    throws PackagedScriptObjectException {
0991:                return super .bopMultiplyR(val, e);
0992:            }
0993:
0994:            private static final int BOPDIVIDE = Symbol.getSymbol("bopDivide")
0995:                    .getId();
0996:            private static final int BOPDIVIDER = Symbol
0997:                    .getSymbol("bopDivideR").getId();
0998:
0999:            /*=======================================================================*/
1000:            /**
1001:             * Perform the "/" operation.
1002:             * 
1003:             * @param val          the other value
1004:             * @return the result
1005:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1006:             */
1007:            public Value bopDivide(Value val)
1008:                    throws PackagedScriptObjectException {
1009:                return getMember(BOPDIVIDE).callAsFunction(new Value[] { val });
1010:            }
1011:
1012:            public Value _bopDivide(Value val)
1013:                    throws PackagedScriptObjectException {
1014:                return super .bopDivide(val);
1015:            }
1016:
1017:            public Value bopDivideR(Value val, PackagedScriptObjectException e)
1018:                    throws PackagedScriptObjectException {
1019:                return getMember(BOPDIVIDER)
1020:                        .callAsFunction(
1021:                                new Value[] { val,
1022:                                        JavaBridge.convertToScriptObject(e) });
1023:            }
1024:
1025:            public Value _bopDivideR(Value val, PackagedScriptObjectException e)
1026:                    throws PackagedScriptObjectException {
1027:                return super .bopDivideR(val, e);
1028:            }
1029:
1030:            private static final int BOPREMAINDER = Symbol.getSymbol(
1031:                    "bopRemainder").getId();
1032:            private static final int BOPREMAINDERR = Symbol.getSymbol(
1033:                    "bopRemainderR").getId();
1034:
1035:            /*=======================================================================*/
1036:            /**
1037:             * Perform the "%" operation.
1038:             * 
1039:             * @param val          the other value
1040:             * @return the result
1041:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1042:             */
1043:            public Value bopRemainder(Value val)
1044:                    throws PackagedScriptObjectException {
1045:                return getMember(BOPREMAINDER).callAsFunction(
1046:                        new Value[] { val });
1047:            }
1048:
1049:            public Value _bopRemainder(Value val)
1050:                    throws PackagedScriptObjectException {
1051:                return super .bopRemainder(val);
1052:            }
1053:
1054:            public Value bopRemainderR(Value val,
1055:                    PackagedScriptObjectException e)
1056:                    throws PackagedScriptObjectException {
1057:                return getMember(BOPREMAINDERR)
1058:                        .callAsFunction(
1059:                                new Value[] { val,
1060:                                        JavaBridge.convertToScriptObject(e) });
1061:            }
1062:
1063:            public Value _bopRemainderR(Value val,
1064:                    PackagedScriptObjectException e)
1065:                    throws PackagedScriptObjectException {
1066:                return super .bopRemainderR(val, e);
1067:            }
1068:
1069:            private static final int UOPINCREMENT = Symbol.getSymbol(
1070:                    "uopIncrement").getId();
1071:
1072:            /*=======================================================================*/
1073:            /**
1074:             * Perform the "++" operation.
1075:             * 
1076:             * @return the result
1077:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1078:             */
1079:            public Value uopIncrement() throws PackagedScriptObjectException {
1080:                return getMember(UOPINCREMENT).callAsFunction(EMPTY_ARRAY);
1081:            }
1082:
1083:            public Value _uopIncrement() throws PackagedScriptObjectException {
1084:                return super .uopIncrement();
1085:            }
1086:
1087:            private static final int UOPDECREMENT = Symbol.getSymbol(
1088:                    "uopDecrement").getId();
1089:
1090:            /*=======================================================================*/
1091:            /**
1092:             * Perform the "--" operation.
1093:             * 
1094:             * @return the result
1095:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1096:             */
1097:            public Value uopDecrement() throws PackagedScriptObjectException {
1098:                return getMember(UOPDECREMENT).callAsFunction(EMPTY_ARRAY);
1099:            }
1100:
1101:            public Value _uopDecrement() throws PackagedScriptObjectException {
1102:                return super .uopDecrement();
1103:            }
1104:
1105:            private static final int UOPPLUS = Symbol.getSymbol("uopPlus")
1106:                    .getId();
1107:
1108:            /*=======================================================================*/
1109:            /**
1110:             * Perform the "+" operation.
1111:             * 
1112:             * @return the result
1113:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1114:             */
1115:            public Value uopPlus() throws PackagedScriptObjectException {
1116:                return getMember(UOPPLUS).callAsFunction(EMPTY_ARRAY);
1117:            }
1118:
1119:            public Value _uopPlus() throws PackagedScriptObjectException {
1120:                return super .uopPlus();
1121:            }
1122:
1123:            private static final int UOPMINUS = Symbol.getSymbol("uopMinus")
1124:                    .getId();
1125:
1126:            /*=======================================================================*/
1127:            /**
1128:             * Perform the "-" operation.
1129:             * 
1130:             * @return the result
1131:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1132:             */
1133:            public Value uopMinus() throws PackagedScriptObjectException {
1134:                return getMember(UOPMINUS).callAsFunction(EMPTY_ARRAY);
1135:            }
1136:
1137:            public Value _uopMinus() throws PackagedScriptObjectException {
1138:                return super .uopMinus();
1139:            }
1140:
1141:            private static final int UOPBITWISENOT = Symbol.getSymbol(
1142:                    "uopBitwiseNot").getId();
1143:
1144:            /*=======================================================================*/
1145:            /**
1146:             * Perform the "~" operation.
1147:             * 
1148:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1149:             */
1150:            public Value uopBitwiseNot() throws PackagedScriptObjectException {
1151:                return getMember(UOPBITWISENOT).callAsFunction(EMPTY_ARRAY);
1152:            }
1153:
1154:            public Value _uopBitwiseNot() throws PackagedScriptObjectException {
1155:                return super .uopBitwiseNot();
1156:            }
1157:
1158:            private static final int UOPLOGICALNOT = Symbol.getSymbol(
1159:                    "uopLogicalNot").getId();
1160:
1161:            /*=======================================================================*/
1162:            /**
1163:             * Perform the "!" operation.
1164:             * 
1165:             * @return the result
1166:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1167:             */
1168:            public Value uopLogicalNot() throws PackagedScriptObjectException {
1169:                return getMember(UOPLOGICALNOT).callAsFunction(EMPTY_ARRAY);
1170:            }
1171:
1172:            public Value _uopLogicalNot() throws PackagedScriptObjectException {
1173:                return super .uopLogicalNot();
1174:            }
1175:
1176:            /*=======================================================================*/
1177:            /* The misc operators:
1178:             */
1179:
1180:            private static final int OPASSIGN = Symbol.getSymbol("opAssign")
1181:                    .getId();
1182:
1183:            /*=======================================================================*/
1184:            /**
1185:             * Perform assignment.  Set the value of this reference to the specified
1186:             * value.
1187:             * 
1188:             * @param val          the value to set this reference to
1189:             * @throws PackagedScriptObjectException(NoSuchMemberException)
1190:             */
1191:            public void opAssign(Value val)
1192:                    throws PackagedScriptObjectException {
1193:                getMember(OPASSIGN).callAsFunction(new Value[] { val });
1194:            }
1195:
1196:            public void _opAssign(Value val)
1197:                    throws PackagedScriptObjectException {
1198:                super .opAssign(val);
1199:            }
1200:
1201:            private static final int CALLASFUNCTION = Symbol.getSymbol(
1202:                    "callAsFunction").getId();
1203:
1204:            /*=======================================================================*/
1205:            /**
1206:             * Call this object as a function.
1207:             * 
1208:             * @param sf           the current stack frame
1209:             * @param args         the arguments to the function, or <code>null</code> if none
1210:             * @return the value returned by the function
1211:             * @throws PackagedScriptObjectException
1212:             * @see Function
1213:             */
1214:            public Value callAsFunction(StackFrame sf, MemberTable args)
1215:                    throws PackagedScriptObjectException {
1216:                return getMember(CALLASFUNCTION).callAsFunction(
1217:                        new Value[] { (args == null) ? new OArray(0)
1218:                                : new OArray(args) });
1219:            }
1220:
1221:            public Value _callAsFunction(StackFrame sf, MemberTable args)
1222:                    throws PackagedScriptObjectException {
1223:                return super .callAsFunction(sf, args);
1224:            }
1225:
1226:            private static final int CALLASCONSTRUCTOR = Symbol.getSymbol(
1227:                    "callAsConstructor").getId();
1228:
1229:            /*=======================================================================*/
1230:            /**
1231:             * Call this object as a constructor.
1232:             * 
1233:             * @param sf           the current stack frame
1234:             * @param args         the arguments to the function, or <code>null</code> if none
1235:             * @return the newly constructed object
1236:             * @throws PackagedScriptObjectException
1237:             * @see Function
1238:             */
1239:            public Value callAsConstructor(StackFrame sf, MemberTable args)
1240:                    throws PackagedScriptObjectException {
1241:                return getMember(CALLASCONSTRUCTOR).callAsFunction(
1242:                        new Value[] { (args == null) ? new OArray(0)
1243:                                : new OArray(args) });
1244:            }
1245:
1246:            public Value _callAsConstructor(StackFrame sf, MemberTable args)
1247:                    throws PackagedScriptObjectException {
1248:                return super .callAsConstructor(sf, args);
1249:            }
1250:
1251:            private static final int CALLASEXTENDS = Symbol.getSymbol(
1252:                    "callAsExtends").getId();
1253:
1254:            /*=======================================================================*/
1255:            /**
1256:             * Call this object as a parent class constructor.
1257:             * 
1258:             * @param sf           the current stack frame
1259:             * @param scope        the object
1260:             * @param args         the arguments to the function, or <code>null</code> if none
1261:             * @return the value returned by the function
1262:             * @throws PackagedScriptObjectException
1263:             * @see Function
1264:             */
1265:            public Value callAsExtends(StackFrame sf, Scope scope,
1266:                    MemberTable args) throws PackagedScriptObjectException {
1267:                return getMember(CALLASEXTENDS).callAsFunction(
1268:                        new Value[] { (args == null) ? new OArray(0)
1269:                                : new OArray(args) });
1270:            }
1271:
1272:            public Value _callAsExtends(StackFrame sf, Scope scope,
1273:                    MemberTable args) throws PackagedScriptObjectException {
1274:                return super .callAsExtends(sf, scope, args);
1275:            }
1276:
1277:            private static final int LENGTH = Symbol.getSymbol("length")
1278:                    .getId();
1279:
1280:            /*=======================================================================*/
1281:            /**
1282:             * For types that implement <code>elementAt</code>, this returns the
1283:             * number of elements.  This is the same as the <i>length</i> property
1284:             * of an object.
1285:             * 
1286:             * @return an integer length
1287:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1288:             * @see #elementAt
1289:             */
1290:            public int length() throws PackagedScriptObjectException {
1291:                return (int) (getMember(LENGTH).callAsFunction(EMPTY_ARRAY)
1292:                        .castToExactNumber());
1293:            }
1294:
1295:            public int _length() throws PackagedScriptObjectException {
1296:                return super .length();
1297:            }
1298:
1299:            private static final int ELEMENTAT = Symbol.getSymbol("elementAt")
1300:                    .getId();
1301:
1302:            /*=======================================================================*/
1303:            /**
1304:             * Get the specified index of this object, if this object is an array.  If
1305:             * needed, the array is grown to the appropriate size.
1306:             * 
1307:             * @param idx          the index to get
1308:             * @return a reference to the member
1309:             * @throws PackagedScriptObjectException(NoSuchMethodException)
1310:             * @see #length
1311:             */
1312:            public Value elementAt(Value idx)
1313:                    throws PackagedScriptObjectException {
1314:                return getMember(ELEMENTAT).callAsFunction(new Value[] { idx });
1315:            }
1316:
1317:            public Value _elementAt(Value idx)
1318:                    throws PackagedScriptObjectException {
1319:                return super .elementAt(idx);
1320:            }
1321:
1322:            private static final int ELEMENTSAT = Symbol
1323:                    .getSymbol("elementsAt").getId();
1324:
1325:            /*=======================================================================*/
1326:            /**
1327:             * Get the specified range of this object, if this object is an array.  
1328:             * This returns a copy of a range of the array.
1329:             * 
1330:             * @param idx1         the index index of the beginning of the range, inclusive
1331:             * @param idx2         the index of the end of the range, inclusive
1332:             * @return a copy of the specified range of this array
1333:             * @throws PackagedScriptObjectException(NoSuchMemberException)
1334:             * @see #length
1335:             * @see #elementAt
1336:             */
1337:            public Value elementsAt(Value idx1, Value idx2)
1338:                    throws PackagedScriptObjectException {
1339:                return getMember(ELEMENTSAT).callAsFunction(
1340:                        new Value[] { idx1, idx2 });
1341:            }
1342:
1343:            public Value _elementsAt(Value idx1, Value idx2)
1344:                    throws PackagedScriptObjectException {
1345:                return super .elementsAt(idx1, idx2);
1346:            }
1347:
1348:            private static final int FINALIZE = Symbol.getSymbol("finalize")
1349:                    .getId();
1350:
1351:            /*=======================================================================*/
1352:            /**
1353:             * Called when the script object is GC'd
1354:             */
1355:            protected void finalize() throws PackagedScriptObjectException {
1356:                Value fxn = getMemberImpl(FINALIZE); // use getMemberImpl() so function doesn't have to be public
1357:                if (fxn != null)
1358:                    fxn.callAsFunction(EMPTY_ARRAY);
1359:            }
1360:        }
1361:
1362:        /*
1363:         *   Local Variables:
1364:         *   tab-width: 2
1365:         *   indent-tabs-mode: nil
1366:         *   mode: java
1367:         *   c-indentation-style: java
1368:         *   c-basic-offset: 2
1369:         *   eval: (c-set-offset 'substatement-open '0)
1370:         *   eval: (c-set-offset 'case-label '+)
1371:         *   eval: (c-set-offset 'inclass '+)
1372:         *   eval: (c-set-offset 'inline-open '0)
1373:         *   End:
1374:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.