LecturedFoils

Download Report

Transcript LecturedFoils

SDL –
Inheritance
SDS
Foil no 1
Controller behaviour
process type Controller
1(2)
dcl cur_panel PId ; /* current panel whose Code will be validated */
dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */
Idle
Validation
virtual
OK
Code
(cid,PIN)
OK
to cur_panel
cur_panel :=
sender
Code(cid,
PIN) via U
Validation
to
Central
SDS
Foil no 2
[(validity)]
NOK
to cur_panel
Open
/* to Door */
Opening
[Code]
P
NOK
Idle
[opened,closed]
D
[open,close]
[(validity)]
U
[Code]
Behaviour inheritance
process type BlockingController
inherits Controller
1(1)
«process»
controller
BlockDoor
For all states
*
Add transition
Disable
blocked
Enable
«process»
BlockingController
*
BlockDoor
To new state
blocked
Idle
[Disable,Enable]
U
SDS
Foil no 3
Add
signals
Inherited behaviour
process type Controller
1(2)
dcl cur_panel PId ; /* current panel whose Code will be validated */
dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */
Idle
Validation
virtual
OK
Code
(cid,PIN)
OK
to cur_panel
cur_panel :=
sender
Code(cid,
PIN) via U
Validation
to
Central
SDS
Foil no 4
[(validity)]
NOK
to cur_panel
Open
/* to Door */
Opening
[Code]
P
NOK
Idle
[opened,closed]
D
[open,close]
[(validity)]
U
[Code]
Who can interwork correctly?
SDS
Foil no 5
a:controller u
c:validation
b:blocking
controller u
d:blocking
validation
Subtyping for states and transitions
Controller
code
OK
NOK opened closed
Idle
Validation
blockingController
code
Idle
Validation
Blocked
SDS
Foil no 6
OK
NOK opened closed
Controller
Disable Enable
Using the Blocking controller –
the BlockingAccessPoint
1(1)
block type BlockingAccessPoint
signal opened,closed ; /* Door -> Controller */
signal open, close ; /* Controller -> Door */
BlockingController
e
[(inp)]
[(outp)]
CE
[unlock,
lock]
[(inp)]
Panel
[(outp)]
Door
[(validity)]
[opened,
[code]
D
P
closed]
D
apc: Blocking
U
Controller
[(validity)]
P1
SDS
Foil no 7
[isOpen,
isClosed]
[open,
close]
CU
d
[unlock,
lock]
[isOpen,
isClosed]
[(validity)]
[Code]
C
could we define this by inheriting from AccessPoint?
[Code]
Inheritance: pure extension
«block»
AccessPoint
«block»
BlockingAccessPoint
Note that this is
valid SDL-2000
notation!
«block»
LoggingAccessPoint
«process»
controller
«process»
BlockingController
SDS
Foil no 8
«process»
LoggingController
Inheritance: virtual to enable changes
«block»
AccessPoint
«block»
BlockingAccessPoint
«block»
LoggingAccessPoint
«process»
controller
{virtual}
SDS
Foil no 9
«process»
Controller
«process»
Controller
{redefined}
{finalised}
Virtual process in modified AccessPoint
1(1)
block type AccessPoint
signal open, close ; /* Controller -> Door */
signal opened, closed ; /* Door -> Controller */
Virtual
Controller
[(inp)]
e
CE
[unlock,
lock]
[(inp)]
Panel
[(outp)]
[(validity)]
[opened,
[code]
D
closed]
P
D
apc:
Controller U [(validity)]
SDS
Foil no 10
Door
[isOpen,
isClosed]
[(outp)]
P1
d
[unlock,
lock]
[open,
close]
CU
[isOpened,
isClosed]
[(validity)]
[Code]
C
[Code]
Virtual process
virtual process type Controller
1(1)
dcl cur_panel PId ; /* current panel whose Code will be validated */
dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */
Idle
Validation
Code
(cid,PIN)
cur_panel :=
sender
Code(cid,PIN
) via U
OK
NOK
OK
to cur_panel
NOK
to cur_panel
unlockDoor
Idle
Validation
[Code]
P
SDS
Foil no 11
[(validity)]
unlockDoor
Idle
[opened,closed]
D
[open,close]
[(validity)]
U
[Code]
Inheriting AccessPoint: BlockingAccessPoint
block type blockingAccessPoint
inherits AccessPoint
existing
gate
C
redefined
Controller
[Enable,
Disable]
added
signals
Note that the full structure of AccessPoint is inherited here!
SDS
Foil no 12
Inherited structure
1(1)
block type AccessPoint
signal open, close ; /* Controller -> Door */
signal opened, closed ; /* Door -> Controller */
Virtual
Controller
[(inp)]
e
[(outp)]
CE
[(inp)]
Panel
[isOpen, [isOpened,
isClosed] isClosed]
[(validity)]
[code] [opened,
[open,
D close]
P
D closed]
apc:
Controller U [(validity)]
Foil no 13
Door
[(outp)]
P1
SDS
[unlock,
[unlock,
lock]
lock]
d
CU
[(validity)]
[Code]
C
[Code]
Redefined process type:
Controller in blocking AccessPoint
redefined process type Controller
1(1)
BlockDoor
*
Disable
blocked
Enable
*
BlockDoor
blocked
Idle
[Disable,Enable]
U
SDS
Foil no 14
Inheriting structure: LoggingAccessPoint
«block»
AccessPoint
blocktype loggingAccessPoint
inherits AccessPoint
1(1)
finalised
Controller
apc:
Controller
L
LogDevice
LD
[(validity),Code]
added
process
SDS
Foil no 15
added
signalroute
existing
instance
«block»
LoggingAccessPoint
Virtual process with virtual transitions
virtual process type Controller
1(1)
dcl cur_panel PId ; /* current panel whose Code will be validated */
dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */
Idle
Validation
unlockDoor
virtual
OK
virtual
NOK
OK
to cur_panel
NOK
to cur_panel
Code
(cid,PIN)
cur_panel :=
sender
Code(cid,PIN
) via U
unlockDoor
Idle
Validation
[Code]
P
SDS
Foil no 16
[(validity)]
Idle
[opened,closed]
D
[open,close]
[(validity)]
U
[Code]
Redefined and finalized transitions
finalised process type controller
1(1)
«process»
controller
{virtual}
Validation
redefined
finalized
OK
NOK
OK
to cur_panel
via P
NOK
to cur_panel
via P
OK,
Code(cid,PIN)
via L
NOK,
Code(cid,PIN)
via L
«process»
controller
{finalised}
L
unlockDoor
[Code, (validity)]
Idle
SDS
Foil no 17
Idle
Virtual Procedures
process type Controller
1(1)
dcl cur_panel PId ; /* current panel whose Code will be validated */
dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */
virtual
whenOK
unlockDoor
Idle
Validation
virtual
whenNotOK
Code
(cid,PIN)
cur_panel :=
OK
NOK
whenOK
whenNotOK
sender
Code(cid,PIN
)
via U
unlockDoor
Idle
Idle
Validation
[Code]
P
[(validity)]
SDS
Foil no 18
[opened,closed]
D
[open,close]
[(validity)]
U
[Code]
Redefining virtual procedures
process type loggingController
inherits Controller
redefined
WhenOK
redefined
WhenNOK
L
SDS
Foil no 19
[Code,OK,NOK]
Building a system from components
use AccessPointLib
system type AccessControl
[(outp)]
unlock,
lock
[(outp)]
unlock,
lock
[(outp)]
unlock,
lock
SDS
Foil no 20
[(inp)]
isOpen,
isClosed
e
ap(100):
AccessPoin
dt
[(inp)]
isOpen,
isClosed
[(inp)]
isOpen,
isClosed
e bp(10):
Blocking
AccessPoin
d
t
[(validity)]
[Code]
[(validity),
Disable,
c Enable]
[Code]
[(validity)]
[Code]
c
e lp(20):
c
Logging
AccessPoint
d
CentralUnit
The Block types in the AccessPointLib Package
use SignalLib ;
package AccessPointLib
AccessPoint
SDS
Foil no 21
BlockingAccessPoint
LoggingAccessPoint
package SignalLib
signal
eject-card, lock, unlock
input-card, isOpen, isClosed
display,
keys;
signal Code(integer,integer);
signal OK,NOK,ERR ;
/* AccessPoint
/* ENV
/* Display
/* ENV
/* AccessPoint
/* CentralUnit
to ENV */
to AccessPoint*/
to ENV */
to Keyboard */
to CentralUnit */
to AccessPoint */
signallist validity = OK, NOK, ERR ;
signallist outp = EjectCard, display;
signallist inp = InputCard, keys ;
signal opened,closed ; /* Door to Controller */
signal open, close ; /* Controller to Door */
signal
Disable,
Enable
SDS
Foil no 22
/* CentralUnit to
/* CentralUnit to
BlockingAccessPoint */
BlockingAccessPoint */
Specialisation of system types
use SignalLib ;
use PanelLib / PanelInterface;
use DoorLib / DoorInterface;
package SystemTypes
system type GeneralAccessControl
virtual Door
CE
[(out)]
[(inp)]
virtual Panel
d
e
ls(10):
AccessPoint
virtual process type Panel
atleast PanelInterface
SDS
Foil no 23
AccessPoint
C
c
[(validity)]
CentralUnit
[Code]
virtual process type Door
atleast DoorInterface
use SystemTypes
package SpecialSystemTypes
system type MyAccessControl inherits GeneralAccessControl
redefined Door
redefined Panel
Redefined process type Panel inherits PanelInterface
Redefined process type Door inherits DoorInterface
SDS
Foil no 24
System Instance
use
SpecialSystemTypes;
system MAC: MyAccessControl
SDS
Foil no 25
Context parameters
block type AccessPoint
<SIGNAL OK,NOK,ERR,Code(integer,integer),
ejectCard, inputCard, display, keys>
1(1)
signal opened,closed ; /* Door -> Controller */
signal open, close ; /* Controller -> Door */
signallist validity = OK, NOK, ERR ;
signallist outp = eject-card, display;
signallist inp = input-card, keys ;
virtual
Controller
e [(inp)]
[(outp)]
CE
[(inp)]
Panel
[(validity)]
[opened,
[code]
D
closed]
P
D
apc:
Controller
Foil no 26
Door
[(outp)]
P1
SDS
[unlock,
lock]
U
[(validity)]
[isOpen,
isClosed]
[open,
close]
CU
d
[unlock,
lock]
[isOpen,
isClosed]
[(validity)]
[Code]
C
[Code]
Actual context parameter
use AccessPointLib/AccessPoint;
system AccessControl
1(1)
[(validity)]
CE
[(outp)]
[(inp)]
e
C
ap(100):
AccessPoint
<Ja,Nei,Feil,
Kode,
KortUt, KortIn,
Skjerm, Taster>
Actual
context
parameters
SDS
Foil no 27
[Code]
C
CentralUnit
Context parameters for dimensioning
system AccessControl
<SYNONYM apn Integer, bapn Integer, lapn Integer>
CE
e
[(outp)]
CF
[(outp)]
ap(apn ):
[(inp)]
d
bap(bapn):
C
Blocking
AccessPoint
L
Foil no 28
[(validity),
Enable,
Disable]
C
[Code]
CentralUnit
CB
d
lap(lapn):
CG
C
e Logging
AccessPoint
[(outp)] [(inp)]
SDS
[Code]
C
AccessPoint
e
[(inp)]
[(validity)]
d
1(1)
[(validity)]
CL
LL
[Code]
[Code,
(validity)]
Logger
Variability in system families (Product lines)
System
Installation33:
SystemType5
Package system lib
Process
types
Block
types
System
types
System
Installation45
• Is inheritance sufficient?
• Additional composition will be needed in many cases!
SDS
Foil no 29
Summary 1 (Inheritance)
Specialization of process, state types and procedures
• Simple inheritance, adding properties
• Virtual procedures
• Virtual transitions
Specialization of block types
• Simple inheritance, adding properties
• Virtual block types
• Virtual process types
• Virtual procedure types
Specialization of data and signal types
• Simple inheritance, adding properties
SDS
Foil no 30
Summary 2 (Virtual, redefined, finalized)
•Virtual types may have virtuality constraints given by an atleast-clause
which specifies a minimum type which the analysis of the enclosing type
may take for granted. When no atleast-clause is given, the default is that
the original virtual type itself is the constraint type.
•A redefined type is a type which is specified as virtual in a supertype of
the type enclosing the redefined type. A redefined type must be a
specialization of the virtuality constraint. A redefined type may be further
redefined in specializations of its encloser.
•A finalized type is a type which is specified as virtual in a supertype of
the encloser. A finalized type must be a specialization of the virtuality
constraint. A finalized type may not be defined again in specializations of
its encloser.
•Virtual, redefined and finalized can also be used for individual
transitions in processes. The virtuality specification can occur in input
symbols, start symbols and save symbols.
SDS
Foil no 31
Summary 3 (analyzability)
• Specifying a type as virtual decreases the degree of analysis which can
be performed on its encloser (since the instances of the virtual type may
be of a type which is actually not known at the analysis of the encloser).
However, it increases the flexibility of specializations.
• Finalizing a type increases the degree of analysis which can be
performed on the encloser.
SDS
Foil no 32