eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Association':

Home

everywhere
www.exept.de
for:
[back]

Class: Association


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--LookupKey
         |
         +--Association
            |
            +--Class::SimulatedClassPool::SimulatedVariableBinding

Package:
stx:libbasic
Category:
Collections-Support
Version:
rev: 1.23 date: 2009/10/06 15:16:10
user: cg
file: Association.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


Associations are a key-value pair; conceptionally, they are the elements of 
Dictionaries - storing value under the key. (However, the real implementation
of Dictionary is different).
Taken by itself, an association is not very useful.

[Instance variables:]

    key             <Object>        the key (inherited)
    value           <Object>        the value


Related information:

    Dictionary
    IdentityDictionary

Class protocol:

instance creation
o  key: aKey value: aValue
return a new Association


Instance protocol:

accessing
o  key: aKey value: aValue
set both the key and value of the receiver.
Return the receiver

o  value
return the value of the association

o  value: anObject
set the value of the receiver to be anObject.
Return the receiver

collection mimicri
o  keysAndValuesDo: aBlock
evaluate the argument, aBlock for each element in the collection.
Pass both index and element to the block.
Added here to allow for an association to be added via the comma operation
to an existing dictionary

comparing
o  = anAssociation
return true if the receiver equals the argument.
Notice, that this compares both key AND value.
Time will show if this is ok.

o  hash
return an integer useful for hashing on the receiver;
redefined since = is redefined here.

printing & storing
o  displayString
return a string containing a printable representation
of the receiver for displaying - redefined to use display string on
the components for nicer look

o  printOn: aStream
append a printed representation of the receiver to aStream

o  storeOn: aStream
append a string representing an expression to reconstruct the receiver
to aStream.

queries
o  isAssociation
return true, if the receiver is some kind of association;
true is returned here - the method is redefined from Object.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 07:50:20 GMT