[NAME]
ALL.dao.type.map.method

[TITLE]
Map Methods

[DESCRIPTION]


     
   1  map<@K=any,@V=any>( count: int, hashing = 0 )[index: int => tuple<@K,@V>]
   2      => map<@K,@V>
   3  clear( self: map<@K,@V> )
   4  reset( self: map<@K,@V> )
   5  reset( self: map<@K,@V>, hashing: enum<none,auto,random> )
   6  erase( self: map<@K,@V>, from: @K ) => map<@K,@V>
   7  erase( self: map<@K,@V>, from: @K, to: @K ) => map<@K,@V>
   8  insert( self: map<@K,@V>, key: @K, value: @V ) => map<@K,@V>
   9  invert( self: map<@K,@V> ) => map<@V,@K>
  10  find( invar self: map<@K,@V>, invar key: @K, comparison: enum<LE,EQ,GE> = $EQ )
  11      => tuple<key:@K,value:@V> | none
  12  keys( invar self: map<@K,@V> ) => list<@K>
  13  values( invar self: map<@K,@V> ) => list<@V>
  14  size( invar self: map<@K,@V> ) => int
  15  iterate( invar self: map<@K,@V> )[key: invar<@K>, value: invar<@V>]
  16  iterate( self: map<@K,@V> )[key: invar<@K>, value: @V]
  17  collect( invar self: map<@K,@V> )[key: @K, value: @V => none|@T] => list<@T>
  18  associate( invar self: map<@K,@V>, hashing = 0 )
  19      [key: invar<@K>, value: invar<@V> => none|tuple<@K2,@V2>] => map<@K2,@V2>
  20  find( invar self: map<@K,@V> )[key: invar<@K>, value: invar<@V> =>int]
  21      => tuple<key:@K,value:@V> | none
  22  apply( self: map<@K,@V> )[key: @K, value: @V => @V] => map<@K,@V>
     


 0.1   Methods  


 0.1.1   clear(self:map<@K,@V>)  
     
   1  clear( self: map<@K,@V> )
     
Delete all the key-value pairs from the map.

 0.1.2   reset(self:map<@K,@V>)  
     
   1  reset( self: map<@K,@V> )
     
Remove all the key-value pairs from the map. And cache the key-value nodes internally for
more efficient insertion later.

 0.1.3   reset(self:map<@K,@V>,hashing:enum<none,auto,random>)  
     
   1  reset( self: map<@K,@V>, hashing: enum<none,auto,random> )
     
Reset the map in the same way as the above method. And additionally it may change the map
from ordered (hashing=none) to unordered (hashing=auto/random), or unordered to ordered m
ap. A default hashing seed will be used for "auto", and a random hashing seed will be use
d for "random".

 0.1.4   erase(self:map<@K,@V>,from:@K)=>map<@K,@V>  
     
   1  erase( self: map<@K,@V>, from: @K ) => map<@K,@V>
     
Erase a key and its corresponding value from the map. Return self map.

 0.1.5   erase(self:map<@K,@V>,from:@K,to:@K)=>map<@K,@V>  
     
   1  erase( self: map<@K,@V>, from: @K, to: @K ) => map<@K,@V>
     
Erase keys in the inclusive range between "from" and "to", and their corresponding values
from the map. Return self map.

 0.1.6   insert(self:map<@K,@V>,key:@K,value:@V)=>map<@K,@V>  
     
   1  insert( self: map<@K,@V>, key: @K, value: @V ) => map<@K,@V>
     
Insert a new key-value pair to the map. Return self map.

 0.1.7   invert(self:map<@K,@V>)=>map<@V,@K>  
     
   1  invert( self: map<@K,@V> ) => map<@V,@K>
     
Invert the key-value relationship. Return a new map.

 0.1.8   find(invar self:map<@K,@V>,invar key:@K,...)=>tuple<key:@K,value:@V>|none  
     
   1  find( invar self: map<@K,@V>, invar key: @K, comparison: enum<LE,EQ,GE> = $EQ )
   2      => tuple<key:@K,value:@V> | none
     
Find the key-value pair that corresponds (or is closest) to "key". According to the "comp
arison" parameter:
1. "$LE": the key must be less than or equal to the found one;
2. "$EQ": the key must equal to the found one;
3. "$GE": the key must be greater than or equal to the found one;

 0.1.9   keys(invar self:map<@K,@V>)=>list<@K>  
     
   1  keys( invar self: map<@K,@V> ) => list<@K>
     
Return the keys of the map as a list.

 0.1.10   values(invar self:map<@K,@V>)=>list<@V>  
     
   1  values( invar self: map<@K,@V> ) => list<@V>
     
Return the values of the map as a list.

 0.1.11   size(invar self:map<@K,@V>)=>int  
     
   1  size( invar self: map<@K,@V> ) => int
     
Return the number of key-value pairs in map.

 0.1.12   iterate(invar self:map<@K,@V>)[key:invar<@K>,value:invar<@V>]  
     
   1  iterate( invar self: map<@K,@V> )[key: invar<@K>, value: invar<@V>]
     
Iterate over the map, and execute the associated code section for each key-value pair.

 0.1.13   iterate(self:map<@K,@V>)[key:invar<@K>,value:@V]  
     
   1  iterate( self: map<@K,@V> )[key: invar<@K>, value: @V]
     
Iterate over the map, and execute the associated code section for each key-value pair.

 0.1.14   collect(invar self:map<@K,@V>)[key:@K,value:@V=>none|@T]=>list<@T>  
     
   1  collect( invar self: map<@K,@V> )[key: @K, value: @V => none|@T] => list<@T>
     
Iterate over the map, and execute the associated code section for each key-value pair. Re
turn a list of non-none values collected from the code section results.

 0.1.15   associate(invar self:map<@K,@V>,hashing=0)[...=>none|tuple<@K2,@V2>]=>map<@K2,@
V2>  
     
   1  associate( invar self: map<@K,@V>, hashing = 0 )
   2  [key: invar<@K>, value: invar<@V> => none|tuple<@K2,@V2>] => map<@K2,@V2>
     
Iterate over the map, and execute the associated code section for each key-value pair. Re
turn a new map that is constructed from the new key-value pairs returned from the code se
ction evaluation.

 0.1.16   find(invar self:map<@K,@V>)[...]=>tuple<key:@K,value:@V>|none  
     
   1  find( invar self: map<@K,@V> )[key: invar<@K>, value: invar<@V> =>int]
   2  => tuple<key:@K,value:@V> | none
     
Find the first key-value pair that meets the condition as expressed by the code section. 
A non-zero integer result from the code section means the condition is satisfied.

 0.1.17   apply(self:map<@K,@V>)[key:@K,value:@V=>@V]=>map<@K,@V>  
     
   1  apply( self: map<@K,@V> )[key: @K, value: @V => @V] => map<@K,@V>
     
Iterate over the map, and execute the associated code section for each key-value pair. Th
en update the value of each pair with the value returned by the code section.