Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Wildcard Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Hash Source Code
 previous   up   next 

Abstract data types
type
hash [ (in type: keyType) ] (in type: baseType)
Abstract data type, describing hash maps.

hash [

const func type: hash [ (in type: keyType) ] (in type: baseType)

Abstract data type, describing hash maps. A hash map stores key-value pairs. A hash map guarantees that a key can be mapped quickly to its corresponding value. The keys of a hash map have the type keyType and the value have the type baseType. A hash map is only possible, when keyType supports the functions hashCode and compare.


Operator Summary
baseType
(in hashType: aHashMap) [ (in keyType: aKey) ]
Access one value from the hash table aHashMap.
baseType
(in hashType: aHashMap) [ (in keyType: aKey) default (in baseType: defaultValue) ]
Access one value from the hash table aHashMap.
boolean
(in keyType: aKey) in (in hashType: aHashMap)
Hash membership test.
boolean
(in keyType: aKey) not in (in hashType: aHashMap)
Negated hash membership test.
void
(inout hashType: aHashMap) @:= [ (in keyType: aKey) ] (in baseType: anElem)
Add anElem with the key aKey to the hash map aHashMap.

Function Summary
integer
length (in hashType: aHashMap)
Number of elements in the hash map aHashMap.
void
incl (inout hashType: aHashMap, in keyType: aKey, in baseType: anElem)
Add anElem with the key aKey to the hash map aHashMap.
void
excl (inout hashType: aHashMap, in keyType: aKey)
Remove the element with the key aKey from the hash map aHashMap.
void
for (inout baseType: forVar) range (in hashType: aHashMap) do (in proc: statements) end for
For-loop where forVar loops over the values of the hash map aHashMap.
void
for key (inout keyType: keyVar) range (in hashType: aHashMap) do (in proc: statements) end for
For-loop where keyVar loops over the keys of the hash map aHashMap.
void
for (inout baseType: forVar) key (inout keyType: keyVar) range (in hashType: aHashMap) do (in proc: statements) end for
For-loop where forVar and keyVar' loop over the hash map aHashMap''.
array keyType
keys (in hashType: aHashMap)
Obtain the keys of the hash map aHashMap.
array baseType
values (in hashType: aHashMap)
Obtain the values of the hash map aHashMap.
hash [baseType] array keyType
flip (in hashType: aHashMap)
Create a hash map from aHashMap where key and value are exchanged.

Operator Detail

[

const func baseType: (in hashType: aHashMap) [ (in keyType: aKey) ]

Access one value from the hash table aHashMap.

Returns:
the element with the key aKey from aHashMap.
Raises:
RANGE_ERROR - When aHashMap does not have an element with the key aKey.

[

const func baseType: (in hashType: aHashMap) [ (in keyType: aKey) default (in baseType: defaultValue) ]

Access one value from the hash table aHashMap.

Returns:
the element with the key aKey from aHashMap or defaultValue when aHashMap does not have an element with the key aKey.

in

const func boolean: (in keyType: aKey) in (in hashType: aHashMap)

Hash membership test. Determine if aKey is a member of the hash map aHashMap.

Returns:
TRUE when aKey is a member of aHashMap, FALSE otherwise.

not in

const func boolean: (in keyType: aKey) not in (in hashType: aHashMap)

Negated hash membership test. Determine if aKey is not a member of the hash map aHashMap.

Returns:
FALSE when aKey is a member of aHashMap, TRUE otherwise.

@:= [

const proc: (inout hashType: aHashMap) @:= [ (in keyType: aKey) ] (in baseType: anElem)

Add anElem with the key aKey to the hash map aHashMap. When an element with the key aKey already exists, it is overwritten with anElem.

Raises:
MEMORY_ERROR - When there is not enough memory.

Function Detail

length

const func integer: length (in hashType: aHashMap)

Number of elements in the hash map aHashMap.

Returns:
the number of elements in aHashMap.

incl

const proc: incl (inout hashType: aHashMap, in keyType: aKey, in baseType: anElem)

Add anElem with the key aKey to the hash map aHashMap. When an element with the key aKey already exists, it is overwritten with anElem.

Raises:
MEMORY_ERROR - When there is not enough memory.

excl

const proc: excl (inout hashType: aHashMap, in keyType: aKey)

Remove the element with the key aKey from the hash map aHashMap.


for

const proc: for (inout baseType: forVar) range (in hashType: aHashMap) do (in proc: statements) end for

For-loop where forVar loops over the values of the hash map aHashMap.


for key

const proc: for key (inout keyType: keyVar) range (in hashType: aHashMap) do (in proc: statements) end for

For-loop where keyVar loops over the keys of the hash map aHashMap.


for

const proc: for (inout baseType: forVar) key (inout keyType: keyVar) range (in hashType: aHashMap) do (in proc: statements) end for

For-loop where forVar and keyVar' loop over the hash map aHashMap''.


keys

const func array keyType: keys (in hashType: aHashMap)

Obtain the keys of the hash map aHashMap.

Returns:
the keys of the hash map.

values

const func array baseType: values (in hashType: aHashMap)

Obtain the values of the hash map aHashMap.

Returns:
the values of the hash map.

flip

const func hash [baseType] array keyType: flip (in hashType: aHashMap)

Create a hash map from aHashMap where key and value are exchanged. Since a hash value can correspond to many keys the type returned is hash [baseType] array keyType.



 previous   up   next