BlockValue.st
author ca
Tue, 11 Feb 1997 20:02:28 +0100
changeset 410 2d21748e0d9c
parent 382 d64197ef1c9b
child 491 c5174fe6f09c
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
158
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
     3
	      All Rights Reserved
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ValueModel subclass:#BlockValue
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'cachedValue arguments block'
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
    16
	classVariableNames:'NeverComputed'
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Interface-Support-Models'
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!BlockValue class methodsFor:'documentation'!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
158
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
    26
	      All Rights Reserved
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    BlockValues depend on multiple other objects (typically valueHolders)
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    and recompute a value whenever one of them changes.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    If the new value is different, it triggers itself a change to its dependents.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    Example use is to base an enableChannels value on multiple other boolean values.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    (See example for how this is done)
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    46
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    47
    Notice: 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    48
        this class was implemented using protocol information
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    49
        from alpha testers - it may not be complete or compatible to
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    50
        the corresponding ST-80 class. 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    51
        If you encounter any incompatibilities, please forward a note 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    52
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    53
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    54
    [author:]
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    55
        Claus Gittinger
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
examples
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
"
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    62
    checkToggle 3 shows the value of toggle1 AND toggle2
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    63
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    64
        |val1 val2 both box|
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    65
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    66
        val1 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    67
        val2 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    68
        both := BlockValue 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    69
                    with:[:v1 :v2 | 
268
1998023f12dc showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    70
                            Transcript showCR:'evaluating ...'.
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    71
                            v1 value and:[v2 value]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    72
                         ] 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    73
                    arguments:(Array with:val1 with:val2).
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    74
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    75
        box := Dialog new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    76
        box addCheckBox:'one' on:val1.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    77
        box addCheckBox:'two' on:val2.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    78
        box addHorizontalLine.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    79
        box addCheckBox:'both' on:both.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    80
        box open
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    81
                                                                        [exEnd]
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    82
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    83
    the same, using a convenient instance creation message:
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    84
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    85
        |val1 val2 both box|
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    86
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    87
        val1 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    88
        val2 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    89
        both := BlockValue forLogical:val1 and:val2.
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    91
        box := Dialog new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    92
        box addCheckBox:'one' on:val1.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    93
        box addCheckBox:'two' on:val2.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    94
        box addHorizontalLine.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    95
        box addCheckBox:'both' on:both.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    96
        box open
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    97
                                                                        [exEnd]
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    98
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
    99
    logical or:
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   100
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   101
        |val1 val2 both box|
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   102
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   103
        val1 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   104
        val2 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   105
        both := BlockValue forLogical:val1 or:val2.
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   107
        box := Dialog new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   108
        box addCheckBox:'one' on:val1.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   109
        box addCheckBox:'two' on:val2.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   110
        box addHorizontalLine.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   111
        box addCheckBox:'both' on:both.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   112
        box open
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   113
                                                                        [exEnd]
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   114
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   115
    example use: enabling an element depending on two others:
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   116
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   117
        |val1 val2 enabler val3 box|
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   118
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   119
        val1 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   120
        val2 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   121
        val3 := false asValue.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   122
        enabler := BlockValue forLogical:val1 and:val2.
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   123
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   124
        box := Dialog new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   125
        box addCheckBox:'one' on:val1.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   126
        box addCheckBox:'two' on:val2.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   127
        box addHorizontalLine.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   128
        (box addCheckBox:'three' on:val3) enableChannel:enabler.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   129
        box open
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   130
                                                                        [exEnd]
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   131
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   132
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   133
    like above, using a logical-or block:
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   134
                                                                        [exBegin]
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   135
        |val1 val2 enabler val3 box|
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   136
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   137
        val1 := false asValue.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   138
        val2 := false asValue.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   139
        val3 := false asValue.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   140
        enabler := BlockValue forLogical:val1 or:val2.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   141
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   142
        box := Dialog new.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   143
        box addCheckBox:'one' on:val1.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   144
        box addCheckBox:'two' on:val2.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   145
        box addHorizontalLine.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   146
        (box addCheckBox:'three' on:val3) enableChannel:enabler.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   147
        box open
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   148
                                                                        [exEnd]
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   149
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   150
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   151
    like above, using a bunch of toggles:
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   152
                                                                        [exBegin]
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   153
        |values anyValue box|
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   154
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   155
        values := (1 to:10) collect:[:i | false asValue].
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   156
        anyValue := BlockValue forLogicalOrAll:values.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   157
        anyValue onChangeSend:#value to:[Transcript showCR:'any is true'].
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   158
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   159
        box := Dialog new.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   160
        values keysAndValuesDo:[:index :aValueHolder |
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   161
            box addCheckBox:index printString on:aValueHolder.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   162
        ].
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   163
        box addHorizontalLine.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   164
        (box addCheckBox:'any' on:nil) enableChannel:anyValue.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   165
        box open
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   166
                                                                        [exEnd]
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
! !
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   170
!BlockValue class methodsFor:'initialization'!
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   171
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   172
initialize
158
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   173
    NeverComputed isNil ifTrue:[
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   174
	NeverComputed := Object new.
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   175
    ]
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   176
! !
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   177
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
!BlockValue class methodsFor:'instance creation'!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   180
forLogical:arg1 and:arg2
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   181
    "return a new BlockValue computing the logical AND of its args"
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   182
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   183
    ^ (super new) 
