Source Code Cross Referenced for PyFloat.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 float.
0008:         */
0009:
0010:        public class PyFloat extends PyObject {
0011:            //~ BEGIN GENERATED REGION -- DO NOT EDIT SEE gexpose.py
0012:            /* type info */
0013:
0014:            public static final String exposed_name = "float";
0015:
0016:            public static void typeSetup(PyObject dict, PyType.Newstyle marker) {
0017:                class exposed___abs__ extends PyBuiltinMethodNarrow {
0018:
0019:                    exposed___abs__(PyObject self, PyBuiltinFunction.Info info) {
0020:                        super (self, info);
0021:                    }
0022:
0023:                    public PyBuiltinFunction bind(PyObject self) {
0024:                        return new exposed___abs__(self, info);
0025:                    }
0026:
0027:                    public PyObject __call__() {
0028:                        return ((PyFloat) self).float___abs__();
0029:                    }
0030:
0031:                }
0032:                dict.__setitem__("__abs__", new PyMethodDescr("__abs__",
0033:                        PyFloat.class, 0, 0, new exposed___abs__(null, null)));
0034:                class exposed___float__ extends PyBuiltinMethodNarrow {
0035:
0036:                    exposed___float__(PyObject self, PyBuiltinFunction.Info info) {
0037:                        super (self, info);
0038:                    }
0039:
0040:                    public PyBuiltinFunction bind(PyObject self) {
0041:                        return new exposed___float__(self, info);
0042:                    }
0043:
0044:                    public PyObject __call__() {
0045:                        return ((PyFloat) self).float___float__();
0046:                    }
0047:
0048:                }
0049:                dict
0050:                        .__setitem__("__float__", new PyMethodDescr(
0051:                                "__float__", PyFloat.class, 0, 0,
0052:                                new exposed___float__(null, null)));
0053:                class exposed___int__ extends PyBuiltinMethodNarrow {
0054:
0055:                    exposed___int__(PyObject self, PyBuiltinFunction.Info info) {
0056:                        super (self, info);
0057:                    }
0058:
0059:                    public PyBuiltinFunction bind(PyObject self) {
0060:                        return new exposed___int__(self, info);
0061:                    }
0062:
0063:                    public PyObject __call__() {
0064:                        return ((PyFloat) self).float___int__();
0065:                    }
0066:
0067:                }
0068:                dict.__setitem__("__int__", new PyMethodDescr("__int__",
0069:                        PyFloat.class, 0, 0, new exposed___int__(null, null)));
0070:                class exposed___long__ extends PyBuiltinMethodNarrow {
0071:
0072:                    exposed___long__(PyObject self, PyBuiltinFunction.Info info) {
0073:                        super (self, info);
0074:                    }
0075:
0076:                    public PyBuiltinFunction bind(PyObject self) {
0077:                        return new exposed___long__(self, info);
0078:                    }
0079:
0080:                    public PyObject __call__() {
0081:                        return ((PyFloat) self).float___long__();
0082:                    }
0083:
0084:                }
0085:                dict.__setitem__("__long__", new PyMethodDescr("__long__",
0086:                        PyFloat.class, 0, 0, new exposed___long__(null, null)));
0087:                class exposed___neg__ extends PyBuiltinMethodNarrow {
0088:
0089:                    exposed___neg__(PyObject self, PyBuiltinFunction.Info info) {
0090:                        super (self, info);
0091:                    }
0092:
0093:                    public PyBuiltinFunction bind(PyObject self) {
0094:                        return new exposed___neg__(self, info);
0095:                    }
0096:
0097:                    public PyObject __call__() {
0098:                        return ((PyFloat) self).float___neg__();
0099:                    }
0100:
0101:                }
0102:                dict.__setitem__("__neg__", new PyMethodDescr("__neg__",
0103:                        PyFloat.class, 0, 0, new exposed___neg__(null, null)));
0104:                class exposed___pos__ extends PyBuiltinMethodNarrow {
0105:
0106:                    exposed___pos__(PyObject self, PyBuiltinFunction.Info info) {
0107:                        super (self, info);
0108:                    }
0109:
0110:                    public PyBuiltinFunction bind(PyObject self) {
0111:                        return new exposed___pos__(self, info);
0112:                    }
0113:
0114:                    public PyObject __call__() {
0115:                        return ((PyFloat) self).float___pos__();
0116:                    }
0117:
0118:                }
0119:                dict.__setitem__("__pos__", new PyMethodDescr("__pos__",
0120:                        PyFloat.class, 0, 0, new exposed___pos__(null, null)));
0121:                class exposed___add__ extends PyBuiltinMethodNarrow {
0122:
0123:                    exposed___add__(PyObject self, PyBuiltinFunction.Info info) {
0124:                        super (self, info);
0125:                    }
0126:
0127:                    public PyBuiltinFunction bind(PyObject self) {
0128:                        return new exposed___add__(self, info);
0129:                    }
0130:
0131:                    public PyObject __call__(PyObject arg0) {
0132:                        PyObject ret = ((PyFloat) self).float___add__(arg0);
0133:                        if (ret == null)
0134:                            return Py.NotImplemented;
0135:                        return ret;
0136:                    }
0137:
0138:                }
0139:                dict.__setitem__("__add__", new PyMethodDescr("__add__",
0140:                        PyFloat.class, 1, 1, new exposed___add__(null, null)));
0141:                class exposed___div__ extends PyBuiltinMethodNarrow {
0142:
0143:                    exposed___div__(PyObject self, PyBuiltinFunction.Info info) {
0144:                        super (self, info);
0145:                    }
0146:
0147:                    public PyBuiltinFunction bind(PyObject self) {
0148:                        return new exposed___div__(self, info);
0149:                    }
0150:
0151:                    public PyObject __call__(PyObject arg0) {
0152:                        PyObject ret = ((PyFloat) self).float___div__(arg0);
0153:                        if (ret == null)
0154:                            return Py.NotImplemented;
0155:                        return ret;
0156:                    }
0157:
0158:                }
0159:                dict.__setitem__("__div__", new PyMethodDescr("__div__",
0160:                        PyFloat.class, 1, 1, new exposed___div__(null, null)));
0161:                class exposed___divmod__ extends PyBuiltinMethodNarrow {
0162:
0163:                    exposed___divmod__(PyObject self,
0164:                            PyBuiltinFunction.Info info) {
0165:                        super (self, info);
0166:                    }
0167:
0168:                    public PyBuiltinFunction bind(PyObject self) {
0169:                        return new exposed___divmod__(self, info);
0170:                    }
0171:
0172:                    public PyObject __call__(PyObject arg0) {
0173:                        PyObject ret = ((PyFloat) self).float___divmod__(arg0);
0174:                        if (ret == null)
0175:                            return Py.NotImplemented;
0176:                        return ret;
0177:                    }
0178:
0179:                }
0180:                dict.__setitem__("__divmod__",
0181:                        new PyMethodDescr("__divmod__", PyFloat.class, 1, 1,
0182:                                new exposed___divmod__(null, null)));
0183:                class exposed___floordiv__ extends PyBuiltinMethodNarrow {
0184:
0185:                    exposed___floordiv__(PyObject self,
0186:                            PyBuiltinFunction.Info info) {
0187:                        super (self, info);
0188:                    }
0189:
0190:                    public PyBuiltinFunction bind(PyObject self) {
0191:                        return new exposed___floordiv__(self, info);
0192:                    }
0193:
0194:                    public PyObject __call__(PyObject arg0) {
0195:                        PyObject ret = ((PyFloat) self)
0196:                                .float___floordiv__(arg0);
0197:                        if (ret == null)
0198:                            return Py.NotImplemented;
0199:                        return ret;
0200:                    }
0201:
0202:                }
0203:                dict.__setitem__("__floordiv__", new PyMethodDescr(
0204:                        "__floordiv__", PyFloat.class, 1, 1,
0205:                        new exposed___floordiv__(null, null)));
0206:                class exposed___mod__ extends PyBuiltinMethodNarrow {
0207:
0208:                    exposed___mod__(PyObject self, PyBuiltinFunction.Info info) {
0209:                        super (self, info);
0210:                    }
0211:
0212:                    public PyBuiltinFunction bind(PyObject self) {
0213:                        return new exposed___mod__(self, info);
0214:                    }
0215:
0216:                    public PyObject __call__(PyObject arg0) {
0217:                        PyObject ret = ((PyFloat) self).float___mod__(arg0);
0218:                        if (ret == null)
0219:                            return Py.NotImplemented;
0220:                        return ret;
0221:                    }
0222:
0223:                }
0224:                dict.__setitem__("__mod__", new PyMethodDescr("__mod__",
0225:                        PyFloat.class, 1, 1, new exposed___mod__(null, null)));
0226:                class exposed___mul__ extends PyBuiltinMethodNarrow {
0227:
0228:                    exposed___mul__(PyObject self, PyBuiltinFunction.Info info) {
0229:                        super (self, info);
0230:                    }
0231:
0232:                    public PyBuiltinFunction bind(PyObject self) {
0233:                        return new exposed___mul__(self, info);
0234:                    }
0235:
0236:                    public PyObject __call__(PyObject arg0) {
0237:                        PyObject ret = ((PyFloat) self).float___mul__(arg0);
0238:                        if (ret == null)
0239:                            return Py.NotImplemented;
0240:                        return ret;
0241:                    }
0242:
0243:                }
0244:                dict.__setitem__("__mul__", new PyMethodDescr("__mul__",
0245:                        PyFloat.class, 1, 1, new exposed___mul__(null, null)));
0246:                class exposed___radd__ extends PyBuiltinMethodNarrow {
0247:
0248:                    exposed___radd__(PyObject self, PyBuiltinFunction.Info info) {
0249:                        super (self, info);
0250:                    }
0251:
0252:                    public PyBuiltinFunction bind(PyObject self) {
0253:                        return new exposed___radd__(self, info);
0254:                    }
0255:
0256:                    public PyObject __call__(PyObject arg0) {
0257:                        PyObject ret = ((PyFloat) self).float___radd__(arg0);
0258:                        if (ret == null)
0259:                            return Py.NotImplemented;
0260:                        return ret;
0261:                    }
0262:
0263:                }
0264:                dict.__setitem__("__radd__", new PyMethodDescr("__radd__",
0265:                        PyFloat.class, 1, 1, new exposed___radd__(null, null)));
0266:                class exposed___rdiv__ extends PyBuiltinMethodNarrow {
0267:
0268:                    exposed___rdiv__(PyObject self, PyBuiltinFunction.Info info) {
0269:                        super (self, info);
0270:                    }
0271:
0272:                    public PyBuiltinFunction bind(PyObject self) {
0273:                        return new exposed___rdiv__(self, info);
0274:                    }
0275:
0276:                    public PyObject __call__(PyObject arg0) {
0277:                        PyObject ret = ((PyFloat) self).float___rdiv__(arg0);
0278:                        if (ret == null)
0279:                            return Py.NotImplemented;
0280:                        return ret;
0281:                    }
0282:
0283:                }
0284:                dict.__setitem__("__rdiv__", new PyMethodDescr("__rdiv__",
0285:                        PyFloat.class, 1, 1, new exposed___rdiv__(null, null)));
0286:                class exposed___rfloordiv__ extends PyBuiltinMethodNarrow {
0287:
0288:                    exposed___rfloordiv__(PyObject self,
0289:                            PyBuiltinFunction.Info info) {
0290:                        super (self, info);
0291:                    }
0292:
0293:                    public PyBuiltinFunction bind(PyObject self) {
0294:                        return new exposed___rfloordiv__(self, info);
0295:                    }
0296:
0297:                    public PyObject __call__(PyObject arg0) {
0298:                        PyObject ret = ((PyFloat) self)
0299:                                .float___rfloordiv__(arg0);
0300:                        if (ret == null)
0301:                            return Py.NotImplemented;
0302:                        return ret;
0303:                    }
0304:
0305:                }
0306:                dict.__setitem__("__rfloordiv__", new PyMethodDescr(
0307:                        "__rfloordiv__", PyFloat.class, 1, 1,
0308:                        new exposed___rfloordiv__(null, null)));
0309:                class exposed___rmod__ extends PyBuiltinMethodNarrow {
0310:
0311:                    exposed___rmod__(PyObject self, PyBuiltinFunction.Info info) {
0312:                        super (self, info);
0313:                    }
0314:
0315:                    public PyBuiltinFunction bind(PyObject self) {
0316:                        return new exposed___rmod__(self, info);
0317:                    }
0318:
0319:                    public PyObject __call__(PyObject arg0) {
0320:                        PyObject ret = ((PyFloat) self).float___rmod__(arg0);
0321:                        if (ret == null)
0322:                            return Py.NotImplemented;
0323:                        return ret;
0324:                    }
0325:
0326:                }
0327:                dict.__setitem__("__rmod__", new PyMethodDescr("__rmod__",
0328:                        PyFloat.class, 1, 1, new exposed___rmod__(null, null)));
0329:                class exposed___rmul__ extends PyBuiltinMethodNarrow {
0330:
0331:                    exposed___rmul__(PyObject self, PyBuiltinFunction.Info info) {
0332:                        super (self, info);
0333:                    }
0334:
0335:                    public PyBuiltinFunction bind(PyObject self) {
0336:                        return new exposed___rmul__(self, info);
0337:                    }
0338:
0339:                    public PyObject __call__(PyObject arg0) {
0340:                        PyObject ret = ((PyFloat) self).float___rmul__(arg0);
0341:                        if (ret == null)
0342:                            return Py.NotImplemented;
0343:                        return ret;
0344:                    }
0345:
0346:                }
0347:                dict.__setitem__("__rmul__", new PyMethodDescr("__rmul__",
0348:                        PyFloat.class, 1, 1, new exposed___rmul__(null, null)));
0349:                class exposed___rsub__ extends PyBuiltinMethodNarrow {
0350:
0351:                    exposed___rsub__(PyObject self, PyBuiltinFunction.Info info) {
0352:                        super (self, info);
0353:                    }
0354:
0355:                    public PyBuiltinFunction bind(PyObject self) {
0356:                        return new exposed___rsub__(self, info);
0357:                    }
0358:
0359:                    public PyObject __call__(PyObject arg0) {
0360:                        PyObject ret = ((PyFloat) self).float___rsub__(arg0);
0361:                        if (ret == null)
0362:                            return Py.NotImplemented;
0363:                        return ret;
0364:                    }
0365:
0366:                }
0367:                dict.__setitem__("__rsub__", new PyMethodDescr("__rsub__",
0368:                        PyFloat.class, 1, 1, new exposed___rsub__(null, null)));
0369:                class exposed___rtruediv__ extends PyBuiltinMethodNarrow {
0370:
0371:                    exposed___rtruediv__(PyObject self,
0372:                            PyBuiltinFunction.Info info) {
0373:                        super (self, info);
0374:                    }
0375:
0376:                    public PyBuiltinFunction bind(PyObject self) {
0377:                        return new exposed___rtruediv__(self, info);
0378:                    }
0379:
0380:                    public PyObject __call__(PyObject arg0) {
0381:                        PyObject ret = ((PyFloat) self)
0382:                                .float___rtruediv__(arg0);
0383:                        if (ret == null)
0384:                            return Py.NotImplemented;
0385:                        return ret;
0386:                    }
0387:
0388:                }
0389:                dict.__setitem__("__rtruediv__", new PyMethodDescr(
0390:                        "__rtruediv__", PyFloat.class, 1, 1,
0391:                        new exposed___rtruediv__(null, null)));
0392:                class exposed___sub__ extends PyBuiltinMethodNarrow {
0393:
0394:                    exposed___sub__(PyObject self, PyBuiltinFunction.Info info) {
0395:                        super (self, info);
0396:                    }
0397:
0398:                    public PyBuiltinFunction bind(PyObject self) {
0399:                        return new exposed___sub__(self, info);
0400:                    }
0401:
0402:                    public PyObject __call__(PyObject arg0) {
0403:                        PyObject ret = ((PyFloat) self).float___sub__(arg0);
0404:                        if (ret == null)
0405:                            return Py.NotImplemented;
0406:                        return ret;
0407:                    }
0408:
0409:                }
0410:                dict.__setitem__("__sub__", new PyMethodDescr("__sub__",
0411:                        PyFloat.class, 1, 1, new exposed___sub__(null, null)));
0412:                class exposed___truediv__ extends PyBuiltinMethodNarrow {
0413:
0414:                    exposed___truediv__(PyObject self,
0415:                            PyBuiltinFunction.Info info) {
0416:                        super (self, info);
0417:                    }
0418:
0419:                    public PyBuiltinFunction bind(PyObject self) {
0420:                        return new exposed___truediv__(self, info);
0421:                    }
0422:
0423:                    public PyObject __call__(PyObject arg0) {
0424:                        PyObject ret = ((PyFloat) self).float___truediv__(arg0);
0425:                        if (ret == null)
0426:                            return Py.NotImplemented;
0427:                        return ret;
0428:                    }
0429:
0430:                }
0431:                dict.__setitem__("__truediv__", new PyMethodDescr(
0432:                        "__truediv__", PyFloat.class, 1, 1,
0433:                        new exposed___truediv__(null, null)));
0434:                class exposed___rdivmod__ extends PyBuiltinMethodNarrow {
0435:
0436:                    exposed___rdivmod__(PyObject self,
0437:                            PyBuiltinFunction.Info info) {
0438:                        super (self, info);
0439:                    }
0440:
0441:                    public PyBuiltinFunction bind(PyObject self) {
0442:                        return new exposed___rdivmod__(self, info);
0443:                    }
0444:
0445:                    public PyObject __call__(PyObject arg0) {
0446:                        PyObject ret = ((PyFloat) self).float___rdivmod__(arg0);
0447:                        if (ret == null)
0448:                            return Py.NotImplemented;
0449:                        return ret;
0450:                    }
0451:
0452:                }
0453:                dict.__setitem__("__rdivmod__", new PyMethodDescr(
0454:                        "__rdivmod__", PyFloat.class, 1, 1,
0455:                        new exposed___rdivmod__(null, null)));
0456:                class exposed___rpow__ extends PyBuiltinMethodNarrow {
0457:
0458:                    exposed___rpow__(PyObject self, PyBuiltinFunction.Info info) {
0459:                        super (self, info);
0460:                    }
0461:
0462:                    public PyBuiltinFunction bind(PyObject self) {
0463:                        return new exposed___rpow__(self, info);
0464:                    }
0465:
0466:                    public PyObject __call__(PyObject arg0) {
0467:                        PyObject ret = ((PyFloat) self).float___rpow__(arg0);
0468:                        if (ret == null)
0469:                            return Py.NotImplemented;
0470:                        return ret;
0471:                    }
0472:
0473:                }
0474:                dict.__setitem__("__rpow__", new PyMethodDescr("__rpow__",
0475:                        PyFloat.class, 1, 1, new exposed___rpow__(null, null)));
0476:                class exposed___cmp__ extends PyBuiltinMethodNarrow {
0477:
0478:                    exposed___cmp__(PyObject self, PyBuiltinFunction.Info info) {
0479:                        super (self, info);
0480:                    }
0481:
0482:                    public PyBuiltinFunction bind(PyObject self) {
0483:                        return new exposed___cmp__(self, info);
0484:                    }
0485:
0486:                    public PyObject __call__(PyObject arg0) {
0487:                        int ret = ((PyFloat) self).float___cmp__(arg0);
0488:                        if (ret == -2) {
0489:                            throw Py.TypeError("float"
0490:                                    + ".__cmp__(x,y) requires y to be '"
0491:                                    + "float" + "', not a '"
0492:                                    + (arg0).getType().fastGetName() + "'");
0493:                        }
0494:                        return Py.newInteger(ret);
0495:                    }
0496:
0497:                }
0498:                dict.__setitem__("__cmp__", new PyMethodDescr("__cmp__",
0499:                        PyFloat.class, 1, 1, new exposed___cmp__(null, null)));
0500:                class exposed___pow__ extends PyBuiltinMethodNarrow {
0501:
0502:                    exposed___pow__(PyObject self, PyBuiltinFunction.Info info) {
0503:                        super (self, info);
0504:                    }
0505:
0506:                    public PyBuiltinFunction bind(PyObject self) {
0507:                        return new exposed___pow__(self, info);
0508:                    }
0509:
0510:                    public PyObject __call__(PyObject arg0, PyObject arg1) {
0511:                        PyObject ret = ((PyFloat) self).float___pow__(arg0,
0512:                                arg1);
0513:                        if (ret == null)
0514:                            return Py.NotImplemented;
0515:                        return ret;
0516:                    }
0517:
0518:                    public PyObject __call__(PyObject arg0) {
0519:                        PyObject ret = ((PyFloat) self).float___pow__(arg0,
0520:                                null);
0521:                        if (ret == null)
0522:                            return Py.NotImplemented;
0523:                        return ret;
0524:                    }
0525:
0526:                }
0527:                dict.__setitem__("__pow__", new PyMethodDescr("__pow__",
0528:                        PyFloat.class, 1, 2, new exposed___pow__(null, null)));
0529:                class exposed___nonzero__ extends PyBuiltinMethodNarrow {
0530:
0531:                    exposed___nonzero__(PyObject self,
0532:                            PyBuiltinFunction.Info info) {
0533:                        super (self, info);
0534:                    }
0535:
0536:                    public PyBuiltinFunction bind(PyObject self) {
0537:                        return new exposed___nonzero__(self, info);
0538:                    }
0539:
0540:                    public PyObject __call__() {
0541:                        return Py.newBoolean(((PyFloat) self)
0542:                                .float___nonzero__());
0543:                    }
0544:
0545:                }
0546:                dict.__setitem__("__nonzero__", new PyMethodDescr(
0547:                        "__nonzero__", PyFloat.class, 0, 0,
0548:                        new exposed___nonzero__(null, null)));
0549:                class exposed___repr__ extends PyBuiltinMethodNarrow {
0550:
0551:                    exposed___repr__(PyObject self, PyBuiltinFunction.Info info) {
0552:                        super (self, info);
0553:                    }
0554:
0555:                    public PyBuiltinFunction bind(PyObject self) {
0556:                        return new exposed___repr__(self, info);
0557:                    }
0558:
0559:                    public PyObject __call__() {
0560:                        return new PyString(((PyFloat) self).float_toString());
0561:                    }
0562:
0563:                }
0564:                dict.__setitem__("__repr__", new PyMethodDescr("__repr__",
0565:                        PyFloat.class, 0, 0, new exposed___repr__(null, null)));
0566:                class exposed___str__ extends PyBuiltinMethodNarrow {
0567:
0568:                    exposed___str__(PyObject self, PyBuiltinFunction.Info info) {
0569:                        super (self, info);
0570:                    }
0571:
0572:                    public PyBuiltinFunction bind(PyObject self) {
0573:                        return new exposed___str__(self, info);
0574:                    }
0575:
0576:                    public PyObject __call__() {
0577:                        return new PyString(((PyFloat) self).float_toString());
0578:                    }
0579:
0580:                }
0581:                dict.__setitem__("__str__", new PyMethodDescr("__str__",
0582:                        PyFloat.class, 0, 0, new exposed___str__(null, null)));
0583:                class exposed___hash__ extends PyBuiltinMethodNarrow {
0584:
0585:                    exposed___hash__(PyObject self, PyBuiltinFunction.Info info) {
0586:                        super (self, info);
0587:                    }
0588:
0589:                    public PyBuiltinFunction bind(PyObject self) {
0590:                        return new exposed___hash__(self, info);
0591:                    }
0592:
0593:                    public PyObject __call__() {
0594:                        return Py.newInteger(((PyFloat) self).float_hashCode());
0595:                    }
0596:
0597:                }
0598:                dict.__setitem__("__hash__", new PyMethodDescr("__hash__",
0599:                        PyFloat.class, 0, 0, new exposed___hash__(null, null)));
0600:                dict.__setitem__("__new__", new PyNewWrapper(PyFloat.class,
0601:                        "__new__", -1, -1) {
0602:
0603:                    public PyObject new_impl(boolean init, PyType subtype,
0604:                            PyObject[] args, String[] keywords) {
0605:                        return float_new(this , init, subtype, args, keywords);
0606:                    }
0607:
0608:                });
0609:            }
0610:
0611:            //~ END GENERATED REGION -- DO NOT EDIT SEE gexpose.py
0612:
0613:            public static PyObject float_new(PyNewWrapper new_, boolean init,
0614:                    PyType subtype, PyObject[] args, String[] keywords) {
0615:                ArgParser ap = new ArgParser("float", args, keywords,
0616:                        new String[] { "x" }, 0);
0617:                PyObject x = ap.getPyObject(0, null);
0618:                if (new_.for_type == subtype) {
0619:                    if (x == null) {
0620:                        return new PyFloat(0.0);
0621:                    }
0622:                    return x.__float__();
0623:                } else {
0624:                    if (x == null) {
0625:                        return new PyFloatDerived(subtype, 0.0);
0626:                    }
0627:                    return new PyFloatDerived(subtype, x.__float__().getValue());
0628:                }
0629:            } // xxx
0630:
0631:            private static final PyType FLOATTYPE = PyType
0632:                    .fromClass(PyFloat.class);
0633:
0634:            private double value;
0635:
0636:            public PyFloat(PyType subtype, double v) {
0637:                super (subtype);
0638:                value = v;
0639:            }
0640:
0641:            public PyFloat(double v) {
0642:                this (FLOATTYPE, v);
0643:            }
0644:
0645:            public PyFloat(float v) {
0646:                this ((double) v);
0647:            }
0648:
0649:            public String safeRepr() throws PyIgnoreMethodTag {
0650:                return "'float' object";
0651:            }
0652:
0653:            public double getValue() {
0654:                return value;
0655:            }
0656:
0657:            public String toString() {
0658:                return float_toString();
0659:            }
0660:
0661:            final String float_toString() {
0662:                String s = Double.toString(value);
0663:                // this is to work around an apparent bug in Double.toString(0.001)
0664:                // which returns "0.0010"
0665:                if (s.indexOf('E') == -1) {
0666:                    while (true) {
0667:                        int n = s.length();
0668:                        if (n <= 2)
0669:                            break;
0670:                        if (s.charAt(n - 1) == '0' && s.charAt(n - 2) != '.') {
0671:                            s = s.substring(0, n - 1);
0672:                            continue;
0673:                        }
0674:                        break;
0675:                    }
0676:                }
0677:                return s;
0678:            }
0679:
0680:            public int hashCode() {
0681:                return float_hashCode();
0682:            }
0683:
0684:            final int float_hashCode() {
0685:                double intPart = Math.floor(value);
0686:                double fractPart = value - intPart;
0687:
0688:                if (fractPart == 0) {
0689:                    if (intPart <= Integer.MAX_VALUE
0690:                            && intPart >= Integer.MIN_VALUE)
0691:                        return (int) value;
0692:                    else
0693:                        return __long__().hashCode();
0694:                } else {
0695:                    long v = Double.doubleToLongBits(value);
0696:                    return (int) v ^ (int) (v >> 32);
0697:                }
0698:            }
0699:
0700:            public boolean __nonzero__() {
0701:                return float___nonzero__();
0702:            }
0703:
0704:            final boolean float___nonzero__() {
0705:                return value != 0;
0706:            }
0707:
0708:            public Object __tojava__(Class c) {
0709:                if (c == Double.TYPE || c == Number.class || c == Double.class
0710:                        || c == Object.class || c == Serializable.class) {
0711:                    return new Double(value);
0712:                }
0713:                if (c == Float.TYPE || c == Float.class) {
0714:                    return new Float(value);
0715:                }
0716:                return super .__tojava__(c);
0717:            }
0718:
0719:            public int __cmp__(PyObject other) {
0720:                return float___cmp__(other);
0721:            }
0722:
0723:            final int float___cmp__(PyObject other) {
0724:                if (!canCoerce(other))
0725:                    return -2;
0726:                double v = coerce(other);
0727:                return value < v ? -1 : value > v ? 1 : 0;
0728:            }
0729:
0730:            public Object __coerce_ex__(PyObject other) {
0731:                if (other instanceof  PyFloat)
0732:                    return other;
0733:                else {
0734:                    if (other instanceof  PyInteger)
0735:                        return new PyFloat((double) ((PyInteger) other)
0736:                                .getValue());
0737:                    if (other instanceof  PyLong)
0738:                        return new PyFloat(((PyLong) other).doubleValue());
0739:                    else
0740:                        return Py.None;
0741:                }
0742:            }
0743:
0744:            private static final boolean canCoerce(PyObject other) {
0745:                return other instanceof  PyFloat || other instanceof  PyInteger
0746:                        || other instanceof  PyLong;
0747:            }
0748:
0749:            private static final double coerce(PyObject other) {
0750:                if (other instanceof  PyFloat)
0751:                    return ((PyFloat) other).value;
0752:                else if (other instanceof  PyInteger)
0753:                    return ((PyInteger) other).getValue();
0754:                else if (other instanceof  PyLong)
0755:                    return ((PyLong) other).doubleValue();
0756:                else
0757:                    throw Py.TypeError("xxx");
0758:            }
0759:
0760:            public PyObject __add__(PyObject right) {
0761:                return float___add__(right);
0762:            }
0763:
0764:            final PyObject float___add__(PyObject right) {
0765:                if (!canCoerce(right))
0766:                    return null;
0767:                double rightv = coerce(right);
0768:                return new PyFloat(value + rightv);
0769:            }
0770:
0771:            public PyObject __radd__(PyObject left) {
0772:                return float___radd__(left);
0773:            }
0774:
0775:            final PyObject float___radd__(PyObject left) {
0776:                return __add__(left);
0777:            }
0778:
0779:            public PyObject __sub__(PyObject right) {
0780:                return float___sub__(right);
0781:            }
0782:
0783:            final PyObject float___sub__(PyObject right) {
0784:                if (!canCoerce(right))
0785:                    return null;
0786:                double rightv = coerce(right);
0787:                return new PyFloat(value - rightv);
0788:            }
0789:
0790:            public PyObject __rsub__(PyObject left) {
0791:                return float___rsub__(left);
0792:            }
0793:
0794:            final PyObject float___rsub__(PyObject left) {
0795:                if (!canCoerce(left))
0796:                    return null;
0797:                double leftv = coerce(left);
0798:                return new PyFloat(leftv - value);
0799:            }
0800:
0801:            public PyObject __mul__(PyObject right) {
0802:                return float___mul__(right);
0803:            }
0804:
0805:            final PyObject float___mul__(PyObject right) {
0806:                if (!canCoerce(right))
0807:                    return null;
0808:                double rightv = coerce(right);
0809:                return new PyFloat(value * rightv);
0810:            }
0811:
0812:            public PyObject __rmul__(PyObject left) {
0813:                return float___rmul__(left);
0814:            }
0815:
0816:            final PyObject float___rmul__(PyObject left) {
0817:                return __mul__(left);
0818:            }
0819:
0820:            public PyObject __div__(PyObject right) {
0821:                return float___div__(right);
0822:            }
0823:
0824:            final PyObject float___div__(PyObject right) {
0825:                if (!canCoerce(right))
0826:                    return null;
0827:                if (Options.divisionWarning >= 2)
0828:                    Py.warning(Py.DeprecationWarning, "classic float division");
0829:                double rightv = coerce(right);
0830:                if (rightv == 0)
0831:                    throw Py.ZeroDivisionError("float division");
0832:                return new PyFloat(value / rightv);
0833:            }
0834:
0835:            public PyObject __rdiv__(PyObject left) {
0836:                return float___rdiv__(left);
0837:            }
0838:
0839:            final PyObject float___rdiv__(PyObject left) {
0840:                if (!canCoerce(left))
0841:                    return null;
0842:                if (Options.divisionWarning >= 2)
0843:                    Py.warning(Py.DeprecationWarning, "classic float division");
0844:                double leftv = coerce(left);
0845:                if (value == 0)
0846:                    throw Py.ZeroDivisionError("float division");
0847:                return new PyFloat(leftv / value);
0848:            }
0849:
0850:            public PyObject __floordiv__(PyObject right) {
0851:                return float___floordiv__(right);
0852:            }
0853:
0854:            final PyObject float___floordiv__(PyObject right) {
0855:                if (!canCoerce(right))
0856:                    return null;
0857:                double rightv = coerce(right);
0858:                if (rightv == 0)
0859:                    throw Py.ZeroDivisionError("float division");
0860:                return new PyFloat(Math.floor(value / rightv));
0861:            }
0862:
0863:            public PyObject __rfloordiv__(PyObject left) {
0864:                return float___rfloordiv__(left);
0865:            }
0866:
0867:            final PyObject float___rfloordiv__(PyObject left) {
0868:                if (!canCoerce(left))
0869:                    return null;
0870:                double leftv = coerce(left);
0871:                if (value == 0)
0872:                    throw Py.ZeroDivisionError("float division");
0873:                return new PyFloat(Math.floor(leftv / value));
0874:            }
0875:
0876:            public PyObject __truediv__(PyObject right) {
0877:                return float___truediv__(right);
0878:            }
0879:
0880:            final PyObject float___truediv__(PyObject right) {
0881:                if (!canCoerce(right))
0882:                    return null;
0883:                double rightv = coerce(right);
0884:                if (rightv == 0)
0885:                    throw Py.ZeroDivisionError("float division");
0886:                return new PyFloat(value / rightv);
0887:            }
0888:
0889:            public PyObject __rtruediv__(PyObject left) {
0890:                return float___rtruediv__(left);
0891:            }
0892:
0893:            final PyObject float___rtruediv__(PyObject left) {
0894:                if (!canCoerce(left))
0895:                    return null;
0896:                double leftv = coerce(left);
0897:                if (value == 0)
0898:                    throw Py.ZeroDivisionError("float division");
0899:                return new PyFloat(leftv / value);
0900:            }
0901:
0902:            private static double modulo(double x, double y) {
0903:                if (y == 0)
0904:                    throw Py.ZeroDivisionError("float modulo");
0905:                double z = Math.IEEEremainder(x, y);
0906:                if (z * y < 0)
0907:                    z += y;
0908:                return z;
0909:            }
0910:
0911:            public PyObject __mod__(PyObject right) {
0912:                return float___mod__(right);
0913:            }
0914:
0915:            final PyObject float___mod__(PyObject right) {
0916:                if (!canCoerce(right))
0917:                    return null;
0918:                double rightv = coerce(right);
0919:                return new PyFloat(modulo(value, rightv));
0920:            }
0921:
0922:            public PyObject __rmod__(PyObject left) {
0923:                return float___rmod__(left);
0924:            }
0925:
0926:            final PyObject float___rmod__(PyObject left) {
0927:                if (!canCoerce(left))
0928:                    return null;
0929:                double leftv = coerce(left);
0930:                return new PyFloat(modulo(leftv, value));
0931:            }
0932:
0933:            public PyObject __divmod__(PyObject right) {
0934:                return float___divmod__(right);
0935:            }
0936:
0937:            final PyObject float___divmod__(PyObject right) {
0938:                if (!canCoerce(right))
0939:                    return null;
0940:                double rightv = coerce(right);
0941:
0942:                if (rightv == 0)
0943:                    throw Py.ZeroDivisionError("float division");
0944:                double z = Math.floor(value / rightv);
0945:
0946:                return new PyTuple(new PyObject[] { new PyFloat(z),
0947:                        new PyFloat(value - z * rightv) });
0948:            }
0949:
0950:            public PyObject __rdivmod__(PyObject left) {
0951:                if (!canCoerce(left))
0952:                    return null;
0953:                double leftv = coerce(left);
0954:
0955:                if (value == 0)
0956:                    throw Py.ZeroDivisionError("float division");
0957:                double z = Math.floor(leftv / value);
0958:
0959:                return new PyTuple(new PyObject[] { new PyFloat(z),
0960:                        new PyFloat(leftv - z * value) });
0961:            }
0962:
0963:            final PyObject float___rdivmod__(PyObject left) {
0964:                return __rdivmod__(left);
0965:            }
0966:
0967:            public PyObject __pow__(PyObject right, PyObject modulo) {
0968:                return float___pow__(right, modulo);
0969:            }
0970:
0971:            final PyObject float___pow__(PyObject right, PyObject modulo) {
0972:                if (!canCoerce(right))
0973:                    return null;
0974:
0975:                if (modulo != null) {
0976:                    throw Py.TypeError("pow() 3rd argument not allowed "
0977:                            + "unless all arguments are integers");
0978:                }
0979:
0980:                return _pow(value, coerce(right), modulo);
0981:            }
0982:
0983:            final PyObject float___rpow__(PyObject left) {
0984:                return __rpow__(left);
0985:            }
0986:
0987:            public PyObject __rpow__(PyObject left) {
0988:                if (!canCoerce(left))
0989:                    return null;
0990:
0991:                return _pow(coerce(left), value, null);
0992:            }
0993:
0994:            private static PyFloat _pow(double value, double iw, PyObject modulo) {
0995:                // Rely completely on Java's pow function
0996:                if (iw == 0) {
0997:                    if (modulo != null)
0998:                        return new PyFloat(modulo(1.0, coerce(modulo)));
0999:                    return new PyFloat(1.0);
1000:                }
1001:                if (value == 0.0) {
1002:                    if (iw < 0.0)
1003:                        throw Py.ZeroDivisionError("0.0 cannot be raised to a "
1004:                                + "negative power");
1005:                    return new PyFloat(0);
1006:                }
1007:
1008:                if (value < 0 && iw != Math.floor(iw))
1009:                    throw Py
1010:                            .ValueError("negative number cannot be raised to a fractional power");
1011:
1012:                double ret = Math.pow(value, iw);
1013:                if (modulo == null) {
1014:                    return new PyFloat(ret);
1015:                } else {
1016:                    return new PyFloat(modulo(ret, coerce(modulo)));
1017:                }
1018:            }
1019:
1020:            public PyObject __neg__() {
1021:                return float___neg__();
1022:            }
1023:
1024:            final PyObject float___neg__() {
1025:                return new PyFloat(-value);
1026:            }
1027:
1028:            public PyObject __pos__() {
1029:                return float___pos__();
1030:            }
1031:
1032:            final PyObject float___pos__() {
1033:                return Py.newFloat(value);
1034:            }
1035:
1036:            public PyObject __invert__() {
1037:                throw Py.TypeError("bad operand type for unary ~");
1038:            }
1039:
1040:            public PyObject __abs__() {
1041:                return float___abs__();
1042:            }
1043:
1044:            final PyObject float___abs__() {
1045:                if (value >= 0)
1046:                    return Py.newFloat(value);
1047:                else
1048:                    return __neg__();
1049:            }
1050:
1051:            public PyObject __int__() {
1052:                return float___int__();
1053:            }
1054:
1055:            final PyInteger float___int__() {
1056:                if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
1057:                    return new PyInteger((int) value);
1058:                }
1059:                throw Py.OverflowError("float too large to convert");
1060:            }
1061:
1062:            public PyLong __long__() {
1063:                return float___long__();
1064:            }
1065:
1066:            final PyLong float___long__() {
1067:                return new PyLong(value);
1068:            }
1069:
1070:            public PyFloat __float__() {
1071:                return float___float__();
1072:            }
1073:
1074:            final PyFloat float___float__() {
1075:                return Py.newFloat(value);
1076:            }
1077:
1078:            public PyComplex __complex__() {
1079:                return new PyComplex(value, 0.);
1080:            }
1081:
1082:            public boolean isMappingType() throws PyIgnoreMethodTag {
1083:                return false;
1084:            }
1085:
1086:            public boolean isSequenceType() throws PyIgnoreMethodTag {
1087:                return false;
1088:            }
1089:
1090:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.