コード例 #1
0
 @ExposedMethod(
     defaults = {"null", "null"},
     doc = BuiltinDocs.list_index_doc)
 final synchronized int list_index(PyObject o, PyObject start, PyObject stop) {
   int startInt = start == null ? 0 : PySlice.calculateSliceIndex(start);
   int stopInt = stop == null ? size() : PySlice.calculateSliceIndex(stop);
   return list_index(o, startInt, stopInt);
 }
コード例 #2
0
 public PyObject __getslice__(PyObject start, PyObject stop, PyObject step) { // ???
   if (step != null) {
     return __getitem__(new PySlice(start, stop, step));
   }
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__getslice__");
   if (impl != null) {
     PyObject[] indices = PySlice.indices2(this, start, stop);
     return impl.__get__(this, self_type).__call__(indices[0], indices[1]);
   }
   return super.__getslice__(start, stop, step);
 }
コード例 #3
0
 public void __setslice__(PyObject start, PyObject stop, PyObject step, PyObject value) {
   if (step != null) {
     __setitem__(new PySlice(start, stop, step), value);
     return;
   }
   PyType self_type = getType();
   PyObject impl = self_type.lookup("__setslice__");
   if (impl != null) {
     PyObject[] indices = PySlice.indices2(this, start, stop);
     impl.__get__(this, self_type).__call__(indices[0], indices[1], value);
     return;
   }
   super.__setslice__(start, stop, step, value);
 }