author | Claus Gittinger <cg@exept.de> |
Thu, 23 Nov 1995 02:16:37 +0100 | |
changeset 605 | 8b17f96bf05a |
parent 530 | 07d0bce293c9 |
child 607 | a9a526c51233 |
permissions | -rw-r--r-- |
157 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
379 | 3 |
All Rights Reserved |
157 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
Magnitude subclass:#LookupKey |
|
14 |
instanceVariableNames:'key' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Collections-Support' |
|
18 |
! |
|
19 |
||
20 |
!LookupKey class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
379 | 25 |
All Rights Reserved |
157 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
version |
|
530
07d0bce293c9
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libbasic/LookupKey.st,v 1.4 1995-11-11 15:23:54 cg Exp $' |
157 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
LookupKey has been extracted from Association for ST-80 compatibility. |
|
43 |
They are currently not used directly. |
|
44 |
||
45 |
Instance variables: |
|
46 |
||
379 | 47 |
key <Object> the key |
157 | 48 |
" |
49 |
! ! |
|
50 |
||
51 |
!LookupKey class methodsFor:'instance creation'! |
|
52 |
||
53 |
key:aKey |
|
54 |
"return a new instance." |
|
55 |
||
56 |
^ self basicNew key:aKey |
|
57 |
! ! |
|
58 |
||
59 |
!LookupKey methodsFor:'accessing'! |
|
60 |
||
61 |
key |
|
62 |
"return the key of the receiver" |
|
63 |
||
64 |
^ key |
|
65 |
! |
|
66 |
||
67 |
key:anObject |
|
68 |
"set the key of the receiver to be anObject. |
|
69 |
Return the receiver" |
|
70 |
||
71 |
key := anObject |
|
72 |
! ! |
|
73 |
||
74 |
!LookupKey methodsFor:'comparing'! |
|
75 |
||
76 |
= aLookupKey |
|
77 |
"return true if the receiver equals the argument. |
|
78 |
Notice, that in contrast to the less/greater compares, |
|
79 |
this compares both key AND value." |
|
80 |
||
81 |
^ (self species == aLookupKey species) and:[key = aLookupKey key] |
|
82 |
! |
|
83 |
||
84 |
hash |
|
85 |
"return an integer useful for hashing on the receiver; |
|
86 |
redefined since = is redefined here." |
|
87 |
||
88 |
^ key hash |
|
89 |
! |
|
90 |
||
91 |
< aKey |
|
92 |
"return true, if the receivers KEY is less |
|
93 |
than the arguments key. The argument must be a kind of lookupKey" |
|
94 |
||
95 |
^ key < aKey key |
|
96 |
! |
|
97 |
||
98 |
> aKey |
|
99 |
"return true, if the receivers KEY is greater |
|
100 |
than the arguments key. The argument must be a kind of lookupKey" |
|
101 |
||
102 |
^ key > aKey key |
|
103 |
! ! |
|
104 |
||
105 |
!LookupKey methodsFor:'printing & storing'! |
|
106 |
||
107 |
printOn:aStream |
|
108 |
"return a string containing a printable representation |
|
109 |
of the receiver" |
|
110 |
||
111 |
key printOn:aStream. |
|
112 |
! |
|
113 |
||
114 |
displayString |
|
115 |
"return a string containing a printable representation |
|
116 |
of the receiver for displaying - redefined to use display string on |
|
117 |
the components for nicer look" |
|
118 |
||
119 |
^ self class name , '(' , key displayString , ')' |
|
120 |
! ! |