Skip to content

Commit 315c6ad

Browse files
committed
Move EfficientSubstep up in inheritance hierarchy
1 parent 84a12db commit 315c6ad

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/main/scala/scala/compat/java8/converterImpl/StepsLikeGapped.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import Stepper._
1111
* is used as a signal to look for more entries in the array. (This also
1212
* allows a subclass to traverse a sublist by updating `currentEntry`.)
1313
*/
14-
private[java8] abstract class AbstractStepsLikeGapped[Sub >: Null, Semi <: Sub](protected val underlying: Array[AnyRef], protected var i0: Int, protected var iN: Int) {
14+
private[java8] abstract class AbstractStepsLikeGapped[Sub >: Null, Semi <: Sub](protected val underlying: Array[AnyRef], protected var i0: Int, protected var iN: Int)
15+
extends EfficientSubstep {
16+
1517
protected var currentEntry: AnyRef = null
1618
def semiclone(half: Int): Semi
1719
def characteristics(): Int = Ordered
@@ -37,7 +39,6 @@ private[java8] abstract class AbstractStepsLikeGapped[Sub >: Null, Semi <: Sub](
3739
private[java8] abstract class StepsLikeGapped[A, STA >: Null <: StepsLikeGapped[A, _]](_underlying: Array[AnyRef], _i0: Int, _iN: Int)
3840
extends AbstractStepsLikeGapped[AnyStepper[A], STA](_underlying, _i0, _iN)
3941
with AnyStepper[A]
40-
with EfficientSubstep
4142
{}
4243

4344
/** Abstracts the process of stepping through an incompletely filled array of `AnyRefs`
@@ -47,7 +48,6 @@ private[java8] abstract class StepsLikeGapped[A, STA >: Null <: StepsLikeGapped[
4748
private[java8] abstract class StepsDoubleLikeGapped[STD >: Null <: StepsDoubleLikeGapped[_]](_underlying: Array[AnyRef], _i0: Int, _iN: Int)
4849
extends AbstractStepsLikeGapped[DoubleStepper, STD](_underlying, _i0, _iN)
4950
with DoubleStepper
50-
with EfficientSubstep
5151
{}
5252

5353
/** Abstracts the process of stepping through an incompletely filled array of `AnyRefs`
@@ -57,7 +57,6 @@ private[java8] abstract class StepsDoubleLikeGapped[STD >: Null <: StepsDoubleLi
5757
private[java8] abstract class StepsIntLikeGapped[STI >: Null <: StepsIntLikeGapped[_]](_underlying: Array[AnyRef], _i0: Int, _iN: Int)
5858
extends AbstractStepsLikeGapped[IntStepper, STI](_underlying, _i0, _iN)
5959
with IntStepper
60-
with EfficientSubstep
6160
{}
6261

6362
/** Abstracts the process of stepping through an incompletely filled array of `AnyRefs`
@@ -67,5 +66,4 @@ private[java8] abstract class StepsIntLikeGapped[STI >: Null <: StepsIntLikeGapp
6766
private[java8] abstract class StepsLongLikeGapped[STL >: Null <: StepsLongLikeGapped[_]](_underlying: Array[AnyRef], _i0: Int, _iN: Int)
6867
extends AbstractStepsLikeGapped[LongStepper, STL](_underlying, _i0, _iN)
6968
with LongStepper
70-
with EfficientSubstep
7169
{}

src/main/scala/scala/compat/java8/converterImpl/StepsLikeIndexed.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import scala.compat.java8.collectionImpl._
66
import Stepper._
77

88
/** Abstracts all the generic operations of stepping over an indexable collection */
9-
private[java8] abstract class AbstractStepsLikeIndexed[Sub >: Null, Semi <: Sub](protected var i0: Int, protected var iN: Int) {
9+
private[java8] abstract class AbstractStepsLikeIndexed[Sub >: Null, Semi <: Sub](protected var i0: Int, protected var iN: Int)
10+
extends EfficientSubstep {
11+
1012
def semiclone(half: Int): Semi
1113
def characteristics(): Int = Ordered + Sized + SubSized
1214
def estimateSize(): Long = iN - i0
@@ -26,26 +28,22 @@ private[java8] abstract class AbstractStepsLikeIndexed[Sub >: Null, Semi <: Sub]
2628
private[java8] abstract class StepsLikeIndexed[A, STA >: Null <: StepsLikeIndexed[A, _]](_i0: Int, _iN: Int)
2729
extends AbstractStepsLikeIndexed[AnyStepper[A], STA](_i0, _iN)
2830
with AnyStepper[A]
29-
with EfficientSubstep
3031
{}
3132

3233
/** Abstracts the operation of stepping over an indexable collection of Doubles */
3334
private[java8] abstract class StepsDoubleLikeIndexed[STD >: Null <: StepsDoubleLikeIndexed[_]](_i0: Int, _iN: Int)
3435
extends AbstractStepsLikeIndexed[DoubleStepper, STD](_i0, _iN)
3536
with DoubleStepper
36-
with EfficientSubstep
3737
{}
3838

3939
/** Abstracts the operation of stepping over an indexable collection of Ints */
4040
private[java8] abstract class StepsIntLikeIndexed[STI >: Null <: StepsIntLikeIndexed[_]](_i0: Int, _iN: Int)
4141
extends AbstractStepsLikeIndexed[IntStepper, STI](_i0, _iN)
4242
with IntStepper
43-
with EfficientSubstep
4443
{}
4544

4645
/** Abstracts the operation of stepping over an indexable collection of Longs */
4746
private[java8] abstract class StepsLongLikeIndexed[STL >: Null <: StepsLongLikeIndexed[_]](_i0: Int, _iN: Int)
4847
extends AbstractStepsLikeIndexed[LongStepper, STL](_i0, _iN)
4948
with LongStepper
50-
with EfficientSubstep
5149
{}

src/main/scala/scala/compat/java8/converterImpl/StepsLikeSliced.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import Stepper._
99
* `next` must update `i` but not `i0` so that later splitting steps can keep track of whether the
1010
* collection needs some sort of modification before transmission to the subclass.
1111
*/
12-
private[java8] abstract class AbstractStepsLikeSliced[Coll, Sub >: Null, Semi <: Sub](protected var underlying: Coll, protected var i: Int, protected var iN: Int) {
12+
private[java8] abstract class AbstractStepsLikeSliced[Coll, Sub >: Null, Semi <: Sub](protected var underlying: Coll, protected var i: Int, protected var iN: Int)
13+
extends EfficientSubstep {
14+
1315
protected var i0: Int = i
1416
def semiclone(halfHint: Int): Semi // Must really do all the work for both this and cloned collection!
1517
def characteristics(): Int = Ordered
@@ -21,26 +23,22 @@ private[java8] abstract class AbstractStepsLikeSliced[Coll, Sub >: Null, Semi <:
2123
private[java8] abstract class StepsLikeSliced[A, AA, STA >: Null <: StepsLikeSliced[A, AA, _]](_underlying: AA, _i0: Int, _iN: Int)
2224
extends AbstractStepsLikeSliced[AA, AnyStepper[A], STA](_underlying, _i0, _iN)
2325
with AnyStepper[A]
24-
with EfficientSubstep
2526
{}
2627

2728
/** Abstracts the operation of stepping over a collection of Doubles that can be efficiently sliced or otherwise subdivided */
2829
private[java8] abstract class StepsDoubleLikeSliced[AA, STA >: Null <: StepsDoubleLikeSliced[AA, STA]](_underlying: AA, _i0: Int, _iN: Int)
2930
extends AbstractStepsLikeSliced[AA, DoubleStepper, STA](_underlying, _i0, _iN)
3031
with DoubleStepper
31-
with EfficientSubstep
3232
{}
3333

3434
/** Abstracts the operation of stepping over a collection of Ints that can be efficiently sliced or otherwise subdivided */
3535
private[java8] abstract class StepsIntLikeSliced[AA, STA >: Null <: StepsIntLikeSliced[AA, STA]](_underlying: AA, _i0: Int, _iN: Int)
3636
extends AbstractStepsLikeSliced[AA, IntStepper, STA](_underlying, _i0, _iN)
3737
with IntStepper
38-
with EfficientSubstep
3938
{}
4039

4140
/** Abstracts the operation of stepping over a collection of Longs that can be efficiently sliced or otherwise subdivided */
4241
private[java8] abstract class StepsLongLikeSliced[AA, STA >: Null <: StepsLongLikeSliced[AA, STA]](_underlying: AA, _i0: Int, _iN: Int)
4342
extends AbstractStepsLikeSliced[AA, LongStepper, STA](_underlying, _i0, _iN)
4443
with LongStepper
45-
with EfficientSubstep
4644
{}

0 commit comments

Comments
 (0)