Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
fun items_overlapping(region :Boxed[Numeric]): SimpleCollection[E] is abstract
end
fun items_overlapping(region :Boxed[Numeric]): SimpleCollection[E] is abstract
end
-# A BoxedCollection implemented with an array, linear performances for searching but really
-# fast for creation and filling
+# `BoxedCollection` implemented by an array
+#
+# Linear performances for searching, but really fast creation and filling.
class BoxedArray[E: Boxed[Numeric]]
super BoxedCollection[E]
class BoxedArray[E: Boxed[Numeric]]
super BoxedCollection[E]
- private var data: Array[E] = new Array[E]
-
- redef fun add(item) do data.add(item)
redef fun items_overlapping(item)
do
var arr = new Array[E]
redef fun items_overlapping(item)
do
var arr = new Array[E]
if i.intersects(item) then arr.add(i)
end
return arr
end
if i.intersects(item) then arr.add(i)
end
return arr
end
-
- redef fun iterator do return data.iterator