Top Description Fields Constructors Methods
org.python.core

public Class PySlice

extends PyObject
implements Traverseproc
Class Inheritance
All Implemented Interfaces
org.python.core.Traverseproc
Annotations
@ExposedType
name:slice
isBaseType:false
doc:slice([start,] stop[, step]) Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).
Imports
org.python.expose.ExposedGet, .ExposedMethod, .ExposedNew, .ExposedType

The Python slice object.

Field Summary

Modifier and TypeField and Description
public PyObject
public PyObject
public PyObject
public static final PyType
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
public
PySlice(PyObject start, PyObject stop, PyObject step)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__eq__(PyObject
the object to compare this with.
o
)

Overrides org.python.core.PyObject.__eq__.

Equivalent to the standard Python __eq__ method.

public PyObject
__ne__(PyObject
the object to compare this with.
o
)

Overrides org.python.core.PyObject.__ne__.

Equivalent to the standard Python __ne__ method.

public static int
private static final boolean
public final PyObject
public final PyObject
public final PyObject
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

public PyObject
public static PyObject[]

Returns:

an array with start at index 0 and stop at index 1
indices2
(PyObject
the object being sliced
obj
,
PyObject
the slice operation's start
start
,
PyObject
the slice operation's stop
stop
)

Calculate indices for the deprecated __get/set/delslice__ methods.

public int[]

Returns:

an array with the start at index 0, stop at index 1, step at index 2 and slicelength at index 3
indicesEx
(int length)

Calculates the actual indices of a slice with this slice's start, stop, step and slicelength values for a sequence of length len.

public boolean
pack-priv final int
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv static PyObject
slice_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

pack-priv final String
public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

public int
traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

Inherited from org.python.core.PyObject:
__abs____add____and____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____cmp____coerce____coerce_ex____complex____contains____delattr____delattr____delete____delitem____delitem____delslice____delslice____dir____div____divmod____ensure_finalizer____findattr____findattr____findattr_ex____finditem____finditem____finditem____float____floordiv____format____ge____get____getattr____getattr____getitem____getitem____getnewargs____getslice____getslice____gt____hash____hex____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____index____int____invert____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____le____len____long____lshift____lt____mod____mul____neg____nonzero____not____oct____or____pos____pow____pow____radd____rand____rawdir____rdiv____rdivmod____reduce____reduce_ex____reduce_ex____repr____rfloordiv____rlshift____rmod____rmul____ror____rpow____rrshift____rshift____rsub____rtruediv____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____str____sub____tojava____truediv____trunc____unicode____xor___add_and_basic_add_basic_and_basic_div_basic_divmod_basic_floordiv_basic_iadd_basic_iand_basic_idiv_basic_idivmod_basic_ifloordiv_basic_ilshift_basic_imod_basic_imul_basic_ior_basic_ipow_basic_irshift_basic_isub_basic_itruediv_basic_ixor_basic_lshift_basic_mod_basic_mul_basic_or_basic_pow_basic_rshift_basic_sub_basic_truediv_basic_xor_callextra_cmp_coerce_div_divmod_doget_doget_doset_eq_floordiv_ge_gt_iadd_iand_idiv_idivmod_ifloordiv_ilshift_imod_imul_in_ior_ipow_irshift_is_isnot_isub_itruediv_ixor_jcall_jcallexc_jthrow_le_lshift_lt_mod_mul_ne_notin_or_pow_rshift_sub_truediv_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthconjugatedelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisNumberTypeisSequenceTypejdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___contains__object___delattr__object___delattr__object___findattr__object___format__object___getattribute__object___hash__object___init__object___new__object___reduce__object___reduce_ex__object___setattr__object___setattr__object___subclasshook__object_toStringproxyInitreadonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage

Field Detail

startback to summary
public PyObject start
Annotations
@ExposedGet
doc:
stepback to summary
public PyObject step
Annotations
@ExposedGet
doc:
stopback to summary
public PyObject stop
Annotations
@ExposedGet
doc:
TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

PySliceback to summary
public PySlice()
PySliceback to summary
public PySlice(PyObject start, PyObject stop, PyObject step)

Method Detail

__eq__back to summary
public PyObject __eq__(PyObject o)

Overrides org.python.core.PyObject.__eq__.

Doc from org.python.core.PyObject.__eq__.

Equivalent to the standard Python __eq__ method.

Parameters
o:PyObject

the object to compare this with.

Returns:PyObject

the result of the comparison.

Annotations
@Override

__ne__back to summary
public PyObject __ne__(PyObject o)

Overrides org.python.core.PyObject.__ne__.

Doc from org.python.core.PyObject.__ne__.

Equivalent to the standard Python __ne__ method.

Parameters
o:PyObject

the object to compare this with.

Returns:PyObject

the result of the comparison.

Annotations
@Override

calculateSliceIndexback to summary
public static int calculateSliceIndex(PyObject v)
eqback to summary
private static final boolean eq(PyObject o1, PyObject o2)
getStartback to summary
public final PyObject getStart()
getStepback to summary
public final PyObject getStep()
getStopback to summary
public final PyObject getStop()
hashCodeback to summary
public int hashCode()

Overrides org.python.core.PyObject.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override

indicesback to summary
public PyObject indices(PyObject len)
indices2back to summary
public static PyObject[] indices2(PyObject obj, PyObject start, PyObject stop)

Calculate indices for the deprecated __get/set/delslice__ methods.

Parameters
obj:PyObject

the object being sliced

start:PyObject

the slice operation's start

stop:PyObject

the slice operation's stop

Returns:PyObject[]

an array with start at index 0 and stop at index 1

indicesExback to summary
public int[] indicesEx(int length)

Calculates the actual indices of a slice with this slice's start, stop, step and slicelength values for a sequence of length len.

Returns:int[]

an array with the start at index 0, stop at index 1, step at index 2 and slicelength at index 3

refersDirectlyToback to summary
public boolean refersDirectlyTo(PyObject ob)

Implements org.python.core.Traverseproc.refersDirectlyTo.

Doc from org.python.core.Traverseproc.refersDirectlyTo.

Optional operation. Should only be implemented if it is more efficient than calling traverse(Visitproc, Object) with a visitproc that just watches out for ob. Must return false if ob is null.

Annotations
@Override
slice___hash__back to summary
pack-priv final int slice___hash__()
Annotations
@ExposedMethod
doc:x.__hash__() <==> hash(x)
slice___reduce__back to summary
pack-priv final PyObject slice___reduce__()
Annotations
@ExposedMethod
slice___reduce_ex__back to summary
pack-priv final PyObject slice___reduce_ex__(PyObject protocol)
Annotations
@ExposedMethod
defaults:Py.None
slice_indicesback to summary
pack-priv final PyObject slice_indices(PyObject len)
Annotations
@ExposedMethod
doc:S.indices(len) -> (start, stop, stride) Assuming a sequence of length len, calculate the start and stop indices, and the stride length of the extended slice described by S. Out of bounds indices are clipped in a manner consistent with the handling of normal slices.
slice_newback to summary
pack-priv static PyObject slice_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)
Annotations
@ExposedNew
slice_toStringback to summary
pack-priv final String slice_toString()
Annotations
@ExposedMethod
names:__repr__
doc:x.__repr__() <==> repr(x)
toStringback to summary
public String toString()

Overrides org.python.core.PyObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override

traverseback to summary
public int traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Doc from org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects. Like in CPython, arg must be passed unmodified to visit as its second parameter. If Visitproc#visit(PyObject, Object) returns nonzero, this return value must be returned immediately by traverse. Visitproc#visit(PyObject, Object) must not be called with a null PyObject-argument.

Annotations
@Override