158
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   184
	setBlock:[:a :b | a value and:[b value]]
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   185
	arguments:(Array with:arg1 with:arg2) 
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   186
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   187
    "Created: 16.12.1995 / 19:20:14 / cg"
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   188
!
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   189
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   190
forLogical:arg1 or:arg2
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   191
    "return a new BlockValue computing the logical OR of its args"
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   192
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   193
    ^ (super new) 
158
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   194
	setBlock:[:a :b | a value or:[b value]]
16f2237474fe only init once
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   195
	arguments:(Array with:arg1 with:arg2) 
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   196
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   197
    "Created: 16.12.1995 / 19:20:14 / cg"
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   198
!
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   199
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   200
forLogicalAndAll:argArray
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   201
    "return a new BlockValue computing the logical OR of all elements
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   202
     in the passed argArray"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   203
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   204
    ^ (super new) 
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   205
        setBlock:[:a | (argArray findFirst:[:a | a value not]) == 0]
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   206
        arguments:(Array with:argArray)
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   207
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   208
    "Created: 22.1.1997 / 19:12:44 / cg"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   209
!
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   210
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   211
forLogicalOrAll:argArray
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   212
    "return a new BlockValue computing the logical OR of all elements
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   213
     in the passed argArray"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   214
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   215
    ^ (super new) 
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   216
        setBlock:[:arg | self halt. (arg findFirst:[:el | el value]) ~~ 0]
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   217
        arguments:(Array with:argArray)
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   218
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   219
    "Created: 22.1.1997 / 19:13:01 / cg"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   220
    "Modified: 22.1.1997 / 19:19:42 / cg"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   221
!
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   222
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
with:aBlock
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    "return a new BlockValue computing aBlock"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    ^ (super new) setBlock:aBlock
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "Created: 16.12.1995 / 19:16:33 / cg"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   231
with:aBlock argument:anArgument
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   232
    "return a new BlockValue computing aBlock"
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   233
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   234
    ^ (super new) setBlock:aBlock arguments:(Array with:anArgument)
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   235
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   236
    "Created: 16.12.1995 / 19:20:14 / cg"
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   237
!
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   238
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
with:aBlock arguments:aCollectionOfArguments
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    "return a new BlockValue computing aBlock"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    ^ (super new) setBlock:aBlock arguments:aCollectionOfArguments
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
    "Created: 16.12.1995 / 19:20:14 / cg"
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
! !
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
!BlockValue methodsFor:'accessing'!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
dependOn:someObject
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   250
    "arrange for the blockValue to be reevaluated, whenever someObject
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   251
     changes (i.e. sends a change notification)"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   252
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    arguments isNil ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   254
        arguments := Array with:someObject
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    ] ifFalse:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   256
        arguments := arguments copyWith:someObject
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
    someObject addDependent:self
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   260
    "Modified: 22.1.1997 / 19:05:26 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
