eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'KeyedCollection':

Home

everywhere
www.exept.de
for:
[back]

Class: KeyedCollection


Inheritance:

   Object
   |
   +--Collection
      |
      +--KeyedCollection
         |
         +--MethodDictionary
         |
         +--RBSmallDictionary

Package:
stx:libbasic
Category:
Collections-Abstract
Version:
rev: 1.7 date: 2010/01/29 16:42:18
user: cg
file: KeyedCollection.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


Abstract superclass for collections which have a key->value mapping.
This abstract class provides functionality common to those collections,
without knowing how the concrete class implements things. Thus, all
methods found here depend on some basic mechanisms to be defined in the
concrete class. 
These basic methods are usually defined as #subclassResponsibility here.
Some methods are also redefined for better performance.

Subclasses should at least implement:
    at:ifAbsent:        - accessing elements
    removeKey:ifAbsent  - removing
    keysAndValuesDo:    - enumerating


Class protocol:

queries
o  isAbstract
Return if this class is an abstract class.
True is returned for KeyedCollection here; false for subclasses.
Abstract subclasses must redefine again.


Instance protocol:

accessing
o  at: key
return the value stored under akey.
Raise an error if not found

o  at: key ifAbsent: exceptionBlock
return the value stored under akey.
Return the value from evaluating exceptionBlock if not found

** This method raises an error - it must be redefined in concrete classes **

o  keyAtValue: value
return the key under which value is stored.
Raise an error if not found

o  keyAtValue: value ifAbsent: exceptionBlock
return the key under which value is stored.
If not found, return the value from evaluating exceptionBlock

o  keys
return a collection containing the keys of the receiver

enumerating
o  do: aBlock
evaluate aBlock for each value

o  findFirstKey: aBlock
find and return the first key, for which evaluation of the argument, aBlock
returns true; return nil if none is detected.

o  keysAndValuesDo: aBlock
evaluate aBlock for each key and value

** This method raises an error - it must be redefined in concrete classes **

o  keysDo: aBlock
evaluate aBlock for each key

removing
o  removeKey: aKey
remove key (and the value stored under that key) from the
receiver; raise an error if no such element is contained

o  removeKey: aKey ifAbsent: exceptionBlock
remove key (and the value stored under that key) from the
receiver; if no such element is contained, return the value
from evaluating exceptionBlock

** This method raises an error - it must be redefined in concrete classes **

testing
o  includesIdenticalKey: aKey
return true, if the argument, aKey is a key in the receiver

o  includesKey: aKey
return true, if the argument, aKey is a key in the receiver



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 19:53:22 GMT