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
|
1290
|
14 |
instanceVariableNames:'key'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Collections-Support'
|
157
|
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 |
documentation
|
|
37 |
"
|
|
38 |
LookupKey has been extracted from Association for ST-80 compatibility.
|
1761
|
39 |
This class is currently not used directly.
|
157
|
40 |
|
1290
|
41 |
[Instance variables:]
|
157
|
42 |
|
1290
|
43 |
key <Object> the key
|
|
44 |
|
|
45 |
[author:]
|
|
46 |
Claus Gittinger
|
157
|
47 |
"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!LookupKey class methodsFor:'instance creation'!
|
|
51 |
|
|
52 |
key:aKey
|
|
53 |
"return a new instance."
|
|
54 |
|
|
55 |
^ self basicNew key:aKey
|
|
56 |
! !
|
|
57 |
|
|
58 |
!LookupKey methodsFor:'accessing'!
|
|
59 |
|
|
60 |
key
|
|
61 |
"return the key of the receiver"
|
|
62 |
|
|
63 |
^ key
|
|
64 |
!
|
|
65 |
|
|
66 |
key:anObject
|
|
67 |
"set the key of the receiver to be anObject.
|
|
68 |
Return the receiver"
|
|
69 |
|
|
70 |
key := anObject
|
|
71 |
! !
|
|
72 |
|
|
73 |
!LookupKey methodsFor:'comparing'!
|
|
74 |
|
607
|
75 |
< aKey
|
|
76 |
"return true, if the receivers KEY is less
|
|
77 |
than the arguments key. The argument must be a kind of lookupKey"
|
|
78 |
|
|
79 |
^ key < aKey key
|
|
80 |
!
|
|
81 |
|
157
|
82 |
= aLookupKey
|
|
83 |
"return true if the receiver equals the argument.
|
|
84 |
Notice, that in contrast to the less/greater compares,
|
|
85 |
this compares both key AND value."
|
|
86 |
|
|
87 |
^ (self species == aLookupKey species) and:[key = aLookupKey key]
|
|
88 |
!
|
|
89 |
|
607
|
90 |
> aKey
|
|
91 |
"return true, if the receivers KEY is greater
|
|
92 |
than the arguments key. The argument must be a kind of lookupKey"
|
|
93 |
|
|
94 |
^ key > aKey key
|
|
95 |
!
|
|
96 |
|
157
|
97 |
hash
|
|
98 |
"return an integer useful for hashing on the receiver;
|
|
99 |
redefined since = is redefined here."
|
|
100 |
|
|
101 |
^ key hash
|
|
102 |
! !
|
|
103 |
|
|
104 |
!LookupKey methodsFor:'printing & storing'!
|
|
105 |
|
|
106 |
displayString
|
|
107 |
"return a string containing a printable representation
|
|
108 |
of the receiver for displaying - redefined to use display string on
|
|
109 |
the components for nicer look"
|
|
110 |
|
|
111 |
^ self class name , '(' , key displayString , ')'
|
607
|
112 |
!
|
|
113 |
|
|
114 |
printOn:aStream
|
4392
|
115 |
"append a user printed representation of the receiver to aStream.
|
|
116 |
The format is suitable for a human - not meant to be read back."
|
607
|
117 |
|
|
118 |
key printOn:aStream.
|
157
|
119 |
! !
|
607
|
120 |
|
629
|
121 |
!LookupKey class methodsFor:'documentation'!
|
|
122 |
|
|
123 |
version
|
4392
|
124 |
^ '$Header: /cvs/stx/stx/libbasic/LookupKey.st,v 1.9 1999-07-15 19:44:33 cg Exp $'
|
629
|
125 |
! !
|