SliceSpec class
Slice specification for N-dimensional array slicing
Represents a slice along a single dimension, similar to Python's slice notation. Supports:
- Single index:
5 - Range:
start:stop:step - Open-ended:
:stop,start:,: - Negative indices (from end)
Example:
// Single index
var s1 = SliceSpec.single(5);
// Range [0:10]
var s2 = SliceSpec(0, 10);
// Range [0:10:2] (every other element)
var s3 = SliceSpec(0, 10, step: 2);
// All elements [:]
var s4 = SliceSpec.all();
// From start to 10 [:10]
var s5 = SliceSpec(null, 10);
// From 5 to end [5:]
var s6 = SliceSpec(5, null);
Constructors
- SliceSpec(int? start, int? stop, {int step = 1})
- Create a slice specification
- SliceSpec.all()
-
Create a slice that selects all elements
: - SliceSpec.single(int index)
- Create a single-index slice (not a range)
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isSingleIndex → bool
-
Check if this is a single index (not a range)
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- start → int?
-
Start index (inclusive), null means from beginning
final
- step → int
-
Step size, defaults to 1
final
- stop → int?
-
Stop index (exclusive), null means to end
final
Methods
-
indices(
int dimSize) → List< int> - Get the actual indices this slice will select
-
length(
int dimSize) → int - Calculate the number of elements this slice will select
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolve(
int dimSize) → (int, int, int) - Resolve slice against a dimension size
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override