A map is a set of items mapped to a key and organized in an specific
order . There is no restrictions related to duplicates of the elements
of the map, but the keys that map them must be unique. A map does not
perform (in an automatic manner) any ordering (unless wonted) of the
elements. A map can contain any kind of data type including other maps
in it's elements but the keys are restricted to primitive data types
(except nil).
The length specify the number of items this Map contains.
$map TYPEOF Map
$map.add("colors", "red,yellow,blue".getTokens(","))
$map.add("numbers", "one,two,three".getTokens(","))
$map.add("flawres", "rose,tulip".getTokens(","))
PRINT $map@length
3
The index specify the current position of the cursor in the Map,
also used to move the cursor at the wanted position.
Initially the index is positioned at the first element of the map.
$map TYPEOF Map
$map.add("colors", "red,yellow,blue".getTokens(","))
$map.add("numbers", "one,two,three".getTokens(","))
$map.add("flawres", "rose,tulip".getTokens(","))
print $map.nextValue
red
yellow
blue
$map@index=2
print $map.nextValue
rose
tulip
The hasNext specify whenever the index represents the last element of
the series or not.
$map TYPEOF Map
$map.add("colors", "red,yellow,blue".getTokens(","))
$map.add("numbers", "one,two,three".getTokens(","))
$map.add("flawres", "rose,tulip".getTokens(","))
print $map@hasNext
true
$map@index=3
print $map@hasNext
false
The hasPrevious specify whenever the index represents the first element
of the series or not.
$map TYPEOF Map
$map.add("colors", "red,yellow,blue".getTokens(","))
$map.add("numbers", "one,two,three".getTokens(","))
$map.add("flawres", "rose,tulip".getTokens(","))
PRINT $map@hasPrevious
false
$map@index = 3
PRINT $map@hasPrevious
true
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Label: | Has next |
Type: | Logical |
Is Static: | false |
Is Hidden: | false |
Show Empty: | true |
Specify whenever the index represents the last element of the series or
not.
Label: | Has previous |
Type: | Logical |
Is Static: | false |
Is Hidden: | false |
Show Empty: | true |
Specify whenever the index represents the first element of the series or
not.
Label: | Index |
Type: | Integer |
Is Static: | false |
Is Hidden: | false |
Show Empty: | true |
Specify the current position of the cursor in the Map, also used to move
the cursor at the wanted position. Initially the index is positioned at
the first element of the map.
Label: | Length |
Type: | Integer |
Is Static: | false |
Is Hidden: | false |
Show Empty: | true |
Specify the number of items this Map contains.
Parameters: |
$key : | The key to add. |
$value : | The concept to add. |
|
Adds the given concept with the specified key to this Map.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m@length
-- the result is --
3
Removes all of the elements from this Map. The Map will be empty after
this.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m@length
$m.clear
print $m@length
-- the result is --
3
0
Returns true if the specified concept is a key in this Map, false
otherwise.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.containsKey("2")
-- the result is --
true
Returns true if the specified concept is a value in this Map, false
otherwise.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.containsValue("one")
-- the result is --
true
Returns the element with the specified name if it can be found in this
Map, nil otherwise.
$m typeof Map
$m.add(1, "one")
$m.add(2, "two")
$m.add(3, "three")
print $m.getConceptElement("2")
-- the result is --
2 two
Returns a Series containing elements of type String with the name of the
elements defined in this concept.
$m typeof Map
$m.add(1, "one")
$m.add(2, "two")
$m.add(3, "three")
print $m.getConceptElements
-- the result is --
1 one
2 two
3 three
Parameters: |
$elem : | Element field name. |
|
Returns the element field definition with the specified name if it can be found in this
Map, nil otherwise.
$m typeof Map
$m.add(1, "one")
$m.add(2, "two")
$m.add(3, "three")
print $m.getConceptElementField("2")
-- the result is --
2 TYPEOF String LABEL "2"
Returns a Series containing element fields.
$m typeof Map
$m.add(1, "one")
$m.add(2, "two")
$m.add(3, "three")
print $m.getConceptElementFields
-- the result is --
1 TYPEOF String LABEL "1"
2 TYPEOF String LABEL "2"
3 TYPEOF String LABEL "3"
Parameters: |
$index : | The index of the key. |
|
Returns the key at the specified index.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.getKeyAt(3)
-- the result is --
3
Returns a Series containing all the keys of this Map.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.getKeys
-- the result is --
1
2
3
Returns the value of this key.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.getValue("3")
-- the result is --
three
Parameters: |
$index : | The index of the value. |
|
Returns the value at the specified index.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.getValueAt(1)
-- the result is --
one
Returns a Series containing all the values of this Map.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.getValues
-- the result is --
one
two
three
Sets the index value to the given value.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
$m.setIndex(2)
print $m.nextValue
-- the result is --
three
Returns the index of the specified concept if that is a key in this Map.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.indexOfKey("1")
-- the result is --
1
Returns the index of the specified concept if that is a value in this
Map.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
print $m.indexOfValue("three")
-- the result is --
3
Parameters: |
$key : | The key to be added. |
$value : | The value to be added. |
|
Adds a new element with the given key and value to the current index position in this Map.
$m typeof Map
$m.insert("1", "one")
$m.insert("2", "two")
$m.insert("3", "three")
print $m
-- the result is --
Map
3 three
2 two
1 one
Parameters: |
$index : | The position at which to insert the new Element. |
$key : | The key to be added. |
$value : | The value to be added. |
|
Adds the new element with with the given key and value to this Map at
the given position.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.insert(2, "3", "three")
print $m
-- the result is --
Map
1 one
3 three
2 two
Returns the next key after the one marked by the index of the map and
sets the index on it.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
while ($m@hasNext) do [
print $m.nextKey
]
-- the result is --
1
2
3
Returns the next value after the one marked by the index of the map and
sets the index on it.
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
while ($m@hasNext) do [
print $m.nextValue
]
-- the result is --
one
two
three
Removes the key given as parameter and the value that belong to it from
this Map..
$m typeof Map
$m.add("1", "one")
$m.add("2", "two")
$m.add("3", "three")
$m.remove("2")
print $m
-- the result is --
Map
1 one
3 three