Package components.map
Class Map3<K,V>
java.lang.Object
components.map.MapSecondary<K,V>
components.map.Map3<K,V>
 Type Parameters:
K
 type ofMap
domain (key) entriesV
 type ofMap
range (associated value) entries
Map
represented as a BinaryTree
(maintained as a binary
search tree) of pairs with implementations of primary methods. Mathematical Definitions:
IS_TOTAL_PREORDER ( r: binary relation on K ) : boolean is for all x, y, z: K ((r(x, y) or r(y, x)) and (if (r(x, y) and r(y, z)) then r(x, z))) IS_BST( tree: binary tree of (K, V), r: binary relation on K ): boolean satisfies [tree satisfies the binary search tree ordering property according to the relation r on the keys of its (K, V) labels and has no duplicate key values among its (K, V) labels]
 Representation Invariant (concrete invariant of $this):
IS_TOTAL_PREORDER([relation computed by $this.order.compare method] and IS_BST($this.pairsTree, $this.order)
 Abstraction Relation (interpretation mapping between $this and this):
this = labels($this.pairsTree)

Nested Class Summary
Nested classes/interfaces inherited from class components.map.MapSecondary
MapSecondary.SimplePair<K,
V> 
Constructor Summary
ConstructorDescriptionMap3()
Noargument constructor: usesComparable
'scompareTo
order if available; otherwise, compareshashCode
s.Map3
(Comparator<K> order) Constructor using givenComparator
'scompare
order. 
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds the pair (key
,value
) to this.final void
clear()
Resetsthis
to an initial value.final boolean
Reports whether there is a pair inthis
whose first component iskey
.iterator()
Returns a new object with the same dynamic type asthis
, having an initial value.Removes the pair whose first component iskey
and returns it.Removes and returns an arbitrary pair fromthis
.final int
size()
Reports size ofthis
.final void
transferFrom
(Map<K, V> source) Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must be the same as the dynamic type ofthis
.final V
Reports the value associated withkey
inthis
.Methods inherited from class components.map.MapSecondary
combineWith, equals, hashCode, hasValue, key, replaceValue, sharesKeyWith, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator

Constructor Details

Map3
public Map3()Noargument constructor: usesComparable
'scompareTo
order if available; otherwise, compareshashCode
s. 
Map3
Constructor using givenComparator
'scompare
order. Parameters:
order
 the order for the BST


Method Details

newInstance
Description copied from interface:Standard
Returns a new object with the same dynamic type asthis
, having an initial value. If the typeT
has a noargument constructor, then the value of the new returned object satisfies the contract of the noargument constructor forT
. IfT
does not have a noargument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initializethis
. Returns:
 new object "like"
this
with an initial value

clear
Description copied from interface:Standard
Resetsthis
to an initial value. If the typeT
has a noargument constructor, thenthis
satisfies the contract of the noargument constructor forT
. IfT
does not have a noargument constructor, thenthis
satisfies the contract of the constructor call that was used to initialize#this
. 
transferFrom
Description copied from interface:Standard
Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must be the same as the dynamic type ofthis
. If the typeT
has a noargument constructor, thensource
satisfies the contract of the noargument constructor forT
. IfT
does not have a noargument constructor, thensource
satisfies the contract of the constructor call that was used to initialize#source
. Parameters:
source
 object whose value is to be transferred

add
Description copied from interface:MapKernel
Adds the pair (key
,value
) to this. Parameters:
key
 the key to be addedvalue
 the associated value to be added

remove
Description copied from interface:MapKernel
Removes the pair whose first component iskey
and returns it. Parameters:
key
 the key to be removed Returns:
 the pair removed

removeAny
Description copied from interface:MapKernel
Removes and returns an arbitrary pair fromthis
. Returns:
 the pair removed from
this

value
Description copied from interface:MapKernel
Reports the value associated withkey
inthis
. Parameters:
key
 the key whose associated value is to be reported Returns:
 the value associated with key

hasKey
Description copied from interface:MapKernel
Reports whether there is a pair inthis
whose first component iskey
. Parameters:
key
 the key to be checked Returns:
 true iff there is a pair in this whose first component is
key

size
Description copied from interface:MapKernel
Reports size ofthis
. Returns:
 the number of pairs in
this

iterator
