class NgLib::AATreeMap(K, V)
 
  - NgLib::AATreeMap(K, V)
 - Reference
 - Object
 
Overview
順序付き連想配列です。
平衡二分探索木として AA木 を使用しています。 性能は赤黒木の方が良いことが多い気がします。
C++の標準ライブラリの multiset と違って、$k$ 番目の値が取り出せることなどが魅力的です。
Included Modules
- Enumerable({K, V})
 
Defined in:
nglib/data_structure/aatree_map.crConstructors
Instance Method Summary
- #<<(item : Tuple(K, V)) : Nil
 - #[](key : K) : V
 - #[]=(key : K, value : V) : V
 - #[]?(key : K) : V | Nil
 - #at(k : Int) : Tuple(K, V)
 - #at?(k : Int) : Tuple(K, V) | Nil
 - #clear
 - #concat(elems) : self
 - #delete_at(k : Int)
 - #delete_key(key : K) : Bool
 - 
        #each(& : Tuple(K, V) -> )
        
          
Must yield this collection's elements to the block.
 - #each_key(& : K -> )
 - #each_value(& : V -> )
 - 
        #empty? : Bool
        
          
Returns
trueifselfdoes not contain any element. - #greater_equal_index(key : K) : Int32 | Nil
 - #greater_index(key : K) : Int32 | Nil
 - #has_key?(key : K) : Bool
 - #includes?(key : K, value : V) : Bool
 - 
        #inspect(io : IO)
        
          
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
 - #key_at(k : Int) : K
 - #key_at?(k : Int) : K | Nil
 - #keys : Array(K)
 - #less_equal_index(key : K) : Int32 | Nil
 - #less_index(key : K) : Int32 | Nil
 - #lower_bound_index(key : K) : Int32
 - 
        #size : Int32
        
          
Returns the number of elements in the collection.
 - 
        #to_a : Array(Tuple(K, V))
        
          
Returns an
Arraywith all the elements in the collection. - 
        #to_s(io : IO) : Nil
        
          
Appends a short String representation of this object which includes its class name and its object address.
 - #upper_bound_index(key : K) : Int32
 - #value_at(k : Int) : V
 - #value_at?(k : Int) : V | Nil
 - #values : Array(V)
 
Constructor Detail
Instance Method Detail
Must yield this collection's elements to the block.
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
#present?returns the inverse.
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
class Person
  def initialize(@name : String, @age : Int32)
  end
end
Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
        Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4
        Returns an Array with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]
        Appends a short String representation of this object which includes its class name and its object address.
class Person
  def initialize(@name : String, @age : Int32)
  end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>