author | Claus Gittinger <cg@exept.de> |
Fri, 28 Jun 2019 08:49:56 +0200 | |
changeset 24385 | dd84e4dfb5cc |
parent 21538 | 5b99fa1b2343 |
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 |
|
19463 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
157 | 16 |
Magnitude subclass:#LookupKey |
1290 | 17 |
instanceVariableNames:'key' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Collections-Support' |
|
157 | 21 |
! |
22 |
||
23 |
!LookupKey class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
379 | 28 |
All Rights Reserved |
157 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
LookupKey has been extracted from Association for ST-80 compatibility. |
|
1761 | 42 |
This class is currently not used directly. |
157 | 43 |
|
1290 | 44 |
[Instance variables:] |
157 | 45 |
|
1290 | 46 |
key <Object> the key |
47 |
||
48 |
[author:] |
|
49 |
Claus Gittinger |
|
157 | 50 |
" |
51 |
! ! |
|
52 |
||
53 |
!LookupKey class methodsFor:'instance creation'! |
|
54 |
||
55 |
key:aKey |
|
56 |
"return a new instance." |
|
57 |
||
58 |
^ self basicNew key:aKey |
|
59 |
! ! |
|
60 |
||
61 |
!LookupKey methodsFor:'accessing'! |
|
62 |
||
63 |
key |
|
64 |
"return the key of the receiver" |
|
65 |
||
66 |
^ key |
|
67 |
! |
|
68 |
||
69 |
key:anObject |
|
70 |
"set the key of the receiver to be anObject. |
|
71 |
Return the receiver" |
|
72 |
||
73 |
key := anObject |
|
74 |
! ! |
|
75 |
||
76 |
!LookupKey methodsFor:'comparing'! |
|
77 |
||
607 | 78 |
< aKey |
19463 | 79 |
"return true, if the receiver's Key is less than the argument's key. |
80 |
The argument must be a kind of lookupKey" |
|
607 | 81 |
|
82 |
^ key < aKey key |
|
83 |
! |
|
84 |
||
157 | 85 |
= aLookupKey |
19463 | 86 |
"return true if the receiver's key equals the argument's key. |
15077 | 87 |
The argument must be a kind of lookupKey." |
157 | 88 |
|
89 |
^ (self species == aLookupKey species) and:[key = aLookupKey key] |
|
90 |
! |
|
91 |
||
607 | 92 |
> aKey |
19463 | 93 |
"return true, if the receiver's Key is greater than the argument's key. |
94 |
The argument must be a kind of lookupKey" |
|
607 | 95 |
|
96 |
^ key > aKey key |
|
97 |
! |
|
98 |
||
157 | 99 |
hash |
100 |
"return an integer useful for hashing on the receiver; |
|
101 |
redefined since = is redefined here." |
|
102 |
||
103 |
^ key hash |
|
104 |
! ! |
|
105 |
||
106 |
!LookupKey methodsFor:'printing & storing'! |
|
107 |
||
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
108 |
displayOn:aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
109 |
"Compatibility |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
110 |
append a printed desription on some stream (Dolphin, Squeak) |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
111 |
OR: |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
112 |
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
|
113 |
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
|
114 |
(although the fallBack is to display its printString ...)" |
157 | 115 |
|
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
116 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
21538 | 117 |
"/ old ST80 means: draw-yourself on a GC. |
16747 | 118 |
(aGCOrStream isStream) ifFalse:[ |
14119
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
119 |
^ super displayOn:aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
120 |
]. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
121 |
|
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
122 |
aGCOrStream |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
123 |
nextPutAll:self className; |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
124 |
nextPut:$(. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
125 |
key displayOn:aGCOrStream. |
26e51066f338
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
126 |
aGCOrStream nextPut:$) |
21538 | 127 |
|
128 |
"Modified (comment): / 22-02-2017 / 16:49:37 / cg" |
|
607 | 129 |
! |
130 |
||
131 |
printOn:aStream |
|
4392 | 132 |
"append a user printed representation of the receiver to aStream. |
133 |
The format is suitable for a human - not meant to be read back." |
|
607 | 134 |
|
135 |
key printOn:aStream. |
|
157 | 136 |
! ! |
607 | 137 |
|
21538 | 138 |
|
629 | 139 |
!LookupKey class methodsFor:'documentation'! |
140 |
||
141 |
version |
|
19463 | 142 |
^ '$Header$' |
629 | 143 |
! ! |
15077 | 144 |