evaluate
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   264
    "evaluate the receivers action block"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   265
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    arguments isNil ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   267
        ^ block value
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    ^ block valueWithArguments:(arguments asArray)
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    "Created: 16.12.1995 / 19:27:40 / cg"
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   272
    "Modified: 22.1.1997 / 19:05:57 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
setBlock:aBlock
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   276
    "set the receivers action block"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   277
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    block := aBlock.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    arguments notNil ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   280
        self release
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    arguments := nil.
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   283
    cachedValue := NeverComputed.
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
    "Created: 16.12.1995 / 19:16:59 / cg"
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   286
    "Modified: 22.1.1997 / 19:05:54 / cg"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   287
!
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   288
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   289
setBlock:aBlock argumentArray:anArgumentCollection
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   290
    "set the receivers action block, and define an arguments collection
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   291
     to be passed to it.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   292
     A change in any element of the collection will force reevaluation of the 
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   293
     action block (passing the collection as a single argument)
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   294
     - possibly generating another change from myself"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   295
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   296
    block := aBlock.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   297
    arguments notNil ifTrue:[
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   298
        self release
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   299
    ].
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   300
    arguments := Array with:anArgumentCollection.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   301
    anArgumentCollection do:[:arg |
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   302
        arg addDependent:self
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   303
    ].
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   304
    cachedValue := NeverComputed.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   305
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   306
    "Modified: 22.1.1997 / 19:08:51 / cg"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   307
    "Created: 22.1.1997 / 19:22:13 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
setBlock:aBlock arguments:aCollectionOfArguments
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   311
    "set the receivers action block, and define arguments to be passed to it.
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   312
     A change in any of the arguments will force reevaluation of the action
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   313
     block - possibly generating another change from myself"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   314
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    block := aBlock.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    arguments notNil ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   317
        self release
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    arguments := aCollectionOfArguments.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
    arguments do:[:arg |
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   321
        arg addDependent:self
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    ].
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   323
    cachedValue := NeverComputed.
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
    "Created: 16.12.1995 / 19:21:41 / cg"
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   326
    "Modified: 22.1.1997 / 19:08:51 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
155
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   329
setValue:newValue 
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   330
    "physically set my value, without change notifications.
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   331
     This is a noop here, since my value is computed."
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   332
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   333
    ^ self
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   334
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   335
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   336
!
7b88cc365866 ignore setValue: / another comment
ah
parents: 146
diff changeset
   337
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
value
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   339
    "retrieve my value - this does not always evaluate the action block,
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   340
     since the returned value is cached internally"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   341
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   342
    cachedValue == NeverComputed ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   343
        cachedValue := self evaluate
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   344
    ].
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    ^ cachedValue
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
    "Created: 16.12.1995 / 19:23:26 / cg"
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   348
    "Modified: 22.1.1997 / 19:06:59 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
! !
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
347
2a795646e985 category rename
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   351
!BlockValue methodsFor:'change & update'!
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
update:something with:aParameter from:someone
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   354
    "the one I depend on has changed - reevaluate may actionBlock,
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   355
     and possibly send a change notification to my dependents"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   356
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
    |oldValue|
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
    oldValue := cachedValue.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    cachedValue := self evaluate.
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
    oldValue ~~ cachedValue ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   362
        self changed:#value
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    "Created: 16.12.1995 / 19:22:54 / cg"
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   366
    "Modified: 22.1.1997 / 19:07:39 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
! !
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
!BlockValue methodsFor:'release'!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
release
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   372
    "release any dependencies upon the arguments"
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   373
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
    arguments notNil ifTrue:[
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   375
        arguments do:[:arg | arg removeDependent:self].
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
    ].
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   378
    "Modified: 22.1.1997 / 19:08:06 / cg"
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
! !
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
!BlockValue class methodsFor:'documentation'!
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
version
382
d64197ef1c9b commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   384
    ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.9 1997-01-23 03:26:07 cg Exp $'
145
cb162538d41a intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
! !
146
9603cec98ac2 oops change notification was wrong
Claus Gittinger <cg@exept.de>
parents: 145
diff changeset
   386
BlockValue initialize!