Set
that contains only integers.dummy_array :: DummyArray :: defaultinit
initialize a new DummyArray withcapacity
.
dummy_array :: DummyArray :: length=
dummy_array $ DummyArray :: SELF
Type of this instance, automatically specialized in every classdummy_array $ DummyArray :: has
Isitem
in the collection ?
dummy_array $ DummyArray :: iterator
Get a new iterator on the collection.dummy_array $ DummyArray :: remove
Remove an occurrence ofitem
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionserialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Collection :: combinations
Allr
-length combinations on self (in same order) without repeated elements.
core :: Collection :: combinations_with_replacement
Allr
-length combination on self (in same order) with repeated elements.
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
core :: Collection :: defaultinit
core :: SimpleCollection :: defaultinit
core :: Object :: defaultinit
core :: Set :: defaultinit
core :: Cloneable :: defaultinit
dummy_array :: DummyArray :: defaultinit
initialize a new DummyArray withcapacity
.
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
core :: Collection :: has_all
Does the collection contain at least each element ofother
?
core :: Collection :: has_any
Does the collection contain at least one element ofother
?
core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother
?
core :: Set :: intersection
Returns the intersection of this set with theother
set
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
dummy_array :: DummyArray :: length=
serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr
-length permutations on self (all possible ordering) without repeated elements.
core :: Collection :: product
Cartesian product, overr
times self
.
core :: RemovableCollection :: remove
Remove an occurrence ofitem
core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
core :: Collection :: to_concurrent
Wrapsself
in a thread-safe collection
core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListserialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
core :: Collection :: to_shuffle
Return a new array made of elements in a random order.Serializer::serialize
# A `Set` that contains only integers.
class DummyArray
super Set[Int]
private var capacity: Int
redef var length: Int
private var keys: NativeArray[Int]
private var values: NativeArray[Int]
redef fun add(value: Int)
do
assert full: _length < (_capacity-1)
var l = _length
_values[l] = value
_keys[value] = l
_length = l + 1
end
redef fun remove(value)
do
assert not is_empty
if not value isa Int then return
var l = _length
if l > 1 then
var last = _values[l - 1]
var pos = _keys[value]
_keys[last] = pos
_values[pos] = last
end
_length = l - 1
end
redef fun has(value)
do
if not value isa Int then return false
assert value < _capacity
var pos = _keys[value]
if pos < _length then
return _values[pos] == value
end
return false
end
redef fun first: Int
do
assert _length > 0
return _values[0]
end
redef fun is_empty: Bool
do
return not (_length > 0)
end
redef fun clear
do
_length = 0
end
redef fun iterator: DummyIterator
do
return new DummyIterator(self)
end
private fun value_at(pos: Int): Int
do
return _values[pos]
end
# initialize a new DummyArray with `capacity`.
init(capacity: Int) is old_style_init do
_capacity = capacity
_keys = new NativeArray[Int](capacity)
_values = new NativeArray[Int](capacity)
end
end
lib/dummy_array/dummy_array.nit:14,1--88,3