author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 06 Aug 2013 02:55:01 +0100 | |
changeset 53 | 84e9840dd522 |
parent 36 | 935fcdb63171 |
permissions | -rw-r--r-- |
32
658f47bc231e
Code moved to package jv:smallsense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
1 |
"{ Package: 'jv:smallsense' }" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
3 |
SmallSenseType subclass:#SmallSenseUnionType |
26 | 4 |
instanceVariableNames:'types trustfullness trustfullnessBonus' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
classVariableNames:'' |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
poolDictionaries:'' |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
category:'SmallSense-Types' |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
!SmallSenseUnionType methodsFor:'accessing'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
12 |
|
26 | 13 |
trustfullness |
14 |
"Return an integer value in <1..100>, higher value |
|
15 |
means the object is more likely of that type." |
|
16 |
||
17 |
^ self shouldImplement |
|
18 |
! |
|
19 |
||
20 |
trustfullness: anInteger |
|
21 |
"Remember the bonus/malus given by an inferences" |
|
22 |
||
23 |
trustfullnessBonus := anInteger - trustfullness. |
|
24 |
trustfullness := anInteger min: 100. |
|
25 |
||
26 |
"Created: / 17-05-2012 / 19:43:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
27 |
! |
|
28 |
||
29 |
trustfullnessAdd: anInteger |
|
30 |
||
31 |
trustfullnessBonus := (trustfullnessBonus ? 0) + anInteger. |
|
32 |
trustfullness := trustfullness + anInteger. |
|
33 |
||
34 |
"Created: / 17-05-2012 / 19:47:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
35 |
! |
|
36 |
||
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
37 |
types |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
38 |
^ types ? #() |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
39 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
40 |
"Modified: / 16-12-2011 / 02:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
41 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
42 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
43 |
types:something |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
44 |
types := something. |
26 | 45 |
self updateTrustfullness |
46 |
||
47 |
"Modified: / 17-05-2012 / 19:23:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
48 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
49 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
50 |
!SmallSenseUnionType methodsFor:'adding & removing'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
51 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
52 |
addType: typeOrHolder |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
53 |
|
26 | 54 |
self basicAddType: typeOrHolder. |
55 |
self prune |
|
56 |
||
57 |
"Created: / 16-12-2011 / 01:50:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
58 |
! |
|
59 |
||
60 |
addTypes: typeOrHolder |
|
61 |
||
62 |
self basicAddTypes: typeOrHolder. |
|
63 |
self prune |
|
64 |
||
65 |
"Created: / 16-12-2011 / 01:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
66 |
! ! |
|
67 |
||
68 |
!SmallSenseUnionType methodsFor:'adding & removing-private'! |
|
69 |
||
70 |
basicAddType: typeOrHolder |
|
71 |
||
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
72 |
| type | |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
73 |
typeOrHolder isTypeHolder ifTrue:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |
type := typeOrHolder type |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
75 |
] ifFalse:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
76 |
type := typeOrHolder |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
77 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
78 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
79 |
types isNil ifTrue:[types := OrderedCollection new]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
80 |
type isUnionType ifTrue:[ |
26 | 81 |
self basicAddTypes: type types. |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
82 |
] ifFalse:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
83 |
type isUnknownType ifFalse:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
84 |
(types includes: type) ifFalse:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
85 |
types add: type. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
86 |
] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
87 |
] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
88 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
89 |
|
26 | 90 |
"Created: / 17-05-2012 / 19:27:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
91 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
92 |
|
26 | 93 |
basicAddTypes: someTypes |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
94 |
|
26 | 95 |
someTypes do:[:each|self basicAddType: each ]. |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
96 |
|
26 | 97 |
"Created: / 17-05-2012 / 19:28:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
98 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
99 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
100 |
!SmallSenseUnionType methodsFor:'comparing'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
101 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
102 |
= another |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
103 |
"superclass SmallSenseType says that I am responsible to implement this method" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
104 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
105 |
^self class == another class |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
106 |
and:[types size == another types size |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
107 |
and:[types = another types]] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
108 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
109 |
"Modified: / 16-12-2011 / 13:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
110 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
111 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
112 |
hash |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
113 |
"superclass SmallSenseType says that I am responsible to implement this method" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
114 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
115 |
^types hash |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
116 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
117 |
"Modified: / 16-12-2011 / 13:39:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
118 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
119 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
120 |
!SmallSenseUnionType methodsFor:'enumerating'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
121 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
122 |
classesDo:aBlock |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
123 |
"Enumerate all classes that this type represents" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
124 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
125 |
types notNil ifTrue:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
126 |
^types do:[:t|t classesDo: aBlock] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
127 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
128 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
129 |
"Modified: / 16-12-2011 / 13:34:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
130 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
131 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
132 |
typesDo: aBlock |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
133 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
134 |
(types ? #()) do:[:each| |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
135 |
each typesDo: aBlock |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
136 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
137 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
138 |
"Created: / 16-12-2011 / 02:17:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
139 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
140 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
141 |
!SmallSenseUnionType methodsFor:'operations'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
142 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
143 |
classSide |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
144 |
"superclass SmallSenseType says that I am responsible to implement this method" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
145 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
146 |
^ self class new |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
147 |
types: (types ? #() collect:[:t|t classSide]) |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
148 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
149 |
"Modified: / 16-12-2011 / 13:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
150 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
151 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
152 |
instanceSide |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
153 |
"superclass SmallSenseType says that I am responsible to implement this method" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
154 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
155 |
^ self class new |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
156 |
types: (types ? #() collect:[:t|t instanceSide]) |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
157 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
158 |
"Modified: / 16-12-2011 / 13:22:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
159 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
160 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
161 |
!SmallSenseUnionType methodsFor:'printing & storing'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
162 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
163 |
printWithoutAnglesOn:aStream |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
164 |
"superclass SmallSenseType says that I am responsible to implement this method" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
165 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
166 |
types isNil ifTrue:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
167 |
aStream nextPut: $? |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
168 |
] ifFalse:[ |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
169 |
types |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
170 |
do:[:each|each printWithoutAnglesOn:aStream] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
171 |
separatedBy:[aStream nextPut:$|] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
172 |
] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
173 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
174 |
"Modified: / 16-12-2011 / 01:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
175 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
176 |
|
26 | 177 |
!SmallSenseUnionType methodsFor:'private'! |
178 |
||
179 |
prune |
|
180 |
"Prune the types - remove less likely types." |
|
181 |
||
182 |
self updateTrustfullness. |
|
183 |
types size < 1 ifTrue:[ ^ self ]. |
|
184 |
||
185 |
"Experimental - remove those with trustfullness less than mine" |
|
186 |
||
187 |
types := types reject:[:type|type trustfullness < trustfullness ]. |
|
188 |
||
189 |
"Created: / 17-05-2012 / 19:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
190 |
! |
|
191 |
||
192 |
updateTrustfullness |
|
193 |
"Recompute the trustfullness, This is subject to tuning" |
|
194 |
||
195 |
"Average if individual types" |
|
196 |
types isEmpty ifTrue:[ |
|
197 |
trustfullness := 1 |
|
198 |
] ifFalse:[ |
|
199 |
trustfullness := (types inject:0 into:[:a :type|a + type trustfullness]) / types size. |
|
200 |
trustfullness := trustfullness + (trustfullnessBonus ? 0). |
|
201 |
]. |
|
202 |
||
203 |
"Created: / 17-05-2012 / 19:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
204 |
! ! |
|
205 |
||
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
206 |
!SmallSenseUnionType methodsFor:'testing'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
207 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
208 |
isUnionType |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
209 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
210 |
^true |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
211 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
212 |
"Created: / 16-12-2011 / 02:01:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
36
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
213 |
! |
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
214 |
|
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
215 |
isUnknownType |
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
216 |
"Union type is consireded unknown iff types are empty or all |
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
217 |
unknown" |
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
218 |
|
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
219 |
^types isEmptyOrNil or:[types allSatisfy:[:t|t isUnknownType]] |
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
220 |
|
935fcdb63171
Various fixes and tweaks in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
221 |
"Created: / 24-07-2013 / 13:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
222 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
223 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
224 |
!SmallSenseUnionType class methodsFor:'documentation'! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
225 |
|
29
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
226 |
version_HG |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
227 |
|
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
228 |
^ '$Changeset: <not expanded> $' |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
229 |
! |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
230 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
231 |
version_SVN |
26 | 232 |
^ '$Id: SmallSenseUnionType.st 8000 2012-05-17 23:16:11Z vranyj1 $' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
233 |
! ! |
29
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
26
diff
changeset
|
234 |