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


0001:        // Copyright (c) Corporation for National Research Initiatives
0002:        package org.python.core;
0003:
0004:        import java.io.Serializable;
0005:
0006:        /**
0007:         * A builtin python int.
0008:         */
0009:        public class PyInteger extends PyObject {
0010:            //~ BEGIN GENERATED REGION -- DO NOT EDIT SEE gexpose.py
0011:            /* type info */
0012:
0013:            public static final String exposed_name = "int";
0014:
0015:            public static void typeSetup(PyObject dict, PyType.Newstyle marker) {
0016:                class exposed___abs__ extends PyBuiltinMethodNarrow {
0017:
0018:                    exposed___abs__(PyObject self, PyBuiltinFunction.Info info) {
0019:                        super (self, info);
0020:                    }
0021:
0022:                    public PyBuiltinFunction bind(PyObject self) {
0023:                        return new exposed___abs__(self, info);
0024:                    }
0025:
0026:                    public PyObject __call__() {
0027:                        return ((PyInteger) self).int___abs__();
0028:                    }
0029:
0030:                }
0031:                dict
0032:                        .__setitem__("__abs__", new PyMethodDescr("__abs__",
0033:                                PyInteger.class, 0, 0, new exposed___abs__(
0034:                                        null, null)));
0035:                class exposed___float__ extends PyBuiltinMethodNarrow {
0036:
0037:                    exposed___float__(PyObject self, PyBuiltinFunction.Info info) {
0038:                        super (self, info);
0039:                    }
0040:
0041:                    public PyBuiltinFunction bind(PyObject self) {
0042:                        return new exposed___float__(self, info);
0043:                    }
0044:
0045:                    public PyObject __call__() {
0046:                        return ((PyInteger) self).int___float__();
0047:                    }
0048:
0049:                }
0050:                dict.__setitem__("__float__", new PyMethodDescr("__float__",
0051:                        PyInteger.class, 0, 0,
0052:                        new exposed___float__(null, null)));
0053:                class exposed___hex__ extends PyBuiltinMethodNarrow {
0054:
0055:                    exposed___hex__(PyObject self, PyBuiltinFunction.Info info) {
0056:                        super (self, info);
0057:                    }
0058:
0059:                    public PyBuiltinFunction bind(PyObject self) {
0060:                        return new exposed___hex__(self, info);
0061:                    }
0062:
0063:                    public PyObject __call__() {
0064:                        return ((PyInteger) self).int___hex__();
0065:                    }
0066:
0067:                }
0068:                dict
0069:                        .__setitem__("__hex__", new PyMethodDescr("__hex__",
0070:                                PyInteger.class, 0, 0, new exposed___hex__(
0071:                                        null, null)));
0072:                class exposed___int__ extends PyBuiltinMethodNarrow {
0073:
0074:                    exposed___int__(PyObject self, PyBuiltinFunction.Info info) {
0075:                        super (self, info);
0076:                    }
0077:
0078:                    public PyBuiltinFunction bind(PyObject self) {
0079:                        return new exposed___int__(self, info);
0080:                    }
0081:
0082:                    public PyObject __call__() {
0083:                        return ((PyInteger) self).int___int__();
0084:                    }
0085:
0086:                }
0087:                dict
0088:                        .__setitem__("__int__", new PyMethodDescr("__int__",
0089:                                PyInteger.class, 0, 0, new exposed___int__(
0090:                                        null, null)));
0091:                class exposed___invert__ extends PyBuiltinMethodNarrow {
0092:
0093:                    exposed___invert__(PyObject self,
0094:                            PyBuiltinFunction.Info info) {
0095:                        super (self, info);
0096:                    }
0097:
0098:                    public PyBuiltinFunction bind(PyObject self) {
0099:                        return new exposed___invert__(self, info);
0100:                    }
0101:
0102:                    public PyObject __call__() {
0103:                        return ((PyInteger) self).int___invert__();
0104:                    }
0105:
0106:                }
0107:                dict.__setitem__("__invert__", new PyMethodDescr("__invert__",
0108:                        PyInteger.class, 0, 0, new exposed___invert__(null,
0109:                                null)));
0110:                class exposed___long__ extends PyBuiltinMethodNarrow {
0111:
0112:                    exposed___long__(PyObject self, PyBuiltinFunction.Info info) {
0113:                        super (self, info);
0114:                    }
0115:
0116:                    public PyBuiltinFunction bind(PyObject self) {
0117:                        return new exposed___long__(self, info);
0118:                    }
0119:
0120:                    public PyObject __call__() {
0121:                        return ((PyInteger) self).int___long__();
0122:                    }
0123:
0124:                }
0125:                dict.__setitem__("__long__",
0126:                        new PyMethodDescr("__long__", PyInteger.class, 0, 0,
0127:                                new exposed___long__(null, null)));
0128:                class exposed___neg__ extends PyBuiltinMethodNarrow {
0129:
0130:                    exposed___neg__(PyObject self, PyBuiltinFunction.Info info) {
0131:                        super (self, info);
0132:                    }
0133:
0134:                    public PyBuiltinFunction bind(PyObject self) {
0135:                        return new exposed___neg__(self, info);
0136:                    }
0137:
0138:                    public PyObject __call__() {
0139:                        return ((PyInteger) self).int___neg__();
0140:                    }
0141:
0142:                }
0143:                dict
0144:                        .__setitem__("__neg__", new PyMethodDescr("__neg__",
0145:                                PyInteger.class, 0, 0, new exposed___neg__(
0146:                                        null, null)));
0147:                class exposed___oct__ extends PyBuiltinMethodNarrow {
0148:
0149:                    exposed___oct__(PyObject self, PyBuiltinFunction.Info info) {
0150:                        super (self, info);
0151:                    }
0152:
0153:                    public PyBuiltinFunction bind(PyObject self) {
0154:                        return new exposed___oct__(self, info);
0155:                    }
0156:
0157:                    public PyObject __call__() {
0158:                        return ((PyInteger) self).int___oct__();
0159:                    }
0160:
0161:                }
0162:                dict
0163:                        .__setitem__("__oct__", new PyMethodDescr("__oct__",
0164:                                PyInteger.class, 0, 0, new exposed___oct__(
0165:                                        null, null)));
0166:                class exposed___pos__ extends PyBuiltinMethodNarrow {
0167:
0168:                    exposed___pos__(PyObject self, PyBuiltinFunction.Info info) {
0169:                        super (self, info);
0170:                    }
0171:
0172:                    public PyBuiltinFunction bind(PyObject self) {
0173:                        return new exposed___pos__(self, info);
0174:                    }
0175:
0176:                    public PyObject __call__() {
0177:                        return ((PyInteger) self).int___pos__();
0178:                    }
0179:
0180:                }
0181:                dict
0182:                        .__setitem__("__pos__", new PyMethodDescr("__pos__",
0183:                                PyInteger.class, 0, 0, new exposed___pos__(
0184:                                        null, null)));
0185:                class exposed___add__ extends PyBuiltinMethodNarrow {
0186:
0187:                    exposed___add__(PyObject self, PyBuiltinFunction.Info info) {
0188:                        super (self, info);
0189:                    }
0190:
0191:                    public PyBuiltinFunction bind(PyObject self) {
0192:                        return new exposed___add__(self, info);
0193:                    }
0194:
0195:                    public PyObject __call__(PyObject arg0) {
0196:                        PyObject ret = ((PyInteger) self).int___add__(arg0);
0197:                        if (ret == null)
0198:                            return Py.NotImplemented;
0199:                        return ret;
0200:                    }
0201:
0202:                }
0203:                dict
0204:                        .__setitem__("__add__", new PyMethodDescr("__add__",
0205:                                PyInteger.class, 1, 1, new exposed___add__(
0206:                                        null, null)));
0207:                class exposed___and__ extends PyBuiltinMethodNarrow {
0208:
0209:                    exposed___and__(PyObject self, PyBuiltinFunction.Info info) {
0210:                        super (self, info);
0211:                    }
0212:
0213:                    public PyBuiltinFunction bind(PyObject self) {
0214:                        return new exposed___and__(self, info);
0215:                    }
0216:
0217:                    public PyObject __call__(PyObject arg0) {
0218:                        PyObject ret = ((PyInteger) self).int___and__(arg0);
0219:                        if (ret == null)
0220:                            return Py.NotImplemented;
0221:                        return ret;
0222:                    }
0223:
0224:                }
0225:                dict
0226:                        .__setitem__("__and__", new PyMethodDescr("__and__",
0227:                                PyInteger.class, 1, 1, new exposed___and__(
0228:                                        null, null)));
0229:                class exposed___div__ extends PyBuiltinMethodNarrow {
0230:
0231:                    exposed___div__(PyObject self, PyBuiltinFunction.Info info) {
0232:                        super (self, info);
0233:                    }
0234:
0235:                    public PyBuiltinFunction bind(PyObject self) {
0236:                        return new exposed___div__(self, info);
0237:                    }
0238:
0239:                    public PyObject __call__(PyObject arg0) {
0240:                        PyObject ret = ((PyInteger) self).int___div__(arg0);
0241:                        if (ret == null)
0242:                            return Py.NotImplemented;
0243:                        return ret;
0244:                    }
0245:
0246:                }
0247:                dict
0248:                        .__setitem__("__div__", new PyMethodDescr("__div__",
0249:                                PyInteger.class, 1, 1, new exposed___div__(
0250:                                        null, null)));
0251:                class exposed___divmod__ extends PyBuiltinMethodNarrow {
0252:
0253:                    exposed___divmod__(PyObject self,
0254:                            PyBuiltinFunction.Info info) {
0255:                        super (self, info);
0256:                    }
0257:
0258:                    public PyBuiltinFunction bind(PyObject self) {
0259:                        return new exposed___divmod__(self, info);
0260:                    }
0261:
0262:                    public PyObject __call__(PyObject arg0) {
0263:                        PyObject ret = ((PyInteger) self).int___divmod__(arg0);
0264:                        if (ret == null)
0265:                            return Py.NotImplemented;
0266:                        return ret;
0267:                    }
0268:
0269:                }
0270:                dict.__setitem__("__divmod__", new PyMethodDescr("__divmod__",
0271:                        PyInteger.class, 1, 1, new exposed___divmod__(null,
0272:                                null)));
0273:                class exposed___floordiv__ extends PyBuiltinMethodNarrow {
0274:
0275:                    exposed___floordiv__(PyObject self,
0276:                            PyBuiltinFunction.Info info) {
0277:                        super (self, info);
0278:                    }
0279:
0280:                    public PyBuiltinFunction bind(PyObject self) {
0281:                        return new exposed___floordiv__(self, info);
0282:                    }
0283:
0284:                    public PyObject __call__(PyObject arg0) {
0285:                        PyObject ret = ((PyInteger) self)
0286:                                .int___floordiv__(arg0);
0287:                        if (ret == null)
0288:                            return Py.NotImplemented;
0289:                        return ret;
0290:                    }
0291:
0292:                }
0293:                dict.__setitem__("__floordiv__", new PyMethodDescr(
0294:                        "__floordiv__", PyInteger.class, 1, 1,
0295:                        new exposed___floordiv__(null, null)));
0296:                class exposed___lshift__ extends PyBuiltinMethodNarrow {
0297:
0298:                    exposed___lshift__(PyObject self,
0299:                            PyBuiltinFunction.Info info) {
0300:                        super (self, info);
0301:                    }
0302:
0303:                    public PyBuiltinFunction bind(PyObject self) {
0304:                        return new exposed___lshift__(self, info);
0305:                    }
0306:
0307:                    public PyObject __call__(PyObject arg0) {
0308:                        PyObject ret = ((PyInteger) self).int___lshift__(arg0);
0309:                        if (ret == null)
0310:                            return Py.NotImplemented;
0311:                        return ret;
0312:                    }
0313:
0314:                }
0315:                dict.__setitem__("__lshift__", new PyMethodDescr("__lshift__",
0316:                        PyInteger.class, 1, 1, new exposed___lshift__(null,
0317:                                null)));
0318:                class exposed___mod__ extends PyBuiltinMethodNarrow {
0319:
0320:                    exposed___mod__(PyObject self, PyBuiltinFunction.Info info) {
0321:                        super (self, info);
0322:                    }
0323:
0324:                    public PyBuiltinFunction bind(PyObject self) {
0325:                        return new exposed___mod__(self, info);
0326:                    }
0327:
0328:                    public PyObject __call__(PyObject arg0) {
0329:                        PyObject ret = ((PyInteger) self).int___mod__(arg0);
0330:                        if (ret == null)
0331:                            return Py.NotImplemented;
0332:                        return ret;
0333:                    }
0334:
0335:                }
0336:                dict
0337:                        .__setitem__("__mod__", new PyMethodDescr("__mod__",
0338:                                PyInteger.class, 1, 1, new exposed___mod__(
0339:                                        null, null)));
0340:                class exposed___mul__ extends PyBuiltinMethodNarrow {
0341:
0342:                    exposed___mul__(PyObject self, PyBuiltinFunction.Info info) {
0343:                        super (self, info);
0344:                    }
0345:
0346:                    public PyBuiltinFunction bind(PyObject self) {
0347:                        return new exposed___mul__(self, info);
0348:                    }
0349:
0350:                    public PyObject __call__(PyObject arg0) {
0351:                        PyObject ret = ((PyInteger) self).int___mul__(arg0);
0352:                        if (ret == null)
0353:                            return Py.NotImplemented;
0354:                        return ret;
0355:                    }
0356:
0357:                }
0358:                dict
0359:                        .__setitem__("__mul__", new PyMethodDescr("__mul__",
0360:                                PyInteger.class, 1, 1, new exposed___mul__(
0361:                                        null, null)));
0362:                class exposed___or__ extends PyBuiltinMethodNarrow {
0363:
0364:                    exposed___or__(PyObject self, PyBuiltinFunction.Info info) {
0365:                        super (self, info);
0366:                    }
0367:
0368:                    public PyBuiltinFunction bind(PyObject self) {
0369:                        return new exposed___or__(self, info);
0370:                    }
0371:
0372:                    public PyObject __call__(PyObject arg0) {
0373:                        PyObject ret = ((PyInteger) self).int___or__(arg0);
0374:                        if (ret == null)
0375:                            return Py.NotImplemented;
0376:                        return ret;
0377:                    }
0378:
0379:                }
0380:                dict.__setitem__("__or__", new PyMethodDescr("__or__",
0381:                        PyInteger.class, 1, 1, new exposed___or__(null, null)));
0382:                class exposed___radd__ extends PyBuiltinMethodNarrow {
0383:
0384:                    exposed___radd__(PyObject self, PyBuiltinFunction.Info info) {
0385:                        super (self, info);
0386:                    }
0387:
0388:                    public PyBuiltinFunction bind(PyObject self) {
0389:                        return new exposed___radd__(self, info);
0390:                    }
0391:
0392:                    public PyObject __call__(PyObject arg0) {
0393:                        PyObject ret = ((PyInteger) self).int___radd__(arg0);
0394:                        if (ret == null)
0395:                            return Py.NotImplemented;
0396:                        return ret;
0397:                    }
0398:
0399:                }
0400:                dict.__setitem__("__radd__",
0401:                        new PyMethodDescr("__radd__", PyInteger.class, 1, 1,
0402:                                new exposed___radd__(null, null)));
0403:                class exposed___rdiv__ extends PyBuiltinMethodNarrow {
0404:
0405:                    exposed___rdiv__(PyObject self, PyBuiltinFunction.Info info) {
0406:                        super (self, info);
0407:                    }
0408:
0409:                    public PyBuiltinFunction bind(PyObject self) {
0410:                        return new exposed___rdiv__(self, info);
0411:                    }
0412:
0413:                    public PyObject __call__(PyObject arg0) {
0414:                        PyObject ret = ((PyInteger) self).int___rdiv__(arg0);
0415:                        if (ret == null)
0416:                            return Py.NotImplemented;
0417:                        return ret;
0418:                    }
0419:
0420:                }
0421:                dict.__setitem__("__rdiv__",
0422:                        new PyMethodDescr("__rdiv__", PyInteger.class, 1, 1,
0423:                                new exposed___rdiv__(null, null)));
0424:                class exposed___rfloordiv__ extends PyBuiltinMethodNarrow {
0425:
0426:                    exposed___rfloordiv__(PyObject self,
0427:                            PyBuiltinFunction.Info info) {
0428:                        super (self, info);
0429:                    }
0430:
0431:                    public PyBuiltinFunction bind(PyObject self) {
0432:                        return new exposed___rfloordiv__(self, info);
0433:                    }
0434:
0435:                    public PyObject __call__(PyObject arg0) {
0436:                        PyObject ret = ((PyInteger) self)
0437:                                .int___rfloordiv__(arg0);
0438:                        if (ret == null)
0439:                            return Py.NotImplemented;
0440:                        return ret;
0441:                    }
0442:
0443:                }
0444:                dict.__setitem__("__rfloordiv__", new PyMethodDescr(
0445:                        "__rfloordiv__", PyInteger.class, 1, 1,
0446:                        new exposed___rfloordiv__(null, null)));
0447:                class exposed___rmod__ extends PyBuiltinMethodNarrow {
0448:
0449:                    exposed___rmod__(PyObject self, PyBuiltinFunction.Info info) {
0450:                        super (self, info);
0451:                    }
0452:
0453:                    public PyBuiltinFunction bind(PyObject self) {
0454:                        return new exposed___rmod__(self, info);
0455:                    }
0456:
0457:                    public PyObject __call__(PyObject arg0) {
0458:                        PyObject ret = ((PyInteger) self).int___rmod__(arg0);
0459:                        if (ret == null)
0460:                            return Py.NotImplemented;
0461:                        return ret;
0462:                    }
0463:
0464:                }
0465:                dict.__setitem__("__rmod__",
0466:                        new PyMethodDescr("__rmod__", PyInteger.class, 1, 1,
0467:                                new exposed___rmod__(null, null)));
0468:                class exposed___rmul__ extends PyBuiltinMethodNarrow {
0469:
0470:                    exposed___rmul__(PyObject self, PyBuiltinFunction.Info info) {
0471:                        super (self, info);
0472:                    }
0473:
0474:                    public PyBuiltinFunction bind(PyObject self) {
0475:                        return new exposed___rmul__(self, info);
0476:                    }
0477:
0478:                    public PyObject __call__(PyObject arg0) {
0479:                        PyObject ret = ((PyInteger) self).int___rmul__(arg0);
0480:                        if (ret == null)
0481:                            return Py.NotImplemented;
0482:                        return ret;
0483:                    }
0484:
0485:                }
0486:                dict.__setitem__("__rmul__",
0487:                        new PyMethodDescr("__rmul__", PyInteger.class, 1, 1,
0488:                                new exposed___rmul__(null, null)));
0489:                class exposed___rshift__ extends PyBuiltinMethodNarrow {
0490:
0491:                    exposed___rshift__(PyObject self,
0492:                            PyBuiltinFunction.Info info) {
0493:                        super (self, info);
0494:                    }
0495:
0496:                    public PyBuiltinFunction bind(PyObject self) {
0497:                        return new exposed___rshift__(self, info);
0498:                    }
0499:
0500:                    public PyObject __call__(PyObject arg0) {
0501:                        PyObject ret = ((PyInteger) self).int___rshift__(arg0);
0502:                        if (ret == null)
0503:                            return Py.NotImplemented;
0504:                        return ret;
0505:                    }
0506:
0507:                }
0508:                dict.__setitem__("__rshift__", new PyMethodDescr("__rshift__",
0509:                        PyInteger.class, 1, 1, new exposed___rshift__(null,
0510:                                null)));
0511:                class exposed___rsub__ extends PyBuiltinMethodNarrow {
0512:
0513:                    exposed___rsub__(PyObject self, PyBuiltinFunction.Info info) {
0514:                        super (self, info);
0515:                    }
0516:
0517:                    public PyBuiltinFunction bind(PyObject self) {
0518:                        return new exposed___rsub__(self, info);
0519:                    }
0520:
0521:                    public PyObject __call__(PyObject arg0) {
0522:                        PyObject ret = ((PyInteger) self).int___rsub__(arg0);
0523:                        if (ret == null)
0524:                            return Py.NotImplemented;
0525:                        return ret;
0526:                    }
0527:
0528:                }
0529:                dict.__setitem__("__rsub__",
0530:                        new PyMethodDescr("__rsub__", PyInteger.class, 1, 1,
0531:                                new exposed___rsub__(null, null)));
0532:                class exposed___rtruediv__ extends PyBuiltinMethodNarrow {
0533:
0534:                    exposed___rtruediv__(PyObject self,
0535:                            PyBuiltinFunction.Info info) {
0536:                        super (self, info);
0537:                    }
0538:
0539:                    public PyBuiltinFunction bind(PyObject self) {
0540:                        return new exposed___rtruediv__(self, info);
0541:                    }
0542:
0543:                    public PyObject __call__(PyObject arg0) {
0544:                        PyObject ret = ((PyInteger) self)
0545:                                .int___rtruediv__(arg0);
0546:                        if (ret == null)
0547:                            return Py.NotImplemented;
0548:                        return ret;
0549:                    }
0550:
0551:                }
0552:                dict.__setitem__("__rtruediv__", new PyMethodDescr(
0553:                        "__rtruediv__", PyInteger.class, 1, 1,
0554:                        new exposed___rtruediv__(null, null)));
0555:                class exposed___sub__ extends PyBuiltinMethodNarrow {
0556:
0557:                    exposed___sub__(PyObject self, PyBuiltinFunction.Info info) {
0558:                        super (self, info);
0559:                    }
0560:
0561:                    public PyBuiltinFunction bind(PyObject self) {
0562:                        return new exposed___sub__(self, info);
0563:                    }
0564:
0565:                    public PyObject __call__(PyObject arg0) {
0566:                        PyObject ret = ((PyInteger) self).int___sub__(arg0);
0567:                        if (ret == null)
0568:                            return Py.NotImplemented;
0569:                        return ret;
0570:                    }
0571:
0572:                }
0573:                dict
0574:                        .__setitem__("__sub__", new PyMethodDescr("__sub__",
0575:                                PyInteger.class, 1, 1, new exposed___sub__(
0576:                                        null, null)));
0577:                class exposed___truediv__ extends PyBuiltinMethodNarrow {
0578:
0579:                    exposed___truediv__(PyObject self,
0580:                            PyBuiltinFunction.Info info) {
0581:                        super (self, info);
0582:                    }
0583:
0584:                    public PyBuiltinFunction bind(PyObject self) {
0585:                        return new exposed___truediv__(self, info);
0586:                    }
0587:
0588:                    public PyObject __call__(PyObject arg0) {
0589:                        PyObject ret = ((PyInteger) self).int___truediv__(arg0);
0590:                        if (ret == null)
0591:                            return Py.NotImplemented;
0592:                        return ret;
0593:                    }
0594:
0595:                }
0596:                dict.__setitem__("__truediv__", new PyMethodDescr(
0597:                        "__truediv__", PyInteger.class, 1, 1,
0598:                        new exposed___truediv__(null, null)));
0599:                class exposed___xor__ extends PyBuiltinMethodNarrow {
0600:
0601:                    exposed___xor__(PyObject self, PyBuiltinFunction.Info info) {
0602:                        super (self, info);
0603:                    }
0604:
0605:                    public PyBuiltinFunction bind(PyObject self) {
0606:                        return new exposed___xor__(self, info);
0607:                    }
0608:
0609:                    public PyObject __call__(PyObject arg0) {
0610:                        PyObject ret = ((PyInteger) self).int___xor__(arg0);
0611:                        if (ret == null)
0612:                            return Py.NotImplemented;
0613:                        return ret;
0614:                    }
0615:
0616:                }
0617:                dict
0618:                        .__setitem__("__xor__", new PyMethodDescr("__xor__",
0619:                                PyInteger.class, 1, 1, new exposed___xor__(
0620:                                        null, null)));
0621:                class exposed___rxor__ extends PyBuiltinMethodNarrow {
0622:
0623:                    exposed___rxor__(PyObject self, PyBuiltinFunction.Info info) {
0624:                        super (self, info);
0625:                    }
0626:
0627:                    public PyBuiltinFunction bind(PyObject self) {
0628:                        return new exposed___rxor__(self, info);
0629:                    }
0630:
0631:                    public PyObject __call__(PyObject arg0) {
0632:                        PyObject ret = ((PyInteger) self).int___rxor__(arg0);
0633:                        if (ret == null)
0634:                            return Py.NotImplemented;
0635:                        return ret;
0636:                    }
0637:
0638:                }
0639:                dict.__setitem__("__rxor__",
0640:                        new PyMethodDescr("__rxor__", PyInteger.class, 1, 1,
0641:                                new exposed___rxor__(null, null)));
0642:                class exposed___rrshift__ extends PyBuiltinMethodNarrow {
0643:
0644:                    exposed___rrshift__(PyObject self,
0645:                            PyBuiltinFunction.Info info) {
0646:                        super (self, info);
0647:                    }
0648:
0649:                    public PyBuiltinFunction bind(PyObject self) {
0650:                        return new exposed___rrshift__(self, info);
0651:                    }
0652:
0653:                    public PyObject __call__(PyObject arg0) {
0654:                        PyObject ret = ((PyInteger) self).int___rrshift__(arg0);
0655:                        if (ret == null)
0656:                            return Py.NotImplemented;
0657:                        return ret;
0658:                    }
0659:
0660:                }
0661:                dict.__setitem__("__rrshift__", new PyMethodDescr(
0662:                        "__rrshift__", PyInteger.class, 1, 1,
0663:                        new exposed___rrshift__(null, null)));
0664:                class exposed___ror__ extends PyBuiltinMethodNarrow {
0665:
0666:                    exposed___ror__(PyObject self, PyBuiltinFunction.Info info) {
0667:                        super (self, info);
0668:                    }
0669:
0670:                    public PyBuiltinFunction bind(PyObject self) {
0671:                        return new exposed___ror__(self, info);
0672:                    }
0673:
0674:                    public PyObject __call__(PyObject arg0) {
0675:                        PyObject ret = ((PyInteger) self).int___ror__(arg0);
0676:                        if (ret == null)
0677:                            return Py.NotImplemented;
0678:                        return ret;
0679:                    }
0680:
0681:                }
0682:                dict
0683:                        .__setitem__("__ror__", new PyMethodDescr("__ror__",
0684:                                PyInteger.class, 1, 1, new exposed___ror__(
0685:                                        null, null)));
0686:                class exposed___rand__ extends PyBuiltinMethodNarrow {
0687:
0688:                    exposed___rand__(PyObject self, PyBuiltinFunction.Info info) {
0689:                        super (self, info);
0690:                    }
0691:
0692:                    public PyBuiltinFunction bind(PyObject self) {
0693:                        return new exposed___rand__(self, info);
0694:                    }
0695:
0696:                    public PyObject __call__(PyObject arg0) {
0697:                        PyObject ret = ((PyInteger) self).int___rand__(arg0);
0698:                        if (ret == null)
0699:                            return Py.NotImplemented;
0700:                        return ret;
0701:                    }
0702:
0703:                }
0704:                dict.__setitem__("__rand__",
0705:                        new PyMethodDescr("__rand__", PyInteger.class, 1, 1,
0706:                                new exposed___rand__(null, null)));
0707:                class exposed___rpow__ extends PyBuiltinMethodNarrow {
0708:
0709:                    exposed___rpow__(PyObject self, PyBuiltinFunction.Info info) {
0710:                        super (self, info);
0711:                    }
0712:
0713:                    public PyBuiltinFunction bind(PyObject self) {
0714:                        return new exposed___rpow__(self, info);
0715:                    }
0716:
0717:                    public PyObject __call__(PyObject arg0) {
0718:                        PyObject ret = ((PyInteger) self).int___rpow__(arg0);
0719:                        if (ret == null)
0720:                            return Py.NotImplemented;
0721:                        return ret;
0722:                    }
0723:
0724:                }
0725:                dict.__setitem__("__rpow__",
0726:                        new PyMethodDescr("__rpow__", PyInteger.class, 1, 1,
0727:                                new exposed___rpow__(null, null)));
0728:                class exposed___rlshift__ extends PyBuiltinMethodNarrow {
0729:
0730:                    exposed___rlshift__(PyObject self,
0731:                            PyBuiltinFunction.Info info) {
0732:                        super (self, info);
0733:                    }
0734:
0735:                    public PyBuiltinFunction bind(PyObject self) {
0736:                        return new exposed___rlshift__(self, info);
0737:                    }
0738:
0739:                    public PyObject __call__(PyObject arg0) {
0740:                        PyObject ret = ((PyInteger) self).int___rlshift__(arg0);
0741:                        if (ret == null)
0742:                            return Py.NotImplemented;
0743:                        return ret;
0744:                    }
0745:
0746:                }
0747:                dict.__setitem__("__rlshift__", new PyMethodDescr(
0748:                        "__rlshift__", PyInteger.class, 1, 1,
0749:                        new exposed___rlshift__(null, null)));
0750:                class exposed___rdivmod__ extends PyBuiltinMethodNarrow {
0751:
0752:                    exposed___rdivmod__(PyObject self,
0753:                            PyBuiltinFunction.Info info) {
0754:                        super (self, info);
0755:                    }
0756:
0757:                    public PyBuiltinFunction bind(PyObject self) {
0758:                        return new exposed___rdivmod__(self, info);
0759:                    }
0760:
0761:                    public PyObject __call__(PyObject arg0) {
0762:                        PyObject ret = ((PyInteger) self).int___rdivmod__(arg0);
0763:                        if (ret == null)
0764:                            return Py.NotImplemented;
0765:                        return ret;
0766:                    }
0767:
0768:                }
0769:                dict.__setitem__("__rdivmod__", new PyMethodDescr(
0770:                        "__rdivmod__", PyInteger.class, 1, 1,
0771:                        new exposed___rdivmod__(null, null)));
0772:                class exposed___cmp__ extends PyBuiltinMethodNarrow {
0773:
0774:                    exposed___cmp__(PyObject self, PyBuiltinFunction.Info info) {
0775:                        super (self, info);
0776:                    }
0777:
0778:                    public PyBuiltinFunction bind(PyObject self) {
0779:                        return new exposed___cmp__(self, info);
0780:                    }
0781:
0782:                    public PyObject __call__(PyObject arg0) {
0783:                        int ret = ((PyInteger) self).int___cmp__(arg0);
0784:                        if (ret == -2) {
0785:                            throw Py.TypeError("int"
0786:                                    + ".__cmp__(x,y) requires y to be '"
0787:                                    + "int" + "', not a '"
0788:                                    + (arg0).getType().fastGetName() + "'");
0789:                        }
0790:                        return Py.newInteger(ret);
0791:                    }
0792:
0793:                }
0794:                dict
0795:                        .__setitem__("__cmp__", new PyMethodDescr("__cmp__",
0796:                                PyInteger.class, 1, 1, new exposed___cmp__(
0797:                                        null, null)));
0798:                class exposed___pow__ extends PyBuiltinMethodNarrow {
0799:
0800:                    exposed___pow__(PyObject self, PyBuiltinFunction.Info info) {
0801:                        super (self, info);
0802:                    }
0803:
0804:                    public PyBuiltinFunction bind(PyObject self) {
0805:                        return new exposed___pow__(self, info);
0806:                    }
0807:
0808:                    public PyObject __call__(PyObject arg0, PyObject arg1) {
0809:                        PyObject ret = ((PyInteger) self).int___pow__(arg0,
0810:                                arg1);
0811:                        if (ret == null)
0812:                            return Py.NotImplemented;
0813:                        return ret;
0814:                    }
0815:
0816:                    public PyObject __call__(PyObject arg0) {
0817:                        PyObject ret = ((PyInteger) self).int___pow__(arg0,
0818:                                null);
0819:                        if (ret == null)
0820:                            return Py.NotImplemented;
0821:                        return ret;
0822:                    }
0823:
0824:                }
0825:                dict
0826:                        .__setitem__("__pow__", new PyMethodDescr("__pow__",
0827:                                PyInteger.class, 1, 2, new exposed___pow__(
0828:                                        null, null)));
0829:                class exposed___nonzero__ extends PyBuiltinMethodNarrow {
0830:
0831:                    exposed___nonzero__(PyObject self,
0832:                            PyBuiltinFunction.Info info) {
0833:                        super (self, info);
0834:                    }
0835:
0836:                    public PyBuiltinFunction bind(PyObject self) {
0837:                        return new exposed___nonzero__(self, info);
0838:                    }
0839:
0840:                    public PyObject __call__() {
0841:                        return Py.newBoolean(((PyInteger) self)
0842:                                .int___nonzero__());
0843:                    }
0844:
0845:                }
0846:                dict.__setitem__("__nonzero__", new PyMethodDescr(
0847:                        "__nonzero__", PyInteger.class, 0, 0,
0848:                        new exposed___nonzero__(null, null)));
0849:                class exposed___reduce__ extends PyBuiltinMethodNarrow {
0850:
0851:                    exposed___reduce__(PyObject self,
0852:                            PyBuiltinFunction.Info info) {
0853:                        super (self, info);
0854:                    }
0855:
0856:                    public PyBuiltinFunction bind(PyObject self) {
0857:                        return new exposed___reduce__(self, info);
0858:                    }
0859:
0860:                    public PyObject __call__() {
0861:                        return ((PyInteger) self).int___reduce__();
0862:                    }
0863:
0864:                }
0865:                dict.__setitem__("__reduce__", new PyMethodDescr("__reduce__",
0866:                        PyInteger.class, 0, 0, new exposed___reduce__(null,
0867:                                null)));
0868:                class exposed___repr__ extends PyBuiltinMethodNarrow {
0869:
0870:                    exposed___repr__(PyObject self, PyBuiltinFunction.Info info) {
0871:                        super (self, info);
0872:                    }
0873:
0874:                    public PyBuiltinFunction bind(PyObject self) {
0875:                        return new exposed___repr__(self, info);
0876:                    }
0877:
0878:                    public PyObject __call__() {
0879:                        return new PyString(((PyInteger) self).int_toString());
0880:                    }
0881:
0882:                }
0883:                dict.__setitem__("__repr__",
0884:                        new PyMethodDescr("__repr__", PyInteger.class, 0, 0,
0885:                                new exposed___repr__(null, null)));
0886:                class exposed___str__ extends PyBuiltinMethodNarrow {
0887:
0888:                    exposed___str__(PyObject self, PyBuiltinFunction.Info info) {
0889:                        super (self, info);
0890:                    }
0891:
0892:                    public PyBuiltinFunction bind(PyObject self) {
0893:                        return new exposed___str__(self, info);
0894:                    }
0895:
0896:                    public PyObject __call__() {
0897:                        return new PyString(((PyInteger) self).int_toString());
0898:                    }
0899:
0900:                }
0901:                dict
0902:                        .__setitem__("__str__", new PyMethodDescr("__str__",
0903:                                PyInteger.class, 0, 0, new exposed___str__(
0904:                                        null, null)));
0905:                class exposed___hash__ extends PyBuiltinMethodNarrow {
0906:
0907:                    exposed___hash__(PyObject self, PyBuiltinFunction.Info info) {
0908:                        super (self, info);
0909:                    }
0910:
0911:                    public PyBuiltinFunction bind(PyObject self) {
0912:                        return new exposed___hash__(self, info);
0913:                    }
0914:
0915:                    public PyObject __call__() {
0916:                        return Py.newInteger(((PyInteger) self).int_hashCode());
0917:                    }
0918:
0919:                }
0920:                dict.__setitem__("__hash__",
0921:                        new PyMethodDescr("__hash__", PyInteger.class, 0, 0,
0922:                                new exposed___hash__(null, null)));
0923:                dict.__setitem__("__new__", new PyNewWrapper(PyInteger.class,
0924:                        "__new__", -1, -1) {
0925:
0926:                    public PyObject new_impl(boolean init, PyType subtype,
0927:                            PyObject[] args, String[] keywords) {
0928:                        return int_new(this , init, subtype, args, keywords);
0929:                    }
0930:
0931:                });
0932:            }
0933:
0934:            //~ END GENERATED REGION -- DO NOT EDIT SEE gexpose.py
0935:
0936:            public static PyObject int_new(PyNewWrapper new_, boolean init,
0937:                    PyType subtype, PyObject[] args, String[] keywords) {
0938:                ArgParser ap = new ArgParser("int", args, keywords,
0939:                        new String[] { "x", "base" }, 0);
0940:                PyObject x = ap.getPyObject(0, null);
0941:                int base = ap.getInt(1, -909);
0942:                if (new_.for_type == subtype) {
0943:                    if (x == null) {
0944:                        return Py.Zero;
0945:                    }
0946:                    if (base == -909) {
0947:                        return asPyInteger(x);
0948:                    }
0949:                    if (!(x instanceof  PyString)) {
0950:                        throw Py
0951:                                .TypeError("int: can't convert non-string with explicit base");
0952:                    }
0953:                    return Py.newInteger(((PyString) x).atoi(base));
0954:                } else {
0955:                    if (x == null) {
0956:                        return new PyIntegerDerived(subtype, 0);
0957:                    }
0958:                    if (base == -909) {
0959:                        PyObject intOrLong = asPyInteger(x);
0960:                        if (intOrLong instanceof  PyInteger) {
0961:                            return new PyIntegerDerived(subtype,
0962:                                    ((PyInteger) intOrLong).getValue());
0963:                        } else {
0964:                            throw Py
0965:                                    .OverflowError("long int too large to convert to int");
0966:                        }
0967:                    }
0968:                    if (!(x instanceof  PyString)) {
0969:                        throw Py
0970:                                .TypeError("int: can't convert non-string with explicit base");
0971:                    }
0972:                    return new PyIntegerDerived(subtype, ((PyString) x)
0973:                            .atoi(base));
0974:                }
0975:            } // xxx
0976:
0977:            /**
0978:             * @return the result of x.__int__ 
0979:             * @throws Py.Type error if x.__int__ throws an Py.AttributeError
0980:             */
0981:            private static PyObject asPyInteger(PyObject x) {
0982:                try {
0983:                    return x.__int__();
0984:                } catch (PyException pye) {
0985:                    if (!Py.matchException(pye, Py.AttributeError))
0986:                        throw pye;
0987:                    throw Py
0988:                            .TypeError("int() argument must be a string or a number");
0989:                }
0990:            }
0991:
0992:            private static final PyType INTTYPE = PyType
0993:                    .fromClass(PyInteger.class);
0994:
0995:            private int value;
0996:
0997:            public PyInteger(PyType subType, int v) {
0998:                super (subType);
0999:                value = v;
1000:            }
1001:
1002:            public PyInteger(int v) {
1003:                this (INTTYPE, v);
1004:            }
1005:
1006:            public int getValue() {
1007:                return value;
1008:            }
1009:
1010:            public String safeRepr() throws PyIgnoreMethodTag {
1011:                return "'int' object";
1012:            }
1013:
1014:            public String toString() {
1015:                return int_toString();
1016:            }
1017:
1018:            final String int_toString() {
1019:                return Integer.toString(getValue());
1020:            }
1021:
1022:            public int hashCode() {
1023:                return int_hashCode();
1024:            }
1025:
1026:            final int int_hashCode() {
1027:                return getValue();
1028:            }
1029:
1030:            private static void err_ovf(String msg) {
1031:                try {
1032:                    Py.OverflowWarning(msg);
1033:                } catch (PyException exc) {
1034:                    if (Py.matchException(exc, Py.OverflowWarning))
1035:                        throw Py.OverflowError(msg);
1036:                }
1037:            }
1038:
1039:            public boolean __nonzero__() {
1040:                return int___nonzero__();
1041:            }
1042:
1043:            final boolean int___nonzero__() {
1044:                return getValue() != 0;
1045:            }
1046:
1047:            public Object __tojava__(Class c) {
1048:                if (c == Integer.TYPE || c == Number.class || c == Object.class
1049:                        || c == Integer.class || c == Serializable.class) {
1050:                    return new Integer(getValue());
1051:                }
1052:
1053:                if (c == Boolean.TYPE || c == Boolean.class)
1054:                    return new Boolean(getValue() != 0);
1055:                if (c == Byte.TYPE || c == Byte.class)
1056:                    return new Byte((byte) getValue());
1057:                if (c == Short.TYPE || c == Short.class)
1058:                    return new Short((short) getValue());
1059:
1060:                if (c == Long.TYPE || c == Long.class)
1061:                    return new Long(getValue());
1062:                if (c == Float.TYPE || c == Float.class)
1063:                    return new Float(getValue());
1064:                if (c == Double.TYPE || c == Double.class)
1065:                    return new Double(getValue());
1066:                return super .__tojava__(c);
1067:            }
1068:
1069:            public int __cmp__(PyObject other) {
1070:                return int___cmp__(other);
1071:            }
1072:
1073:            final int int___cmp__(PyObject other) {
1074:                if (!canCoerce(other))
1075:                    return -2;
1076:                int v = coerce(other);
1077:                return getValue() < v ? -1 : getValue() > v ? 1 : 0;
1078:            }
1079:
1080:            public Object __coerce_ex__(PyObject other) {
1081:                if (other instanceof  PyInteger)
1082:                    return other;
1083:                else
1084:                    return Py.None;
1085:            }
1086:
1087:            private static final boolean canCoerce(PyObject other) {
1088:                return other instanceof  PyInteger;
1089:            }
1090:
1091:            private static final int coerce(PyObject other) {
1092:                if (other instanceof  PyInteger)
1093:                    return ((PyInteger) other).getValue();
1094:                else
1095:                    throw Py.TypeError("xxx");
1096:            }
1097:
1098:            public PyObject __add__(PyObject right) {
1099:                return int___add__(right);
1100:            }
1101:
1102:            final PyObject int___add__(PyObject right) {
1103:                if (!canCoerce(right))
1104:                    return null;
1105:                int rightv = coerce(right);
1106:                int a = getValue();
1107:                int b = rightv;
1108:                int x = a + b;
1109:                if ((x ^ a) >= 0 || (x ^ b) >= 0)
1110:                    return Py.newInteger(x);
1111:                err_ovf("integer addition");
1112:                return new PyLong((long) a + (long) b);
1113:            }
1114:
1115:            public PyObject __radd__(PyObject left) {
1116:                return int___radd__(left);
1117:            }
1118:
1119:            final PyObject int___radd__(PyObject left) {
1120:                return __add__(left);
1121:            }
1122:
1123:            private static PyObject _sub(int a, int b) {
1124:                int x = a - b;
1125:                if ((x ^ a) >= 0 || (x ^ ~b) >= 0)
1126:                    return Py.newInteger(x);
1127:                err_ovf("integer subtraction");
1128:                return new PyLong((long) a - (long) b);
1129:            }
1130:
1131:            public PyObject __sub__(PyObject right) {
1132:                return int___sub__(right);
1133:            }
1134:
1135:            final PyObject int___sub__(PyObject right) {
1136:                if (!canCoerce(right))
1137:                    return null;
1138:                return _sub(getValue(), coerce(right));
1139:            }
1140:
1141:            public PyObject __rsub__(PyObject left) {
1142:                return int___rsub__(left);
1143:            }
1144:
1145:            final PyObject int___rsub__(PyObject left) {
1146:                if (!canCoerce(left))
1147:                    return null;
1148:                return _sub(coerce(left), getValue());
1149:            }
1150:
1151:            public PyObject __mul__(PyObject right) {
1152:                return int___mul__(right);
1153:            }
1154:
1155:            final PyObject int___mul__(PyObject right) {
1156:                if (right instanceof  PySequence)
1157:                    return ((PySequence) right).repeat(getValue());
1158:
1159:                if (!canCoerce(right))
1160:                    return null;
1161:                int rightv = coerce(right);
1162:
1163:                double x = (double) getValue();
1164:                x *= rightv;
1165:                //long x = ((long)getValue())*((PyInteger)right).getValue();
1166:                //System.out.println("mul: "+this+" * "+right+" = "+x);
1167:
1168:                if (x <= Integer.MAX_VALUE && x >= Integer.MIN_VALUE)
1169:                    return Py.newInteger((int) x);
1170:                err_ovf("integer multiplication");
1171:                return __long__().__mul__(right);
1172:            }
1173:
1174:            public PyObject __rmul__(PyObject left) {
1175:                return int___rmul__(left);
1176:            }
1177:
1178:            final PyObject int___rmul__(PyObject left) {
1179:                return __mul__(left);
1180:            }
1181:
1182:            // Getting signs correct for integer division
1183:            // This convention makes sense when you consider it in tandem with modulo
1184:            private static int divide(int x, int y) {
1185:                if (y == 0)
1186:                    throw Py
1187:                            .ZeroDivisionError("integer division or modulo by zero");
1188:
1189:                if (y == -1 && x < 0 && x == -x) {
1190:                    err_ovf("integer division: " + x + " + " + y);
1191:                }
1192:                int xdivy = x / y;
1193:                int xmody = x - xdivy * y;
1194:                /* If the signs of x and y differ, and the remainder is non-0,
1195:                 * C89 doesn't define whether xdivy is now the floor or the
1196:                 * ceiling of the infinitely precise quotient.  We want the floor,
1197:                 * and we have it iff the remainder's sign matches y's.
1198:                 */
1199:                if (xmody != 0 && ((y ^ xmody) < 0) /* i.e. and signs differ */) {
1200:                    xmody += y;
1201:                    --xdivy;
1202:                    //assert(xmody && ((y ^ xmody) >= 0));
1203:                }
1204:                return xdivy;
1205:            }
1206:
1207:            public PyObject __div__(PyObject right) {
1208:                return int___div__(right);
1209:            }
1210:
1211:            final PyObject int___div__(PyObject right) {
1212:                if (!canCoerce(right))
1213:                    return null;
1214:                if (Options.divisionWarning > 0)
1215:                    Py.warning(Py.DeprecationWarning, "classic int division");
1216:                return Py.newInteger(divide(getValue(), coerce(right)));
1217:            }
1218:
1219:            public PyObject __rdiv__(PyObject left) {
1220:                return int___rdiv__(left);
1221:            }
1222:
1223:            final PyObject int___rdiv__(PyObject left) {
1224:                if (!canCoerce(left))
1225:                    return null;
1226:                if (Options.divisionWarning > 0)
1227:                    Py.warning(Py.DeprecationWarning, "classic int division");
1228:                return Py.newInteger(divide(coerce(left), getValue()));
1229:            }
1230:
1231:            public PyObject __floordiv__(PyObject right) {
1232:                return int___floordiv__(right);
1233:            }
1234:
1235:            final PyObject int___floordiv__(PyObject right) {
1236:                if (!canCoerce(right))
1237:                    return null;
1238:                return Py.newInteger(divide(getValue(), coerce(right)));
1239:            }
1240:
1241:            public PyObject __rfloordiv__(PyObject left) {
1242:                return int___rfloordiv__(left);
1243:            }
1244:
1245:            final PyObject int___rfloordiv__(PyObject left) {
1246:                if (!canCoerce(left))
1247:                    return null;
1248:                return Py.newInteger(divide(coerce(left), getValue()));
1249:            }
1250:
1251:            public PyObject __truediv__(PyObject right) {
1252:                return int___truediv__(right);
1253:            }
1254:
1255:            final PyObject int___truediv__(PyObject right) {
1256:                if (right instanceof  PyInteger)
1257:                    return __float__().__truediv__(right);
1258:                else if (right instanceof  PyLong)
1259:                    return int___long__().__truediv__(right);
1260:                else
1261:                    return null;
1262:            }
1263:
1264:            public PyObject __rtruediv__(PyObject left) {
1265:                return int___rtruediv__(left);
1266:            }
1267:
1268:            final PyObject int___rtruediv__(PyObject left) {
1269:                if (left instanceof  PyInteger)
1270:                    return left.__float__().__truediv__(this );
1271:                else if (left instanceof  PyLong)
1272:                    return left.__truediv__(int___long__());
1273:                else
1274:                    return null;
1275:            }
1276:
1277:            private static int modulo(int x, int y, int xdivy) {
1278:                return x - xdivy * y;
1279:            }
1280:
1281:            public PyObject __mod__(PyObject right) {
1282:                return int___mod__(right);
1283:            }
1284:
1285:            final PyObject int___mod__(PyObject right) {
1286:                if (!canCoerce(right))
1287:                    return null;
1288:                int rightv = coerce(right);
1289:                int v = getValue();
1290:                return Py.newInteger(modulo(v, rightv, divide(v, rightv)));
1291:            }
1292:
1293:            public PyObject __rmod__(PyObject left) {
1294:                return int___rmod__(left);
1295:            }
1296:
1297:            final PyObject int___rmod__(PyObject left) {
1298:                if (!canCoerce(left))
1299:                    return null;
1300:                int leftv = coerce(left);
1301:                int v = getValue();
1302:                return Py.newInteger(modulo(leftv, v, divide(leftv, v)));
1303:            }
1304:
1305:            public PyObject __divmod__(PyObject right) {
1306:                return int___divmod__(right);
1307:            }
1308:
1309:            final PyObject int___divmod__(PyObject right) {
1310:                if (!canCoerce(right))
1311:                    return null;
1312:                int rightv = coerce(right);
1313:
1314:                int v = getValue();
1315:                int xdivy = divide(v, rightv);
1316:                return new PyTuple(new PyObject[] { Py.newInteger(xdivy),
1317:                        Py.newInteger(modulo(v, rightv, xdivy)) });
1318:            }
1319:
1320:            final PyObject int___rdivmod__(PyObject left) {
1321:                if (!canCoerce(left))
1322:                    return null;
1323:                int leftv = coerce(left);
1324:
1325:                int v = getValue();
1326:                int xdivy = divide(leftv, v);
1327:                return new PyTuple(new PyObject[] { Py.newInteger(xdivy),
1328:                        Py.newInteger(modulo(leftv, v, xdivy)) });
1329:            }
1330:
1331:            public PyObject __pow__(PyObject right, PyObject modulo) {
1332:                return int___pow__(right, modulo);
1333:            }
1334:
1335:            final PyObject int___pow__(PyObject right, PyObject modulo) {
1336:                if (!canCoerce(right))
1337:                    return null;
1338:
1339:                if (modulo != null && !canCoerce(modulo))
1340:                    return null;
1341:
1342:                return _pow(getValue(), coerce(right), modulo, this , right);
1343:            }
1344:
1345:            public PyObject __rpow__(PyObject left, PyObject modulo) {
1346:                if (!canCoerce(left))
1347:                    return null;
1348:
1349:                if (modulo != null && !canCoerce(modulo))
1350:                    return null;
1351:
1352:                return _pow(coerce(left), getValue(), modulo, left, this );
1353:            }
1354:
1355:            final PyObject int___rpow__(PyObject left) {
1356:                return __rpow__(left, null);
1357:            }
1358:
1359:            private static PyObject _pow(int value, int pow, PyObject modulo,
1360:                    PyObject left, PyObject right) {
1361:                int mod = 0;
1362:                long tmp = value;
1363:                boolean neg = false;
1364:                if (tmp < 0) {
1365:                    tmp = -tmp;
1366:                    neg = (pow & 0x1) != 0;
1367:                }
1368:                long result = 1;
1369:
1370:                if (pow < 0) {
1371:                    if (value != 0)
1372:                        return left.__float__().__pow__(right, modulo);
1373:                    else
1374:                        throw Py.ZeroDivisionError("cannot raise 0 to a "
1375:                                + "negative power");
1376:                }
1377:
1378:                if (modulo != null) {
1379:                    mod = coerce(modulo);
1380:                    if (mod == 0) {
1381:                        throw Py.ValueError("pow(x, y, z) with z==0");
1382:                    }
1383:                }
1384:
1385:                // Standard O(ln(N)) exponentiation code
1386:                while (pow > 0) {
1387:                    if ((pow & 0x1) != 0) {
1388:                        result *= tmp;
1389:                        if (mod != 0) {
1390:                            result %= (long) mod;
1391:                        }
1392:
1393:                        if (result > Integer.MAX_VALUE) {
1394:                            err_ovf("integer exponentiation");
1395:                            return left.__long__().__pow__(right, modulo);
1396:                        }
1397:                    }
1398:                    pow >>= 1;
1399:                    if (pow == 0)
1400:                        break;
1401:                    tmp *= tmp;
1402:
1403:                    if (mod != 0) {
1404:                        tmp %= (long) mod;
1405:                    }
1406:
1407:                    if (tmp > Integer.MAX_VALUE) {
1408:                        err_ovf("integer exponentiation");
1409:                        return left.__long__().__pow__(right, modulo);
1410:                    }
1411:                }
1412:
1413:                int ret = (int) result;
1414:                if (neg)
1415:                    ret = -ret;
1416:
1417:                // Cleanup result of modulo
1418:                if (mod != 0) {
1419:                    ret = modulo(ret, mod, divide(ret, mod));
1420:                }
1421:                return Py.newInteger(ret);
1422:            }
1423:
1424:            public PyObject __lshift__(PyObject right) {
1425:                return int___lshift__(right);
1426:            }
1427:
1428:            final PyObject int___lshift__(PyObject right) {
1429:                int rightv;
1430:                if (right instanceof  PyInteger)
1431:                    rightv = ((PyInteger) right).getValue();
1432:                else if (right instanceof  PyLong)
1433:                    return int___long__().__lshift__(right);
1434:                else
1435:                    return null;
1436:
1437:                if (rightv > 31)
1438:                    return Py.newInteger(0);
1439:                else if (rightv < 0)
1440:                    throw Py.ValueError("negative shift count");
1441:                return Py.newInteger(getValue() << rightv);
1442:            }
1443:
1444:            final PyObject int___rlshift__(PyObject left) {
1445:                int leftv;
1446:                if (left instanceof  PyInteger)
1447:                    leftv = ((PyInteger) left).getValue();
1448:                else if (left instanceof  PyLong)
1449:                    return left.__rlshift__(int___long__());
1450:                else
1451:                    return null;
1452:
1453:                if (getValue() > 31)
1454:                    return Py.newInteger(0);
1455:                else if (getValue() < 0)
1456:                    throw Py.ValueError("negative shift count");
1457:                return Py.newInteger(leftv << getValue());
1458:            }
1459:
1460:            public PyObject __rshift__(PyObject right) {
1461:                return int___rshift__(right);
1462:            }
1463:
1464:            final PyObject int___rshift__(PyObject right) {
1465:                int rightv;
1466:                if (right instanceof  PyInteger)
1467:                    rightv = ((PyInteger) right).getValue();
1468:                else if (right instanceof  PyLong)
1469:                    return int___long__().__rshift__(right);
1470:                else
1471:                    return null;
1472:
1473:                if (rightv < 0)
1474:                    throw Py.ValueError("negative shift count");
1475:
1476:                return Py.newInteger(getValue() >> rightv);
1477:            }
1478:
1479:            final PyObject int___rrshift__(PyObject left) {
1480:                int leftv;
1481:                if (left instanceof  PyInteger)
1482:                    leftv = ((PyInteger) left).getValue();
1483:                else if (left instanceof  PyLong)
1484:                    return left.__rshift__(int___long__());
1485:                else
1486:                    return null;
1487:
1488:                if (getValue() < 0)
1489:                    throw Py.ValueError("negative shift count");
1490:
1491:                return Py.newInteger(leftv >> getValue());
1492:            }
1493:
1494:            public PyObject __and__(PyObject right) {
1495:                return int___and__(right);
1496:            }
1497:
1498:            final PyObject int___and__(PyObject right) {
1499:                int rightv;
1500:                if (right instanceof  PyInteger)
1501:                    rightv = ((PyInteger) right).getValue();
1502:                else if (right instanceof  PyLong)
1503:                    return int___long__().__and__(right);
1504:                else
1505:                    return null;
1506:
1507:                return Py.newInteger(getValue() & rightv);
1508:            }
1509:
1510:            final PyObject int___rand__(PyObject left) {
1511:                return int___and__(left);
1512:            }
1513:
1514:            public PyObject __xor__(PyObject right) {
1515:                return int___xor__(right);
1516:            }
1517:
1518:            final PyObject int___xor__(PyObject right) {
1519:                int rightv;
1520:                if (right instanceof  PyInteger)
1521:                    rightv = ((PyInteger) right).getValue();
1522:                else if (right instanceof  PyLong)
1523:                    return int___long__().__xor__(right);
1524:                else
1525:                    return null;
1526:
1527:                return Py.newInteger(getValue() ^ rightv);
1528:            }
1529:
1530:            final PyObject int___rxor__(PyObject left) {
1531:                int leftv;
1532:                if (left instanceof  PyInteger)
1533:                    leftv = ((PyInteger) left).getValue();
1534:                else if (left instanceof  PyLong)
1535:                    return left.__rxor__(int___long__());
1536:                else
1537:                    return null;
1538:
1539:                return Py.newInteger(leftv ^ getValue());
1540:            }
1541:
1542:            public PyObject __or__(PyObject right) {
1543:                return int___or__(right);
1544:            }
1545:
1546:            final PyObject int___or__(PyObject right) {
1547:                int rightv;
1548:                if (right instanceof  PyInteger)
1549:                    rightv = ((PyInteger) right).getValue();
1550:                else if (right instanceof  PyLong)
1551:                    return int___long__().__or__(right);
1552:                else
1553:                    return null;
1554:
1555:                return Py.newInteger(getValue() | rightv);
1556:            }
1557:
1558:            final PyObject int___ror__(PyObject left) {
1559:                return int___or__(left);
1560:            }
1561:
1562:            public PyObject __neg__() {
1563:                return int___neg__();
1564:            }
1565:
1566:            final PyObject int___neg__() {
1567:                int x = -getValue();
1568:                if (getValue() < 0 && x < 0)
1569:                    err_ovf("integer negation");
1570:                return Py.newInteger(x);
1571:            }
1572:
1573:            public PyObject __pos__() {
1574:                return int___pos__();
1575:            }
1576:
1577:            final PyObject int___pos__() {
1578:                return Py.newInteger(getValue());
1579:            }
1580:
1581:            public PyObject __abs__() {
1582:                return int___abs__();
1583:            }
1584:
1585:            final PyObject int___abs__() {
1586:                if (getValue() >= 0)
1587:                    return Py.newInteger(getValue());
1588:                else
1589:                    return __neg__();
1590:            }
1591:
1592:            public PyObject __invert__() {
1593:                return int___invert__();
1594:            }
1595:
1596:            final PyObject int___invert__() {
1597:                return Py.newInteger(~getValue());
1598:            }
1599:
1600:            public PyObject __int__() {
1601:                return int___int__();
1602:            }
1603:
1604:            final PyInteger int___int__() {
1605:                return Py.newInteger(getValue());
1606:            }
1607:
1608:            public PyLong __long__() {
1609:                return int___long__();
1610:            }
1611:
1612:            final PyLong int___long__() {
1613:                return new PyLong(getValue());
1614:            }
1615:
1616:            public PyFloat __float__() {
1617:                return int___float__();
1618:            }
1619:
1620:            final PyFloat int___float__() {
1621:                return new PyFloat((double) getValue());
1622:            }
1623:
1624:            public PyComplex __complex__() {
1625:                return new PyComplex((double) getValue(), 0.);
1626:            }
1627:
1628:            public PyString __oct__() {
1629:                return int___oct__();
1630:            }
1631:
1632:            final PyString int___oct__() {
1633:                if (getValue() < 0) {
1634:                    return new PyString("0"
1635:                            + Long
1636:                                    .toString(0x100000000l + (long) getValue(),
1637:                                            8));
1638:                } else if (getValue() > 0) {
1639:                    return new PyString("0" + Integer.toString(getValue(), 8));
1640:                } else
1641:                    return new PyString("0");
1642:            }
1643:
1644:            public PyString __hex__() {
1645:                return int___hex__();
1646:            }
1647:
1648:            final PyString int___hex__() {
1649:                if (getValue() < 0) {
1650:                    return new PyString("0x"
1651:                            + Long.toString(0x100000000l + (long) getValue(),
1652:                                    16));
1653:                } else {
1654:                    return new PyString("0x" + Integer.toString(getValue(), 16));
1655:                }
1656:            }
1657:
1658:            public boolean isMappingType() {
1659:                return false;
1660:            }
1661:
1662:            public boolean isSequenceType() {
1663:                return false;
1664:            }
1665:
1666:            public long asLong(int index) throws PyObject.ConversionException {
1667:                return getValue();
1668:            }
1669:
1670:            public int asInt(int index) throws PyObject.ConversionException {
1671:                return getValue();
1672:            }
1673:
1674:            /**
1675:             * Used for pickling.
1676:             *
1677:             * @return a tuple of (class, (Integer))
1678:             */
1679:            public PyObject __reduce__() {
1680:                return int___reduce__();
1681:            }
1682:
1683:            final PyObject int___reduce__() {
1684:                return new PyTuple(new PyObject[] {
1685:                        getType(),
1686:                        new PyTuple(
1687:                                new PyObject[] { Py.newInteger(getValue()) }) });
1688:            }
1689:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.