author | Merge Script |
Sun, 07 Jun 2015 06:38:49 +0200 | |
branch | jv |
changeset 18457 | 214d760f8247 |
parent 18120 | e3a375d5f6a8 |
child 19478 | 1f5aa87f6170 |
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 |
" |
|
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
12 |
"{ Package: 'stx:libbasic' }" |
157 | 13 |
|
14 |
Magnitude subclass:#LookupKey |
|
1290 | 15 |
instanceVariableNames:'key' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Collections-Support' |
|
157 | 19 |
! |
20 |
||
21 |
!LookupKey class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
379 | 26 |
All Rights Reserved |
157 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
LookupKey has been extracted from Association for ST-80 compatibility. |
|
1761 | 40 |
This class is currently not used directly. |
157 | 41 |
|
1290 | 42 |
[Instance variables:] |
157 | 43 |
|
1290 | 44 |
key <Object> the key |
45 |
||
46 |
[author:] |
|
47 |
Claus Gittinger |
|
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 |
||
607 | 76 |
< aKey |
77 |
"return true, if the receivers KEY is less |
|
78 |
than the arguments key. The argument must be a kind of lookupKey" |
|
79 |
||
80 |
^ key < aKey key |
|
81 |
! |
|
82 |
||
157 | 83 |
= aLookupKey |
15077 | 84 |
"return true if the receivers key equals the arguments key. |
85 |
The argument must be a kind of lookupKey." |
|
157 | 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 |
||
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
106 |
displayOn:aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
107 |
"Compatibility |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
108 |
append a printed desription on some stream (Dolphin, Squeak) |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
109 |
OR: |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
110 |
display the receiver in a graphicsContext at 0@0 (ST80). |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
111 |
This method allows for any object to be displayed in some view |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
112 |
(although the fallBack is to display its printString ...)" |
157 | 113 |
|
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
114 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
115 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
16747 | 116 |
(aGCOrStream isStream) ifFalse:[ |
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
117 |
^ super displayOn:aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
118 |
]. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
119 |
|
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
120 |
aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
121 |
nextPutAll:self className; |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
122 |
nextPut:$(. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
123 |
key displayOn:aGCOrStream. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
124 |
aGCOrStream nextPut:$) |
607 | 125 |
! |
126 |
||
127 |
printOn:aStream |
|
4392 | 128 |
"append a user printed representation of the receiver to aStream. |
129 |
The format is suitable for a human - not meant to be read back." |
|
607 | 130 |
|
131 |
key printOn:aStream. |
|
157 | 132 |
! ! |
607 | 133 |
|
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
134 |
|
629 | 135 |
!LookupKey class methodsFor:'documentation'! |
136 |
||
137 |
version |
|
16747 | 138 |
^ '$Header: /cvs/stx/stx/libbasic/LookupKey.st,v 1.12 2014-07-10 12:24:01 cg Exp $' |
629 | 139 |
! ! |
15077 | 140 |