From: <pj...@us...> - 2009-04-19 21:00:15
|
Revision: 6246 http://jython.svn.sourceforge.net/jython/?rev=6246&view=rev Author: pjenvey Date: 2009-04-19 20:59:54 +0000 (Sun, 19 Apr 2009) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/jython/src/org/python/core/PyTuple.java Modified: trunk/jython/src/org/python/core/PyTuple.java =================================================================== --- trunk/jython/src/org/python/core/PyTuple.java 2009-04-19 00:01:40 UTC (rev 6245) +++ trunk/jython/src/org/python/core/PyTuple.java 2009-04-19 20:59:54 UTC (rev 6246) @@ -3,7 +3,6 @@ import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.ListIterator; @@ -20,7 +19,11 @@ public class PyTuple extends PySequenceList implements List { public static final PyType TYPE = PyType.fromClass(PyTuple.class); + private final PyObject[] array; + + private volatile List<PyObject> cachedList = null; + private static final PyTuple EMPTY_TUPLE = new PyTuple(); public PyTuple() { @@ -59,7 +62,6 @@ private static PyTuple fromArrayNoCopy(PyObject[] elements) { return new PyTuple(elements, false); } - private volatile List<PyObject> cachedList = null; List<PyObject> getList() { if (cachedList == null) { @@ -70,8 +72,8 @@ @ExposedNew final static PyObject tuple_new(PyNewWrapper new_, boolean init, PyType subtype, - PyObject[] args, String[] keywords) { - ArgParser ap = new ArgParser("newtuple", args, keywords, new String[]{"sequence"}, 0); + PyObject[] args, String[] keywords) { + ArgParser ap = new ArgParser("tuple", args, keywords, new String[] {"sequence"}, 0); PyObject S = ap.getPyObject(0, null); if (new_.for_type == subtype) { if (S == null) { @@ -115,10 +117,8 @@ System.arraycopy(array, start, newArray, 0, stop - start); return fromArrayNoCopy(newArray); } - int j = 0; - for (int i = start; j < n; i += step) { + for (int i = start, j = 0; j < n; i += step, j++) { newArray[j] = array[i]; - j++; } return fromArrayNoCopy(newArray); } @@ -329,7 +329,6 @@ } else if (fromIndex > toIndex) { throw new IllegalArgumentException(); } - System.err.println("subList" + fromIndex + "," + toIndex); PyObject elements[] = new PyObject[toIndex - fromIndex]; for (int i = 0, j = fromIndex; i < elements.length; i++, j++) { elements[i] = array[j]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |