Package ai.timefold.jpyinterpreter.types
Class PythonSlice
java.lang.Object
ai.timefold.jpyinterpreter.types.AbstractPythonLikeObject
ai.timefold.jpyinterpreter.types.PythonSlice
- All Implemented Interfaces:
PythonLikeObject
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic PythonLikeTypestatic PythonLikeTypefinal PythonLikeObjectfinal PythonLikeObjectfinal PythonLikeObjectFields inherited from class ai.timefold.jpyinterpreter.types.AbstractPythonLikeObject
OBJECT_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionPythonSlice(PythonLikeObject start, PythonLikeObject stop, PythonLikeObject step) -
Method Summary
Modifier and TypeMethodDescriptionstatic intasIntIndexForLength(PythonInteger index, int length) Convert index into a index for a sequence of lengthlength.static intasValidEndIntIndexForLength(PythonInteger index, int length) Convert index into a VALID end index for a sequence of lengthlength. bounding it to the range [0, length].static intasValidStartIntIndexForLength(PythonInteger index, int length) Convert index into a VALID start index for a sequence of lengthlength. bounding it to the range [0, length - 1].booleanintgetSliceSize(int length) intgetStartIndex(int length) intgetStopIndex(int length) intinthashCode()indices(PythonInteger sequenceLength) voiditerate(int length, PythonSlice.SliceConsumer consumer) pythonEquals(PythonSlice other) Methods inherited from class ai.timefold.jpyinterpreter.types.AbstractPythonLikeObject
$deleteAttribute, $getAttributeOrNull, $getType, $setAttribute, getExtraAttributeMap, setAttribute, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ai.timefold.jpyinterpreter.PythonLikeObject
$getAttributeOrError, $getGenericType, $method$__delattr__, $method$__eq__, $method$__format__, $method$__format__, $method$__getattribute__, $method$__ne__, $method$__repr__, $method$__setattr__, $method$__str__
-
Field Details
-
SLICE_TYPE
-
$TYPE
-
start
-
stop
-
step
-
-
Constructor Details
-
PythonSlice
-
-
Method Details
-
asIntIndexForLength
Convert index into a index for a sequence of lengthlength. May be outside the range [0, length - 1]. Use for indexing into a sequence.- Parameters:
index- The given indexlength- The length- Returns:
- index, if index in [0, length -1]; length - index, if index < 0.
-
asValidStartIntIndexForLength
Convert index into a VALID start index for a sequence of lengthlength. bounding it to the range [0, length - 1]. Use for sequence operations that need to search an portion of a sequence.- Parameters:
index- The given indexlength- The length- Returns:
- index, if index in [0, length -1]; length - index, if index < 0 and -index ≤ length; otherwise 0 (if the index represent a position before 0) or length - 1 (if the index represent a position after the sequence).
-
asValidEndIntIndexForLength
Convert index into a VALID end index for a sequence of lengthlength. bounding it to the range [0, length]. Use for sequence operations that need to search an portion of a sequence.- Parameters:
index- The given indexlength- The length- Returns:
- index, if index in [0, length]; length - index, if index < 0 and -index ≤ length + 1; otherwise 0 (if the index represent a position before 0) or length (if the index represent a position after the sequence).
-
indices
-
getStartIndex
public int getStartIndex(int length) -
getStopIndex
public int getStopIndex(int length) -
getStrideLength
public int getStrideLength() -
iterate
-
getSliceSize
public int getSliceSize(int length) -
pythonEquals
-
pythonHash
-
equals
-
hashCode
public int hashCode() -
$method$__hash__
-