From: <pj...@us...> - 2009-04-09 01:26:43
|
Revision: 6193 http://jython.svn.sourceforge.net/jython/?rev=6193&view=rev Author: pjenvey Date: 2009-04-09 01:26:22 +0000 (Thu, 09 Apr 2009) Log Message: ----------- rearrange per coding standards Modified Paths: -------------- trunk/jython/src/org/python/core/PyObject.java Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2009-04-08 21:45:35 UTC (rev 6192) +++ trunk/jython/src/org/python/core/PyObject.java 2009-04-09 01:26:22 UTC (rev 6193) @@ -7,6 +7,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; + import org.python.expose.ExposedDelete; import org.python.expose.ExposedGet; import org.python.expose.ExposedMethod; @@ -24,26 +25,62 @@ public static final PyType TYPE = PyType.fromClass(PyObject.class); - //XXX: in CPython object.__new__ has a doc string... - @ExposedNew - @ExposedMethod(doc = BuiltinDocs.object___init___doc) - final void object___init__(PyObject[] args, String[] keywords) { -// XXX: attempted fix for object(foo=1), etc -// XXX: this doesn't work for metaclasses, for some reason -// if (args.length > 0) { -// throw Py.TypeError("default __new__ takes no parameters"); -// } + /** The type of this object. */ + PyType objtype; + /** + * An underlying Java instance that this object is wrapping or is a subclass + * of. Anything attempting to use the proxy should go through {@link #getJavaProxy()} + * which ensures that it's initialized. + */ + protected Object javaProxy; + + /** Primitives classes their wrapper classes. */ + private static final Map<Class<?>, Class<?>> primitiveMap = Generic.map(); + + static { + primitiveMap.put(Character.TYPE, Character.class); + primitiveMap.put(Boolean.TYPE, Boolean.class); + primitiveMap.put(Byte.TYPE, Byte.class); + primitiveMap.put(Short.TYPE, Short.class); + primitiveMap.put(Integer.TYPE, Integer.class); + primitiveMap.put(Long.TYPE, Long.class); + primitiveMap.put(Float.TYPE, Float.class); + primitiveMap.put(Double.TYPE, Double.class); } + public PyObject(PyType objtype) { + this.objtype = objtype; + } + /** - * An underlying Java instance that this object is wrapping or is a subclass of. Anything - * attempting to use the proxy should go through {@link #getJavaProxy()} which ensures that it's - * initialized. + * The standard constructor for a <code>PyObject</code>. It will set the <code>objtype</code> + * field to correspond to the specific subclass of <code>PyObject</code> being instantiated. + **/ + public PyObject() { + objtype = PyType.fromClass(getClass()); + } + + /** + * Creates the PyObject for the base type. The argument only exists to make the constructor + * distinct. */ - protected Object javaProxy; + PyObject(boolean ignored) { + objtype = (PyType)this; + } - PyType objtype; + //XXX: in CPython object.__new__ has a doc string... + @ExposedNew + @ExposedMethod(doc = BuiltinDocs.object___init___doc) + final void object___init__(PyObject[] args, String[] keywords) { + // XXX: attempted fix for object(foo=1), etc + // XXX: this doesn't work for metaclasses, for some reason + /* + if (args.length > 0) { + throw Py.TypeError("default __new__ takes no parameters"); + } + */ + } @ExposedGet(name = "__class__") public PyType getType() { @@ -82,27 +119,7 @@ return Py.None; } - public PyObject(PyType objtype) { - this.objtype = objtype; - } - /** - * Creates the PyObject for the base type. The argument only exists to make the constructor - * distinct. - */ - PyObject(boolean ignored) { - objtype = (PyType)this; - } - - /** - * The standard constructor for a <code>PyObject</code>. It will set the <code>objtype</code> - * field to correspond to the specific subclass of <code>PyObject</code> being instantiated. - **/ - public PyObject() { - objtype = PyType.fromClass(getClass()); - } - - /** * Dispatch __init__ behavior */ public void dispatch__init__(PyType type, PyObject[] args, String[] keywords) {} @@ -288,18 +305,6 @@ return javaProxy; } - private static final Map<Class<?>, Class<?>> primitiveMap = Generic.map(); - static { - primitiveMap.put(Character.TYPE, Character.class); - primitiveMap.put(Boolean.TYPE, Boolean.class); - primitiveMap.put(Byte.TYPE, Byte.class); - primitiveMap.put(Short.TYPE, Short.class); - primitiveMap.put(Integer.TYPE, Integer.class); - primitiveMap.put(Long.TYPE, Long.class); - primitiveMap.put(Float.TYPE, Float.class); - primitiveMap.put(Double.TYPE, Double.class); - } - /** * The basic method to override when implementing a callable object. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |