Revision: 6222
http://jython.svn.sourceforge.net/jython/?rev=6222&view=rev
Author: zyasoft
Date: 2009-04-12 02:14:00 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Fixed bulk List ops on PyTuple - actual usage doesn't expect that
elements are converted to/from Python proxies.
Modified Paths:
--------------
branches/newlist/src/org/python/core/PyTuple.java
Modified: branches/newlist/src/org/python/core/PyTuple.java
===================================================================
--- branches/newlist/src/org/python/core/PyTuple.java 2009-04-12 00:21:44 UTC (rev 6221)
+++ branches/newlist/src/org/python/core/PyTuple.java 2009-04-12 02:14:00 UTC (rev 6222)
@@ -447,23 +447,12 @@
@Override
public boolean contains(Object o) {
- PyObject converted = Py.java2py(o);
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(converted)) {
- return true;
- }
- }
- return false;
+ return getList().contains(o);
}
@Override
public boolean containsAll(Collection c) {
- if (c instanceof PySequenceList) {
- return getList().containsAll(c);
- } else {
- //XXX: FJW this seems unnecessary.
- return getList().containsAll(new PyList(c));
- }
+ return getList().containsAll(c);
}
@Override
@@ -488,13 +477,7 @@
@Override
public int indexOf(Object o) {
- PyObject converted = Py.java2py(o);
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(converted)) {
- return i;
- }
- }
- return -1;
+ return getList().indexOf(o);
}
@Override
@@ -504,24 +487,17 @@
@Override
public int lastIndexOf(Object o) {
- PyObject converted = Py.java2py(o);
- int lastIndex = -1;
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(converted)) {
- lastIndex = i;
- }
- }
- return lastIndex;
+ return getList().lastIndexOf(o);
}
@Override
public void pyadd(int index, PyObject element) {
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException();
}
@Override
public boolean pyadd(PyObject o) {
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException();
}
@Override
@@ -531,7 +507,7 @@
@Override
public void remove(int start, int stop) {
- throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|