@@ -7,9 +7,11 @@ import scala.compat.java8.runtime._
77
88import Stepper ._
99
10- // //////////////////////////
10+ // ///////////////////////////
11+ // Stepper implementations //
12+ // ///////////////////////////
13+
1114// Steppers for keys (type of HashEntry doesn't matter)
12- // //////////////////////////
1315
1416private [java8] class StepsAnyHashTableKey [K , HE <: collection.mutable.HashEntry [K , HE ]](_underlying : Array [collection.mutable.HashEntry [K , HE ]], _i0 : Int , _iN : Int )
1517extends StepsLikeGapped [K , StepsAnyHashTableKey [K , HE ]](_underlying.asInstanceOf [Array [AnyRef ]], _i0, _iN) {
@@ -35,10 +37,8 @@ extends StepsLongLikeGapped[StepsLongHashTableKey[HE]](_underlying.asInstanceOf[
3537 def semiclone (half : Int ) = new StepsLongHashTableKey [HE ](underlying.asInstanceOf [Array [collection.mutable.HashEntry [Long , HE ]]], i0, half)
3638}
3739
38- // //////////////////////////
3940// Steppers for entries stored in DefaultEntry HashEntry
4041// (both for key-value pair and for values alone)
41- // //////////////////////////
4242
4343private [java8] class StepsAnyDefaultHashTable [K , V ](_underlying : Array [collection.mutable.HashEntry [K , collection.mutable.DefaultEntry [K , V ]]], _i0 : Int , _iN : Int )
4444extends StepsLikeGapped [(K , V ), StepsAnyDefaultHashTable [K , V ]](_underlying.asInstanceOf [Array [AnyRef ]], _i0, _iN) {
@@ -85,10 +85,8 @@ extends StepsLongLikeGapped[StepsLongDefaultHashTableValue[K]](_underlying.asIns
8585 new StepsLongDefaultHashTableValue [K ](underlying.asInstanceOf [Array [collection.mutable.HashEntry [K , collection.mutable.DefaultEntry [K , Long ]]]], i0, half)
8686}
8787
88- // //////////////////////////
8988// Steppers for entries stored in LinkedEntry HashEntry
9089// (both for key-value pair and for values alone)
91- // //////////////////////////
9290
9391private [java8] class StepsAnyLinkedHashTable [K , V ](_underlying : Array [collection.mutable.HashEntry [K , collection.mutable.LinkedEntry [K , V ]]], _i0 : Int , _iN : Int )
9492extends StepsLikeGapped [(K , V ), StepsAnyLinkedHashTable [K , V ]](_underlying.asInstanceOf [Array [AnyRef ]], _i0, _iN) {
@@ -135,3 +133,127 @@ extends StepsLongLikeGapped[StepsLongLinkedHashTableValue[K]](_underlying.asInst
135133 new StepsLongLinkedHashTableValue [K ](underlying.asInstanceOf [Array [collection.mutable.HashEntry [K , collection.mutable.LinkedEntry [K , Long ]]]], i0, half)
136134}
137135
136+
137+ // ////////////////////////
138+ // Value class adapters //
139+ // ////////////////////////
140+
141+ // Steppers for keys (type of HashEntry doesn't matter)
142+
143+ final class RichHashTableKeyCanStep [K , HE >: Null <: collection.mutable.HashEntry [K , HE ]](private val underlying : collection.mutable.HashTable [K , HE ])
144+ extends AnyVal with MakesAnyKeyStepper [K ] {
145+ @ inline def keyStepper : AnyStepper [K ] with EfficientSubstep = {
146+ val tbl = CollectionInternals .getTable[K , HE ](underlying)
147+ new StepsAnyHashTableKey (tbl, 0 , tbl.length)
148+ }
149+ }
150+
151+ final class RichHashTableDoubleKeyCanStep [HE >: Null <: collection.mutable.HashEntry [Double , HE ]](private val underlying : collection.mutable.HashTable [Double , HE ])
152+ extends AnyVal with MakesDoubleKeyStepper {
153+ @ inline def keyStepper : DoubleStepper with EfficientSubstep = {
154+ val tbl = CollectionInternals .getTable[Double , HE ](underlying)
155+ new StepsDoubleHashTableKey (tbl, 0 , tbl.length)
156+ }
157+ }
158+
159+ final class RichHashTableIntKeyCanStep [HE >: Null <: collection.mutable.HashEntry [Int , HE ]](private val underlying : collection.mutable.HashTable [Int , HE ])
160+ extends AnyVal with MakesIntKeyStepper {
161+ @ inline def keyStepper : IntStepper with EfficientSubstep = {
162+ val tbl = CollectionInternals .getTable[Int , HE ](underlying)
163+ new StepsIntHashTableKey (tbl, 0 , tbl.length)
164+ }
165+ }
166+
167+ final class RichHashTableLongKeyCanStep [HE >: Null <: collection.mutable.HashEntry [Long , HE ]](private val underlying : collection.mutable.HashTable [Long , HE ])
168+ extends AnyVal with MakesLongKeyStepper {
169+ @ inline def keyStepper : LongStepper with EfficientSubstep = {
170+ val tbl = CollectionInternals .getTable[Long , HE ](underlying)
171+ new StepsLongHashTableKey (tbl, 0 , tbl.length)
172+ }
173+ }
174+
175+ // Steppers for entries stored in DefaultEntry HashEntry
176+ // (both for key-value pair and for values alone)
177+
178+ final class RichDefaultHashTableCanStep [K , V ](private val underlying : collection.mutable.HashTable [K , collection.mutable.DefaultEntry [K , V ]])
179+ extends AnyVal with MakesAnyStepper [(K , V )] {
180+ @ inline def stepper : AnyStepper [(K ,V )] with EfficientSubstep = {
181+ val tbl = CollectionInternals .getTable[K , collection.mutable.DefaultEntry [K , V ]](underlying)
182+ new StepsAnyDefaultHashTable (tbl, 0 , tbl.length)
183+ }
184+ }
185+
186+ final class RichDefaultHashTableValueCanStep [K , V ](private val underlying : collection.mutable.HashTable [K , collection.mutable.DefaultEntry [K , V ]])
187+ extends AnyVal with MakesAnyValueStepper [V ] {
188+ @ inline def valueStepper : AnyStepper [V ] with EfficientSubstep = {
189+ val tbl = CollectionInternals .getTable[K , collection.mutable.DefaultEntry [K , V ]](underlying)
190+ new StepsAnyDefaultHashTableValue (tbl, 0 , tbl.length)
191+ }
192+ }
193+
194+ final class RichDefaultHashTableDoubleValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.DefaultEntry [K , Double ]])
195+ extends AnyVal with MakesDoubleValueStepper {
196+ @ inline def valueStepper : DoubleStepper with EfficientSubstep = {
197+ val tbl = CollectionInternals .getTable[K , collection.mutable.DefaultEntry [K , Double ]](underlying)
198+ new StepsDoubleDefaultHashTableValue (tbl, 0 , tbl.length)
199+ }
200+ }
201+
202+ final class RichDefaultHashTableIntValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.DefaultEntry [K , Int ]])
203+ extends AnyVal with MakesIntValueStepper {
204+ @ inline def valueStepper : IntStepper with EfficientSubstep = {
205+ val tbl = CollectionInternals .getTable[K , collection.mutable.DefaultEntry [K , Int ]](underlying)
206+ new StepsIntDefaultHashTableValue (tbl, 0 , tbl.length)
207+ }
208+ }
209+
210+ final class RichDefaultHashTableLongValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.DefaultEntry [K , Long ]])
211+ extends AnyVal with MakesLongValueStepper {
212+ @ inline def valueStepper : LongStepper with EfficientSubstep = {
213+ val tbl = CollectionInternals .getTable[K , collection.mutable.DefaultEntry [K , Long ]](underlying)
214+ new StepsLongDefaultHashTableValue (tbl, 0 , tbl.length)
215+ }
216+ }
217+
218+ // Steppers for entries stored in LinkedEntry HashEntry
219+ // (both for key-value pair and for values alone)
220+
221+ final class RichLinkedHashTableCanStep [K , V ](private val underlying : collection.mutable.HashTable [K , collection.mutable.LinkedEntry [K , V ]])
222+ extends AnyVal with MakesAnyStepper [(K ,V )] {
223+ @ inline def stepper : AnyStepper [(K ,V )] with EfficientSubstep = {
224+ val tbl = CollectionInternals .getTable[K , collection.mutable.LinkedEntry [K , V ]](underlying)
225+ new StepsAnyLinkedHashTable (tbl, 0 , tbl.length)
226+ }
227+ }
228+
229+ final class RichLinkedHashTableValueCanStep [K , V ](private val underlying : collection.mutable.HashTable [K , collection.mutable.LinkedEntry [K , V ]])
230+ extends AnyVal with MakesAnyValueStepper [V ] {
231+ @ inline def valueStepper : AnyStepper [V ] with EfficientSubstep = {
232+ val tbl = CollectionInternals .getTable[K , collection.mutable.LinkedEntry [K , V ]](underlying)
233+ new StepsAnyLinkedHashTableValue (tbl, 0 , tbl.length)
234+ }
235+ }
236+
237+ final class RichLinkedHashTableDoubleValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.LinkedEntry [K , Double ]])
238+ extends AnyVal with MakesDoubleValueStepper {
239+ @ inline def valueStepper : DoubleStepper with EfficientSubstep = {
240+ val tbl = CollectionInternals .getTable[K , collection.mutable.LinkedEntry [K , Double ]](underlying)
241+ new StepsDoubleLinkedHashTableValue (tbl, 0 , tbl.length)
242+ }
243+ }
244+
245+ final class RichLinkedHashTableIntValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.LinkedEntry [K , Int ]])
246+ extends AnyVal with MakesIntValueStepper {
247+ @ inline def valueStepper : IntStepper with EfficientSubstep = {
248+ val tbl = CollectionInternals .getTable[K , collection.mutable.LinkedEntry [K , Int ]](underlying)
249+ new StepsIntLinkedHashTableValue (tbl, 0 , tbl.length)
250+ }
251+ }
252+
253+ final class RichLinkedHashTableLongValueCanStep [K ](private val underlying : collection.mutable.HashTable [K , collection.mutable.LinkedEntry [K , Long ]])
254+ extends AnyVal with MakesLongValueStepper {
255+ @ inline def valueStepper : LongStepper with EfficientSubstep = {
256+ val tbl = CollectionInternals .getTable[K , collection.mutable.LinkedEntry [K , Long ]](underlying)
257+ new StepsLongLinkedHashTableValue (tbl, 0 , tbl.length)
258+ }
259+ }
0 commit comments