Class PyXRange

  • All Implemented Interfaces:
    java.io.Serializable

    public class PyXRange
    extends PySequence
    The builtin xrange type.
    See Also:
    Serialized Form
    • Field Detail

      • TYPE

        public static final PyType TYPE
    • Constructor Detail

      • PyXRange

        public PyXRange​(int ihigh)
      • PyXRange

        public PyXRange​(int ilow,
                        int ihigh)
      • PyXRange

        public PyXRange​(int ilow,
                        int ihigh,
                        int istep)
    • Method Detail

      • __len__

        public int __len__()
        Description copied from class: PyObject
        Equivalent to the standard Python __len__ method. Part of the mapping discipline.
        Overrides:
        __len__ in class PyObject
        Returns:
        the length of the object
      • __getitem__

        public PyObject __getitem__​(PyObject index)
        Description copied from class: PyObject
        Equivalent to the standard Python __getitem__ method. This method should not be overridden. Override the __finditem__ method instead.
        Overrides:
        __getitem__ in class PySequence
        Parameters:
        index - the key to lookup in this container.
        Returns:
        the value corresponding to that key.
        See Also:
        PyObject.__finditem__(PyObject)
      • __iter__

        public PyObject __iter__()
        Description copied from class: PyObject
        Return an iterator that is used to iterate the element of this sequence. From version 2.2, this method is the primary protocol for looping over sequences.

        If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:

         public PyObject __iter__() {
             return new PySequenceIter(this);
         }
         
        When iterating over a python sequence from java code, it should be done with code like this:
         for (PyObject item : seq.asIterable()) {
             // Do somting with item
         }
         
        Overrides:
        __iter__ in class PySequence
      • xrange___iter__

        public PyObject xrange___iter__()
      • xrange___reversed__

        public PyObject xrange___reversed__()
      • xrange___reduce__

        public PyObject xrange___reduce__()
      • __reduce__

        public PyObject __reduce__()
        Description copied from class: PyObject
        Used for pickling. Default implementation calls object___reduce__.
        Overrides:
        __reduce__ in class PyObject
        Returns:
        a tuple of (class, tuple)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class PyObject
      • __tojava__

        public java.lang.Object __tojava__​(java.lang.Class<?> c)
        Description copied from class: PyObject
        Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special object Py.NoConversion if this PyObject can not be converted to the desired Java class.
        Overrides:
        __tojava__ in class PySequence
        Parameters:
        c - the Class to convert this PyObject to.