core $ SimpleCollection :: SELF
Type of this instance, automatically specialized in every classjson :: serialization_write $ SimpleCollection :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONmsgpack :: serialization_write $ SimpleCollection :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackjson :: serialization_read $ SimpleCollection :: from_deserializer
Create an instance of this class from thedeserializer
msgpack :: serialization_read $ SimpleCollection :: from_deserializer
Create an instance of this class from thedeserializer
msgpack :: serialization_write $ SimpleCollection :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: 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
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 :: 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.
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
core :: DisjointSet
Data structure to keep track of elements partitioned into disjoint subsetsConcurrentList
Array
List
pthreads :: ConcurrentSequence
A concurrent variant to the standardSequence
pthreads :: ReverseBlockingQueue
A collection whichis_empty
method blocks until it's empty
neo4j :: SequentialNodeCollection
A Neo4j node collection using a sequential identification scheme.
# Items can be added to these collections.
interface SimpleCollection[E]
super RemovableCollection[E]
# Add `item` to this collection.
#
# var a = [1,2]
# a.add 3
# assert a.has(3) == true
# assert a.has(10) == false
#
# Ensure col.has(item)
fun add(item: E) is abstract
# Add each item of `coll`.
#
# var a = [1,2]
# a.add_all([3..5])
# assert a.has(4) == true
# assert a.has(10) == false
fun add_all(coll: Collection[E]) do for i in coll do add(i)
end
lib/core/collection/abstract_collection.nit:423,1--444,3
redef class SimpleCollection[E]
# Return a random proxy queue where `result.take` is random.
#
# The point of such a proxy is to provide a randomized removal.
#
# ~~~
# var a = [1,2,3]
# var b = a.as_random.take
# assert b == 1 or b == 2 or b == 3 # Eh, it is random!
# ~~~
fun as_random: Queue[E] do return new RandQueue[E](self)
end
lib/core/queue.nit:164,1--175,3
redef class SimpleCollection[E] super Serializable end
lib/serialization/serialization_core.nit:265,1--54
redef class SimpleCollection[E]
redef fun accept_json_serializer(v)
do
if v.plain_json then
serialize_to_pure_json v
else
# Register as pseudo object
var id = v.cache.new_id_for(self)
v.stream.write """{"""
v.indent_level += 1
v.new_line_and_indent
v.stream.write """"__kind": "obj", "__id": """
v.stream.write id.to_s
v.stream.write """, "__class": """"
v.stream.write class_name
v.stream.write """","""
v.new_line_and_indent
v.stream.write """"__items": """
serialize_to_pure_json v
core_serialize_to v
v.indent_level -= 1
v.new_line_and_indent
v.stream.write "\}"
end
end
end
lib/json/serialization_write.nit:330,1--358,3
redef class SimpleCollection[E]
redef fun accept_inspect_serializer_core(v)
do
v.stream.write " "
serialize_as_inspect v
end
end
lib/serialization/inspect.nit:260,1--266,3
redef class SimpleCollection[E]
redef init from_deserializer(v)
do
super
if v isa JsonDeserializer then
v.notify_of_creation self
init
var open_array: nullable SequenceRead[nullable Object] = v.opened_array
if open_array == null then
# With metadata
var arr = v.path.last.get_or_null("__items")
if not arr isa SequenceRead[nullable Object] then
# If there is nothing, we consider that it is an empty collection.
if arr != null then v.errors.add new Error("Deserialization Error: invalid format in {self.class_name}")
return
end
open_array = arr
end
# Name of the dynamic name of E
var items_type_name = (new GetName[E]).to_s
# Fill array
for o in open_array do
var obj = v.convert_object(o, items_type_name)
if obj isa E then
add obj
else v.errors.add new AttributeTypeError(self, "items", obj, items_type_name)
end
end
end
end
lib/json/serialization_read.nit:385,1--417,3
redef class SimpleCollection[E]
redef fun accept_msgpack_serializer(v)
do
if not v.plain_msgpack then
# Add metadata and other attributes
super
end
# Header
v.stream.write_msgpack_array length
# Items
for e in self do
if not v.try_to_serialize(e) then
assert e != null # null would have been serialized
v.warn "element of type {e.class_name} is not serializable."
v.stream.write_msgpack_null
end
end
end
redef fun msgpack_extra_array_items do return 1
end
lib/msgpack/serialization_write.nit:297,1--319,3
redef class SimpleCollection[E]
redef init from_deserializer(v)
do
super
if v isa MsgPackDeserializer then
v.notify_of_creation self
init
var open_array = v.path_arrays.last
var msgpack_items = null
if open_array != null then msgpack_items = open_array.last
if not msgpack_items isa Array[nullable Serializable] then
v.errors.add new Error("Deserialization Error: no items in source of `{class_name}`")
return
end
# Name of the dynamic name of E
var items_type_name = (new GetName[E]).to_s
# Fill array
for o in msgpack_items do
var obj = v.convert_object(o, items_type_name)
if obj isa E then
add obj
else v.errors.add new AttributeTypeError(self, "items", obj, items_type_name)
end
end
end
end
lib/msgpack/serialization_read.nit:336,1--365,3