Source Code Cross Referenced for PySetDerived.java in  » Testing » Marathon » org » python » modules » sets » 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 » Testing » Marathon » org.python.modules.sets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.python.modules.sets;
0002:
0003:        import org.python.core.Py;
0004:        import org.python.core.PyComplex;
0005:        import org.python.core.PyDictionary;
0006:        import org.python.core.PyException;
0007:        import org.python.core.PyFloat;
0008:        import org.python.core.PyInteger;
0009:        import org.python.core.PyLong;
0010:        import org.python.core.PyObject;
0011:        import org.python.core.PySequenceIter;
0012:        import org.python.core.PyString;
0013:        import org.python.core.PyStringMap;
0014:        import org.python.core.PyType;
0015:        import org.python.core.PyUnicode;
0016:        import org.python.core.Slotted;
0017:        import org.python.core.ThreadState;
0018:
0019:        public class PySetDerived extends PySet implements  Slotted {
0020:
0021:            public PyObject getSlot(int index) {
0022:                return slots[index];
0023:            }
0024:
0025:            public void setSlot(int index, PyObject value) {
0026:                slots[index] = value;
0027:            }
0028:
0029:            private PyObject[] slots;
0030:
0031:            private PyObject dict;
0032:
0033:            public PyObject fastGetDict() {
0034:                return dict;
0035:            }
0036:
0037:            public PyObject getDict() {
0038:                return dict;
0039:            }
0040:
0041:            public void setDict(PyObject newDict) {
0042:                if (newDict instanceof  PyStringMap
0043:                        || newDict instanceof  PyDictionary) {
0044:                    dict = newDict;
0045:                } else {
0046:                    throw Py.TypeError("__dict__ must be set to a Dictionary "
0047:                            + newDict.getClass().getName());
0048:                }
0049:            }
0050:
0051:            public void delDict() {
0052:                // deleting an object's instance dict makes it grow a new one
0053:                dict = new PyStringMap();
0054:            }
0055:
0056:            public PySetDerived(PyType subtype) {
0057:                super (subtype);
0058:                slots = new PyObject[subtype.getNumSlots()];
0059:                dict = subtype.instDict();
0060:            }
0061:
0062:            public PyString __str__() {
0063:                PyType self_type = getType();
0064:                PyObject impl = self_type.lookup("__str__");
0065:                if (impl != null) {
0066:                    PyObject res = impl.__get__(this , self_type).__call__();
0067:                    if (res instanceof  PyString)
0068:                        return (PyString) res;
0069:                    throw Py.TypeError("__str__" + " should return a "
0070:                            + "string");
0071:                }
0072:                return super .__str__();
0073:            }
0074:
0075:            public PyString __repr__() {
0076:                PyType self_type = getType();
0077:                PyObject impl = self_type.lookup("__repr__");
0078:                if (impl != null) {
0079:                    PyObject res = impl.__get__(this , self_type).__call__();
0080:                    if (res instanceof  PyString)
0081:                        return (PyString) res;
0082:                    throw Py.TypeError("__repr__" + " should return a "
0083:                            + "string");
0084:                }
0085:                return super .__repr__();
0086:            }
0087:
0088:            public PyString __hex__() {
0089:                PyType self_type = getType();
0090:                PyObject impl = self_type.lookup("__hex__");
0091:                if (impl != null) {
0092:                    PyObject res = impl.__get__(this , self_type).__call__();
0093:                    if (res instanceof  PyString)
0094:                        return (PyString) res;
0095:                    throw Py.TypeError("__hex__" + " should return a "
0096:                            + "string");
0097:                }
0098:                return super .__hex__();
0099:            }
0100:
0101:            public PyString __oct__() {
0102:                PyType self_type = getType();
0103:                PyObject impl = self_type.lookup("__oct__");
0104:                if (impl != null) {
0105:                    PyObject res = impl.__get__(this , self_type).__call__();
0106:                    if (res instanceof  PyString)
0107:                        return (PyString) res;
0108:                    throw Py.TypeError("__oct__" + " should return a "
0109:                            + "string");
0110:                }
0111:                return super .__oct__();
0112:            }
0113:
0114:            public PyFloat __float__() {
0115:                PyType self_type = getType();
0116:                PyObject impl = self_type.lookup("__float__");
0117:                if (impl != null) {
0118:                    PyObject res = impl.__get__(this , self_type).__call__();
0119:                    if (res instanceof  PyFloat)
0120:                        return (PyFloat) res;
0121:                    throw Py.TypeError("__float__" + " should return a "
0122:                            + "float");
0123:                }
0124:                return super .__float__();
0125:            }
0126:
0127:            public PyLong __long__() {
0128:                PyType self_type = getType();
0129:                PyObject impl = self_type.lookup("__long__");
0130:                if (impl != null) {
0131:                    PyObject res = impl.__get__(this , self_type).__call__();
0132:                    if (res instanceof  PyLong)
0133:                        return (PyLong) res;
0134:                    throw Py.TypeError("__long__" + " should return a "
0135:                            + "long");
0136:                }
0137:                return super .__long__();
0138:            }
0139:
0140:            public PyComplex __complex__() {
0141:                PyType self_type = getType();
0142:                PyObject impl = self_type.lookup("__complex__");
0143:                if (impl != null) {
0144:                    PyObject res = impl.__get__(this , self_type).__call__();
0145:                    if (res instanceof  PyComplex)
0146:                        return (PyComplex) res;
0147:                    throw Py.TypeError("__complex__" + " should return a "
0148:                            + "complex");
0149:                }
0150:                return super .__complex__();
0151:            }
0152:
0153:            public PyObject __pos__() {
0154:                PyType self_type = getType();
0155:                PyObject impl = self_type.lookup("__pos__");
0156:                if (impl != null)
0157:                    return impl.__get__(this , self_type).__call__();
0158:                return super .__pos__();
0159:            }
0160:
0161:            public PyObject __neg__() {
0162:                PyType self_type = getType();
0163:                PyObject impl = self_type.lookup("__neg__");
0164:                if (impl != null)
0165:                    return impl.__get__(this , self_type).__call__();
0166:                return super .__neg__();
0167:            }
0168:
0169:            public PyObject __abs__() {
0170:                PyType self_type = getType();
0171:                PyObject impl = self_type.lookup("__abs__");
0172:                if (impl != null)
0173:                    return impl.__get__(this , self_type).__call__();
0174:                return super .__abs__();
0175:            }
0176:
0177:            public PyObject __invert__() {
0178:                PyType self_type = getType();
0179:                PyObject impl = self_type.lookup("__invert__");
0180:                if (impl != null)
0181:                    return impl.__get__(this , self_type).__call__();
0182:                return super .__invert__();
0183:            }
0184:
0185:            public PyObject __reduce__() {
0186:                PyType self_type = getType();
0187:                PyObject impl = self_type.lookup("__reduce__");
0188:                if (impl != null)
0189:                    return impl.__get__(this , self_type).__call__();
0190:                return super .__reduce__();
0191:            }
0192:
0193:            public PyObject __add__(PyObject other) {
0194:                PyType self_type = getType();
0195:                PyObject impl = self_type.lookup("__add__");
0196:                if (impl != null) {
0197:                    PyObject res = impl.__get__(this , self_type)
0198:                            .__call__(other);
0199:                    if (res == Py.NotImplemented)
0200:                        return null;
0201:                    return res;
0202:                }
0203:                return super .__add__(other);
0204:            }
0205:
0206:            public PyObject __radd__(PyObject other) {
0207:                PyType self_type = getType();
0208:                PyObject impl = self_type.lookup("__radd__");
0209:                if (impl != null) {
0210:                    PyObject res = impl.__get__(this , self_type)
0211:                            .__call__(other);
0212:                    if (res == Py.NotImplemented)
0213:                        return null;
0214:                    return res;
0215:                }
0216:                return super .__radd__(other);
0217:            }
0218:
0219:            public PyObject __sub__(PyObject other) {
0220:                PyType self_type = getType();
0221:                PyObject impl = self_type.lookup("__sub__");
0222:                if (impl != null) {
0223:                    PyObject res = impl.__get__(this , self_type)
0224:                            .__call__(other);
0225:                    if (res == Py.NotImplemented)
0226:                        return null;
0227:                    return res;
0228:                }
0229:                return super .__sub__(other);
0230:            }
0231:
0232:            public PyObject __rsub__(PyObject other) {
0233:                PyType self_type = getType();
0234:                PyObject impl = self_type.lookup("__rsub__");
0235:                if (impl != null) {
0236:                    PyObject res = impl.__get__(this , self_type)
0237:                            .__call__(other);
0238:                    if (res == Py.NotImplemented)
0239:                        return null;
0240:                    return res;
0241:                }
0242:                return super .__rsub__(other);
0243:            }
0244:
0245:            public PyObject __mul__(PyObject other) {
0246:                PyType self_type = getType();
0247:                PyObject impl = self_type.lookup("__mul__");
0248:                if (impl != null) {
0249:                    PyObject res = impl.__get__(this , self_type)
0250:                            .__call__(other);
0251:                    if (res == Py.NotImplemented)
0252:                        return null;
0253:                    return res;
0254:                }
0255:                return super .__mul__(other);
0256:            }
0257:
0258:            public PyObject __rmul__(PyObject other) {
0259:                PyType self_type = getType();
0260:                PyObject impl = self_type.lookup("__rmul__");
0261:                if (impl != null) {
0262:                    PyObject res = impl.__get__(this , self_type)
0263:                            .__call__(other);
0264:                    if (res == Py.NotImplemented)
0265:                        return null;
0266:                    return res;
0267:                }
0268:                return super .__rmul__(other);
0269:            }
0270:
0271:            public PyObject __div__(PyObject other) {
0272:                PyType self_type = getType();
0273:                PyObject impl = self_type.lookup("__div__");
0274:                if (impl != null) {
0275:                    PyObject res = impl.__get__(this , self_type)
0276:                            .__call__(other);
0277:                    if (res == Py.NotImplemented)
0278:                        return null;
0279:                    return res;
0280:                }
0281:                return super .__div__(other);
0282:            }
0283:
0284:            public PyObject __rdiv__(PyObject other) {
0285:                PyType self_type = getType();
0286:                PyObject impl = self_type.lookup("__rdiv__");
0287:                if (impl != null) {
0288:                    PyObject res = impl.__get__(this , self_type)
0289:                            .__call__(other);
0290:                    if (res == Py.NotImplemented)
0291:                        return null;
0292:                    return res;
0293:                }
0294:                return super .__rdiv__(other);
0295:            }
0296:
0297:            public PyObject __floordiv__(PyObject other) {
0298:                PyType self_type = getType();
0299:                PyObject impl = self_type.lookup("__floordiv__");
0300:                if (impl != null) {
0301:                    PyObject res = impl.__get__(this , self_type)
0302:                            .__call__(other);
0303:                    if (res == Py.NotImplemented)
0304:                        return null;
0305:                    return res;
0306:                }
0307:                return super .__floordiv__(other);
0308:            }
0309:
0310:            public PyObject __rfloordiv__(PyObject other) {
0311:                PyType self_type = getType();
0312:                PyObject impl = self_type.lookup("__rfloordiv__");
0313:                if (impl != null) {
0314:                    PyObject res = impl.__get__(this , self_type)
0315:                            .__call__(other);
0316:                    if (res == Py.NotImplemented)
0317:                        return null;
0318:                    return res;
0319:                }
0320:                return super .__rfloordiv__(other);
0321:            }
0322:
0323:            public PyObject __truediv__(PyObject other) {
0324:                PyType self_type = getType();
0325:                PyObject impl = self_type.lookup("__truediv__");
0326:                if (impl != null) {
0327:                    PyObject res = impl.__get__(this , self_type)
0328:                            .__call__(other);
0329:                    if (res == Py.NotImplemented)
0330:                        return null;
0331:                    return res;
0332:                }
0333:                return super .__truediv__(other);
0334:            }
0335:
0336:            public PyObject __rtruediv__(PyObject other) {
0337:                PyType self_type = getType();
0338:                PyObject impl = self_type.lookup("__rtruediv__");
0339:                if (impl != null) {
0340:                    PyObject res = impl.__get__(this , self_type)
0341:                            .__call__(other);
0342:                    if (res == Py.NotImplemented)
0343:                        return null;
0344:                    return res;
0345:                }
0346:                return super .__rtruediv__(other);
0347:            }
0348:
0349:            public PyObject __mod__(PyObject other) {
0350:                PyType self_type = getType();
0351:                PyObject impl = self_type.lookup("__mod__");
0352:                if (impl != null) {
0353:                    PyObject res = impl.__get__(this , self_type)
0354:                            .__call__(other);
0355:                    if (res == Py.NotImplemented)
0356:                        return null;
0357:                    return res;
0358:                }
0359:                return super .__mod__(other);
0360:            }
0361:
0362:            public PyObject __rmod__(PyObject other) {
0363:                PyType self_type = getType();
0364:                PyObject impl = self_type.lookup("__rmod__");
0365:                if (impl != null) {
0366:                    PyObject res = impl.__get__(this , self_type)
0367:                            .__call__(other);
0368:                    if (res == Py.NotImplemented)
0369:                        return null;
0370:                    return res;
0371:                }
0372:                return super .__rmod__(other);
0373:            }
0374:
0375:            public PyObject __divmod__(PyObject other) {
0376:                PyType self_type = getType();
0377:                PyObject impl = self_type.lookup("__divmod__");
0378:                if (impl != null) {
0379:                    PyObject res = impl.__get__(this , self_type)
0380:                            .__call__(other);
0381:                    if (res == Py.NotImplemented)
0382:                        return null;
0383:                    return res;
0384:                }
0385:                return super .__divmod__(other);
0386:            }
0387:
0388:            public PyObject __rdivmod__(PyObject other) {
0389:                PyType self_type = getType();
0390:                PyObject impl = self_type.lookup("__rdivmod__");
0391:                if (impl != null) {
0392:                    PyObject res = impl.__get__(this , self_type)
0393:                            .__call__(other);
0394:                    if (res == Py.NotImplemented)
0395:                        return null;
0396:                    return res;
0397:                }
0398:                return super .__rdivmod__(other);
0399:            }
0400:
0401:            public PyObject __pow__(PyObject other) {
0402:                PyType self_type = getType();
0403:                PyObject impl = self_type.lookup("__pow__");
0404:                if (impl != null) {
0405:                    PyObject res = impl.__get__(this , self_type)
0406:                            .__call__(other);
0407:                    if (res == Py.NotImplemented)
0408:                        return null;
0409:                    return res;
0410:                }
0411:                return super .__pow__(other);
0412:            }
0413:
0414:            public PyObject __rpow__(PyObject other) {
0415:                PyType self_type = getType();
0416:                PyObject impl = self_type.lookup("__rpow__");
0417:                if (impl != null) {
0418:                    PyObject res = impl.__get__(this , self_type)
0419:                            .__call__(other);
0420:                    if (res == Py.NotImplemented)
0421:                        return null;
0422:                    return res;
0423:                }
0424:                return super .__rpow__(other);
0425:            }
0426:
0427:            public PyObject __lshift__(PyObject other) {
0428:                PyType self_type = getType();
0429:                PyObject impl = self_type.lookup("__lshift__");
0430:                if (impl != null) {
0431:                    PyObject res = impl.__get__(this , self_type)
0432:                            .__call__(other);
0433:                    if (res == Py.NotImplemented)
0434:                        return null;
0435:                    return res;
0436:                }
0437:                return super .__lshift__(other);
0438:            }
0439:
0440:            public PyObject __rlshift__(PyObject other) {
0441:                PyType self_type = getType();
0442:                PyObject impl = self_type.lookup("__rlshift__");
0443:                if (impl != null) {
0444:                    PyObject res = impl.__get__(this , self_type)
0445:                            .__call__(other);
0446:                    if (res == Py.NotImplemented)
0447:                        return null;
0448:                    return res;
0449:                }
0450:                return super .__rlshift__(other);
0451:            }
0452:
0453:            public PyObject __rshift__(PyObject other) {
0454:                PyType self_type = getType();
0455:                PyObject impl = self_type.lookup("__rshift__");
0456:                if (impl != null) {
0457:                    PyObject res = impl.__get__(this , self_type)
0458:                            .__call__(other);
0459:                    if (res == Py.NotImplemented)
0460:                        return null;
0461:                    return res;
0462:                }
0463:                return super .__rshift__(other);
0464:            }
0465:
0466:            public PyObject __rrshift__(PyObject other) {
0467:                PyType self_type = getType();
0468:                PyObject impl = self_type.lookup("__rrshift__");
0469:                if (impl != null) {
0470:                    PyObject res = impl.__get__(this , self_type)
0471:                            .__call__(other);
0472:                    if (res == Py.NotImplemented)
0473:                        return null;
0474:                    return res;
0475:                }
0476:                return super .__rrshift__(other);
0477:            }
0478:
0479:            public PyObject __and__(PyObject other) {
0480:                PyType self_type = getType();
0481:                PyObject impl = self_type.lookup("__and__");
0482:                if (impl != null) {
0483:                    PyObject res = impl.__get__(this , self_type)
0484:                            .__call__(other);
0485:                    if (res == Py.NotImplemented)
0486:                        return null;
0487:                    return res;
0488:                }
0489:                return super .__and__(other);
0490:            }
0491:
0492:            public PyObject __rand__(PyObject other) {
0493:                PyType self_type = getType();
0494:                PyObject impl = self_type.lookup("__rand__");
0495:                if (impl != null) {
0496:                    PyObject res = impl.__get__(this , self_type)
0497:                            .__call__(other);
0498:                    if (res == Py.NotImplemented)
0499:                        return null;
0500:                    return res;
0501:                }
0502:                return super .__rand__(other);
0503:            }
0504:
0505:            public PyObject __or__(PyObject other) {
0506:                PyType self_type = getType();
0507:                PyObject impl = self_type.lookup("__or__");
0508:                if (impl != null) {
0509:                    PyObject res = impl.__get__(this , self_type)
0510:                            .__call__(other);
0511:                    if (res == Py.NotImplemented)
0512:                        return null;
0513:                    return res;
0514:                }
0515:                return super .__or__(other);
0516:            }
0517:
0518:            public PyObject __ror__(PyObject other) {
0519:                PyType self_type = getType();
0520:                PyObject impl = self_type.lookup("__ror__");
0521:                if (impl != null) {
0522:                    PyObject res = impl.__get__(this , self_type)
0523:                            .__call__(other);
0524:                    if (res == Py.NotImplemented)
0525:                        return null;
0526:                    return res;
0527:                }
0528:                return super .__ror__(other);
0529:            }
0530:
0531:            public PyObject __xor__(PyObject other) {
0532:                PyType self_type = getType();
0533:                PyObject impl = self_type.lookup("__xor__");
0534:                if (impl != null) {
0535:                    PyObject res = impl.__get__(this , self_type)
0536:                            .__call__(other);
0537:                    if (res == Py.NotImplemented)
0538:                        return null;
0539:                    return res;
0540:                }
0541:                return super .__xor__(other);
0542:            }
0543:
0544:            public PyObject __rxor__(PyObject other) {
0545:                PyType self_type = getType();
0546:                PyObject impl = self_type.lookup("__rxor__");
0547:                if (impl != null) {
0548:                    PyObject res = impl.__get__(this , self_type)
0549:                            .__call__(other);
0550:                    if (res == Py.NotImplemented)
0551:                        return null;
0552:                    return res;
0553:                }
0554:                return super .__rxor__(other);
0555:            }
0556:
0557:            public PyObject __lt__(PyObject other) {
0558:                PyType self_type = getType();
0559:                PyObject impl = self_type.lookup("__lt__");
0560:                if (impl != null) {
0561:                    PyObject res = impl.__get__(this , self_type)
0562:                            .__call__(other);
0563:                    if (res == Py.NotImplemented)
0564:                        return null;
0565:                    return res;
0566:                }
0567:                return super .__lt__(other);
0568:            }
0569:
0570:            public PyObject __le__(PyObject other) {
0571:                PyType self_type = getType();
0572:                PyObject impl = self_type.lookup("__le__");
0573:                if (impl != null) {
0574:                    PyObject res = impl.__get__(this , self_type)
0575:                            .__call__(other);
0576:                    if (res == Py.NotImplemented)
0577:                        return null;
0578:                    return res;
0579:                }
0580:                return super .__le__(other);
0581:            }
0582:
0583:            public PyObject __gt__(PyObject other) {
0584:                PyType self_type = getType();
0585:                PyObject impl = self_type.lookup("__gt__");
0586:                if (impl != null) {
0587:                    PyObject res = impl.__get__(this , self_type)
0588:                            .__call__(other);
0589:                    if (res == Py.NotImplemented)
0590:                        return null;
0591:                    return res;
0592:                }
0593:                return super .__gt__(other);
0594:            }
0595:
0596:            public PyObject __ge__(PyObject other) {
0597:                PyType self_type = getType();
0598:                PyObject impl = self_type.lookup("__ge__");
0599:                if (impl != null) {
0600:                    PyObject res = impl.__get__(this , self_type)
0601:                            .__call__(other);
0602:                    if (res == Py.NotImplemented)
0603:                        return null;
0604:                    return res;
0605:                }
0606:                return super .__ge__(other);
0607:            }
0608:
0609:            public PyObject __eq__(PyObject other) {
0610:                PyType self_type = getType();
0611:                PyObject impl = self_type.lookup("__eq__");
0612:                if (impl != null) {
0613:                    PyObject res = impl.__get__(this , self_type)
0614:                            .__call__(other);
0615:                    if (res == Py.NotImplemented)
0616:                        return null;
0617:                    return res;
0618:                }
0619:                return super .__eq__(other);
0620:            }
0621:
0622:            public PyObject __ne__(PyObject other) {
0623:                PyType self_type = getType();
0624:                PyObject impl = self_type.lookup("__ne__");
0625:                if (impl != null) {
0626:                    PyObject res = impl.__get__(this , self_type)
0627:                            .__call__(other);
0628:                    if (res == Py.NotImplemented)
0629:                        return null;
0630:                    return res;
0631:                }
0632:                return super .__ne__(other);
0633:            }
0634:
0635:            public PyObject __iadd__(PyObject other) {
0636:                PyType self_type = getType();
0637:                PyObject impl = self_type.lookup("__iadd__");
0638:                if (impl != null)
0639:                    return impl.__get__(this , self_type).__call__(other);
0640:                return super .__iadd__(other);
0641:            }
0642:
0643:            public PyObject __isub__(PyObject other) {
0644:                PyType self_type = getType();
0645:                PyObject impl = self_type.lookup("__isub__");
0646:                if (impl != null)
0647:                    return impl.__get__(this , self_type).__call__(other);
0648:                return super .__isub__(other);
0649:            }
0650:
0651:            public PyObject __imul__(PyObject other) {
0652:                PyType self_type = getType();
0653:                PyObject impl = self_type.lookup("__imul__");
0654:                if (impl != null)
0655:                    return impl.__get__(this , self_type).__call__(other);
0656:                return super .__imul__(other);
0657:            }
0658:
0659:            public PyObject __idiv__(PyObject other) {
0660:                PyType self_type = getType();
0661:                PyObject impl = self_type.lookup("__idiv__");
0662:                if (impl != null)
0663:                    return impl.__get__(this , self_type).__call__(other);
0664:                return super .__idiv__(other);
0665:            }
0666:
0667:            public PyObject __ifloordiv__(PyObject other) {
0668:                PyType self_type = getType();
0669:                PyObject impl = self_type.lookup("__ifloordiv__");
0670:                if (impl != null)
0671:                    return impl.__get__(this , self_type).__call__(other);
0672:                return super .__ifloordiv__(other);
0673:            }
0674:
0675:            public PyObject __itruediv__(PyObject other) {
0676:                PyType self_type = getType();
0677:                PyObject impl = self_type.lookup("__itruediv__");
0678:                if (impl != null)
0679:                    return impl.__get__(this , self_type).__call__(other);
0680:                return super .__itruediv__(other);
0681:            }
0682:
0683:            public PyObject __imod__(PyObject other) {
0684:                PyType self_type = getType();
0685:                PyObject impl = self_type.lookup("__imod__");
0686:                if (impl != null)
0687:                    return impl.__get__(this , self_type).__call__(other);
0688:                return super .__imod__(other);
0689:            }
0690:
0691:            public PyObject __ipow__(PyObject other) {
0692:                PyType self_type = getType();
0693:                PyObject impl = self_type.lookup("__ipow__");
0694:                if (impl != null)
0695:                    return impl.__get__(this , self_type).__call__(other);
0696:                return super .__ipow__(other);
0697:            }
0698:
0699:            public PyObject __ilshift__(PyObject other) {
0700:                PyType self_type = getType();
0701:                PyObject impl = self_type.lookup("__ilshift__");
0702:                if (impl != null)
0703:                    return impl.__get__(this , self_type).__call__(other);
0704:                return super .__ilshift__(other);
0705:            }
0706:
0707:            public PyObject __irshift__(PyObject other) {
0708:                PyType self_type = getType();
0709:                PyObject impl = self_type.lookup("__irshift__");
0710:                if (impl != null)
0711:                    return impl.__get__(this , self_type).__call__(other);
0712:                return super .__irshift__(other);
0713:            }
0714:
0715:            public PyObject __iand__(PyObject other) {
0716:                PyType self_type = getType();
0717:                PyObject impl = self_type.lookup("__iand__");
0718:                if (impl != null)
0719:                    return impl.__get__(this , self_type).__call__(other);
0720:                return super .__iand__(other);
0721:            }
0722:
0723:            public PyObject __ior__(PyObject other) {
0724:                PyType self_type = getType();
0725:                PyObject impl = self_type.lookup("__ior__");
0726:                if (impl != null)
0727:                    return impl.__get__(this , self_type).__call__(other);
0728:                return super .__ior__(other);
0729:            }
0730:
0731:            public PyObject __ixor__(PyObject other) {
0732:                PyType self_type = getType();
0733:                PyObject impl = self_type.lookup("__ixor__");
0734:                if (impl != null)
0735:                    return impl.__get__(this , self_type).__call__(other);
0736:                return super .__ixor__(other);
0737:            }
0738:
0739:            public PyObject __int__() {
0740:                PyType self_type = getType();
0741:                PyObject impl = self_type.lookup("__int__");
0742:                if (impl != null) {
0743:                    PyObject res = impl.__get__(this , self_type).__call__();
0744:                    if (res instanceof  PyInteger || res instanceof  PyLong)
0745:                        return (PyObject) res;
0746:                    throw Py.TypeError("__int__" + " should return an integer");
0747:                }
0748:                return super .__int__();
0749:            }
0750:
0751:            public String toString() {
0752:                PyType self_type = getType();
0753:                PyObject impl = self_type.lookup("__repr__");
0754:                if (impl != null) {
0755:                    PyObject res = impl.__get__(this , self_type).__call__();
0756:                    if (!(res instanceof  PyString))
0757:                        throw Py.TypeError("__repr__ should return a string");
0758:                    return ((PyString) res).toString();
0759:                }
0760:                return super .toString();
0761:            }
0762:
0763:            public int hashCode() {
0764:                PyType self_type = getType();
0765:                PyObject impl = self_type.lookup("__hash__");
0766:                if (impl != null) {
0767:                    PyObject res = impl.__get__(this , self_type).__call__();
0768:                    if (res instanceof  PyInteger)
0769:                        return ((PyInteger) res).getValue();
0770:                    throw Py.TypeError("__hash__ should return a int");
0771:                }
0772:                if (self_type.lookup("__eq__") != null
0773:                        || self_type.lookup("__cmp__") != null)
0774:                    throw Py.TypeError("unhashable type");
0775:                return super .hashCode();
0776:            }
0777:
0778:            public PyUnicode __unicode__() {
0779:                PyType self_type = getType();
0780:                PyObject impl = self_type.lookup("__unicode__");
0781:                if (impl != null) {
0782:                    PyObject res = impl.__get__(this , self_type).__call__();
0783:                    if (res instanceof  PyUnicode)
0784:                        return (PyUnicode) res;
0785:                    if (res instanceof  PyString)
0786:                        return new PyUnicode((PyString) res);
0787:                    throw Py.TypeError("__unicode__" + " should return a "
0788:                            + "unicode");
0789:                }
0790:                return super .__unicode__();
0791:            }
0792:
0793:            public int __cmp__(PyObject other) {
0794:                PyType self_type = getType();
0795:                PyObject impl = self_type.lookup("__cmp__");
0796:                if (impl != null) {
0797:                    PyObject res = impl.__get__(this , self_type)
0798:                            .__call__(other);
0799:                    if (res instanceof  PyInteger) {
0800:                        int v = ((PyInteger) res).getValue();
0801:                        return v < 0 ? -1 : v > 0 ? 1 : 0;
0802:                    }
0803:                    throw Py.TypeError("__cmp__ should return a int");
0804:                }
0805:                return super .__cmp__(other);
0806:            }
0807:
0808:            public boolean __nonzero__() {
0809:                PyType self_type = getType();
0810:                PyObject impl = self_type.lookup("__nonzero__");
0811:                if (impl == null) {
0812:                    impl = self_type.lookup("__len__");
0813:                    if (impl == null)
0814:                        return super .__nonzero__();
0815:                }
0816:                return impl.__get__(this , self_type).__call__().__nonzero__();
0817:            }
0818:
0819:            public boolean __contains__(PyObject o) {
0820:                PyType self_type = getType();
0821:                PyObject impl = self_type.lookup("__contains__");
0822:                if (impl == null)
0823:                    return super .__contains__(o);
0824:                return impl.__get__(this , self_type).__call__(o).__nonzero__();
0825:            }
0826:
0827:            public int __len__() {
0828:                PyType self_type = getType();
0829:                PyObject impl = self_type.lookup("__len__");
0830:                if (impl != null) {
0831:                    PyObject res = impl.__get__(this , self_type).__call__();
0832:                    if (res instanceof  PyInteger)
0833:                        return ((PyInteger) res).getValue();
0834:                    throw Py.TypeError("__len__ should return a int");
0835:                }
0836:                return super .__len__();
0837:            }
0838:
0839:            public PyObject __iter__() {
0840:                PyType self_type = getType();
0841:                PyObject impl = self_type.lookup("__iter__");
0842:                if (impl != null)
0843:                    return impl.__get__(this , self_type).__call__();
0844:                impl = self_type.lookup("__getitem__");
0845:                if (impl == null)
0846:                    return super .__iter__();
0847:                return new PySequenceIter(this );
0848:            }
0849:
0850:            public PyObject __iternext__() {
0851:                PyType self_type = getType();
0852:                PyObject impl = self_type.lookup("next");
0853:                if (impl != null) {
0854:                    try {
0855:                        return impl.__get__(this , self_type).__call__();
0856:                    } catch (PyException exc) {
0857:                        if (Py.matchException(exc, Py.StopIteration))
0858:                            return null;
0859:                        throw exc;
0860:                    }
0861:                }
0862:                return super .__iternext__(); // ???
0863:            }
0864:
0865:            public PyObject __finditem__(PyObject key) { // ???
0866:                PyType self_type = getType();
0867:                PyObject impl = self_type.lookup("__getitem__");
0868:                if (impl != null)
0869:                    try {
0870:                        return impl.__get__(this , self_type).__call__(key);
0871:                    } catch (PyException exc) {
0872:                        if (Py.matchException(exc, Py.LookupError))
0873:                            return null;
0874:                        throw exc;
0875:                    }
0876:                return super .__finditem__(key);
0877:            }
0878:
0879:            public void __setitem__(PyObject key, PyObject value) { // ???
0880:                PyType self_type = getType();
0881:                PyObject impl = self_type.lookup("__setitem__");
0882:                if (impl != null) {
0883:                    impl.__get__(this , self_type).__call__(key, value);
0884:                    return;
0885:                }
0886:                super .__setitem__(key, value);
0887:            }
0888:
0889:            public PyObject __getslice__(PyObject start, PyObject stop,
0890:                    PyObject step) { // ???
0891:                PyType self_type = getType();
0892:                PyObject impl = self_type.lookup("__getslice__");
0893:                if (impl != null)
0894:                    try {
0895:                        return impl.__get__(this , self_type).__call__(start,
0896:                                stop);
0897:                    } catch (PyException exc) {
0898:                        if (Py.matchException(exc, Py.LookupError))
0899:                            return null;
0900:                        throw exc;
0901:                    }
0902:                return super .__getslice__(start, stop, step);
0903:            }
0904:
0905:            public void __delitem__(PyObject key) { // ???
0906:                PyType self_type = getType();
0907:                PyObject impl = self_type.lookup("__delitem__");
0908:                if (impl != null) {
0909:                    impl.__get__(this , self_type).__call__(key);
0910:                    return;
0911:                }
0912:                super .__delitem__(key);
0913:            }
0914:
0915:            public PyObject __call__(PyObject args[], String keywords[]) {
0916:                ThreadState ts = Py.getThreadState();
0917:                if (ts.recursion_depth++ > ts.systemState.getrecursionlimit())
0918:                    throw Py
0919:                            .RuntimeError("maximum __call__ recursion depth exceeded");
0920:                try {
0921:                    PyType self_type = getType();
0922:                    PyObject impl = self_type.lookup("__call__");
0923:                    if (impl != null)
0924:                        return impl.__get__(this , self_type).__call__(args,
0925:                                keywords);
0926:                    return super .__call__(args, keywords);
0927:                } finally {
0928:                    --ts.recursion_depth;
0929:                }
0930:            }
0931:
0932:            public PyObject __findattr__(String name) {
0933:                PyType self_type = getType();
0934:                PyObject getattribute = self_type.lookup("__getattribute__");
0935:                PyString py_name = null;
0936:                try {
0937:                    if (getattribute != null) {
0938:                        return getattribute.__get__(this , self_type).__call__(
0939:                                py_name = new PyString(name));
0940:                    } else {
0941:                        return super .__findattr__(name);
0942:                    }
0943:                } catch (PyException e) {
0944:                    if (Py.matchException(e, Py.AttributeError)) {
0945:                        PyObject getattr = self_type.lookup("__getattr__");
0946:                        if (getattr != null)
0947:                            try {
0948:                                return getattr.__get__(this , self_type)
0949:                                        .__call__(
0950:                                                py_name != null ? py_name
0951:                                                        : new PyString(name));
0952:                            } catch (PyException e1) {
0953:                                if (!Py.matchException(e1, Py.AttributeError))
0954:                                    throw e1;
0955:                            }
0956:                        return null;
0957:                    }
0958:                    throw e;
0959:                }
0960:            }
0961:
0962:            public void __setattr__(String name, PyObject value) {
0963:                PyType self_type = getType();
0964:                PyObject impl = self_type.lookup("__setattr__");
0965:                if (impl != null) {
0966:                    impl.__get__(this , self_type).__call__(new PyString(name),
0967:                            value);
0968:                    return;
0969:                }
0970:                super .__setattr__(name, value);
0971:            }
0972:
0973:            public void __delattr__(String name) {
0974:                PyType self_type = getType();
0975:                PyObject impl = self_type.lookup("__delattr__");
0976:                if (impl != null) {
0977:                    impl.__get__(this , self_type).__call__(new PyString(name));
0978:                    return;
0979:                }
0980:                super .__delattr__(name);
0981:            }
0982:
0983:            public PyObject __get__(PyObject obj, PyObject type) {
0984:                PyType self_type = getType();
0985:                PyObject impl = self_type.lookup("__get__");
0986:                if (impl != null) {
0987:                    if (obj == null)
0988:                        obj = Py.None;
0989:                    if (type == null)
0990:                        type = Py.None;
0991:                    return impl.__get__(this , self_type).__call__(obj, type);
0992:                }
0993:                return super .__get__(obj, type);
0994:            }
0995:
0996:            public void __set__(PyObject obj, PyObject value) {
0997:                PyType self_type = getType();
0998:                PyObject impl = self_type.lookup("__set__");
0999:                if (impl != null) {
1000:                    impl.__get__(this , self_type).__call__(obj, value);
1001:                    return;
1002:                }
1003:                super .__set__(obj, value);
1004:            }
1005:
1006:            public void __delete__(PyObject obj) {
1007:                PyType self_type = getType();
1008:                PyObject impl = self_type.lookup("__delete__");
1009:                if (impl != null) {
1010:                    impl.__get__(this , self_type).__call__(obj);
1011:                    return;
1012:                }
1013:                super .__delete__(obj);
1014:            }
1015:
1016:            public void dispatch__init__(PyType type, PyObject[] args,
1017:                    String[] keywords) {
1018:                PyType self_type = getType();
1019:                if (self_type.isSubType(type)) {
1020:                    PyObject impl = self_type.lookup("__init__");
1021:                    if (impl != null)
1022:                        impl.__get__(this, self_type).__call__(args, keywords);
1023:                }
1024:            }
1025:
1026:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.