1 / 32

SDL – Inheritance

SDL – Inheritance. 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. Code (cid,PIN). NOK. OK. NOK. OK.

bin
Download Presentation

SDL – Inheritance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SDL – Inheritance

  2. 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 Code (cid,PIN) NOK OK NOK OK cur_panel := to cur_panel to cur_panel sender Open Code(cid,PIN) via U to /* to Door */ Central Opening Idle Validation [Code] [opened,closed] [(validity)] P D U [(validity)] [Code] [open,close] Controller behaviour

  3. process type BlockingController inherits Controller 1(1) «process» controller BlockDoor * blocked * Enable Disable «process» BlockingController BlockDoor blocked Idle [Disable,Enable] U Behaviour inheritance For all states Add transition To new state Add signals

  4. 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 Code (cid,PIN) NOK OK NOK OK cur_panel := to cur_panel to cur_panel sender Open Code(cid,PIN) via U to /* to Door */ Central Opening Idle Validation [Code] [opened,closed] [(validity)] P D U [(validity)] [Code] [open,close] Inherited behaviour

  5. Who can interwork correctly? a:controller u c:validation b:blockingcontroller u d:blockingvalidation

  6. Subtyping for states and transitions Controller code OK NOK opened closed Idle Validation blockingController code OK NOK opened closed Disable Enable Idle Controller Validation Blocked

  7. Using the Blocking controller –the BlockingAccessPoint 1(1) block type BlockingAccessPoint signal opened,closed ; /* Door -> Controller */ signal open, close ; /* Controller -> Door */ BlockingController [unlock, [unlock, [(inp)] [(inp)] lock] lock] e CE d Panel Door [(outp)] [isOpen, [isOpen, [(outp)] isClosed] isClosed] [(validity)] P1 [opened, [code] [open, D close] P closed] [(validity)] D BlockingController apc: U CU [(validity)] [Code] C [Code] could we define this by inheriting from AccessPoint?

  8. Note that this is valid SDL-2000 notation! «process» controller «block» AccessPoint «process» LoggingController «block» LoggingAccessPoint «block» BlockingAccessPoint «process» BlockingController Inheritance: pure extension

  9. «process» controller {virtual} «block» AccessPoint «block» LoggingAccessPoint «process» Controller {finalised} «block» BlockingAccessPoint «process» Controller {redefined} Inheritance: virtual to enable changes

  10. 1(1) block type AccessPoint signal open, close ; /* Controller -> Door */ signal opened, closed ; /* Door -> Controller */ Virtual Controller [unlock, [unlock, [(inp)] [(inp)] lock] lock] CE d e Panel Door [isOpen, [isOpened, [(outp)] [(outp)] isClosed] isClosed] [(validity)] P1 [opened, [code] [open, D close] closed] P [(validity)] D apc: U Controller CU [(validity)] [Code] C [Code] Virtual process in modified AccessPoint

  11. Virtual process virtual process typeController 1(1) dclcur_panel PId ; /* current panel whose Code will be validated */ dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */ unlockDoor Validation Idle Code (cid,PIN) OK NOK NOK OK cur_panel := sender to cur_panel to cur_panel Code(cid,PIN)via U unlockDoor Idle Idle Validation [Code] [opened,closed] [(validity)] P D U [(validity)] [Code] [open,close]

  12. existing gate block type blockingAccessPoint inherits AccessPoint C redefined [Enable, Controller Disable] added signals Inheriting AccessPoint: BlockingAccessPoint Note that the full structure of AccessPoint is inherited here!

  13. Inherited structure 1(1) block type AccessPoint signal open, close ; /* Controller -> Door */ signal opened, closed ; /* Door -> Controller */ Virtual Controller [unlock, [unlock, [(inp)] [(inp)] lock] lock] CE d e Panel Door [isOpen, [isOpened, [(outp)] [(outp)] isClosed] isClosed] [(validity)] P1 [opened, [code] [open, D close] closed] P [(validity)] D apc: U Controller CU [(validity)] [Code] C [Code]

  14. redefined process type Controller 1(1) BlockDoor * blocked * Enable Disable BlockDoor blocked Idle [Disable,Enable] U Redefined process type:Controller in blocking AccessPoint

  15. existing instance 1(1) blocktype loggingAccessPoint inherits AccessPoint «block» AccessPoint finalised Controller apc: Controller L «block» LoggingAccessPoint LD LogDevice added signalroute added process [(validity),Code] Inheriting structure: LoggingAccessPoint

  16. virtual virtual Virtual process with virtual transitions virtual process typeController 1(1) dclcur_panel PId ; /* current panel whose Code will be validated */ dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */ unlockDoor Validation Idle Code (cid,PIN) OK NOK NOK OK cur_panel := sender to cur_panel to cur_panel Code(cid,PIN)via U unlockDoor Idle Idle Validation [Code] [opened,closed] [(validity)] P D U [(validity)] [Code] [open,close]

  17. finalised process type controller 1(1) «process» controller {virtual} Validation redefined finalized OK NOK OK, NOK, Code(cid,PIN) Code(cid,PIN) via L OK NOK via L to cur_panel to cur_panel via P via P «process» controller {finalised} L unlockDoor [Code, (validity)] Idle Idle Redefined and finalized transitions

  18. process type Controller 1(1) dclcur_panel PId ; /* current panel whose Code will be validated */ virtual whenOK dcl cid, PIN integer ; /* temporary variables for the data attributes of 'Code' */ virtual whenNotOK unlockDoor Validation Idle Code (cid,PIN) OK NOK whenNotOK whenOK cur_panel := sender unlockDoor Code(cid,PIN) via U Idle Idle Validation [Code] [opened,closed] [(validity)] P D U [(validity)] [Code] [open,close] Virtual Procedures

  19. process type loggingController inherits Controller redefined redefined WhenOK WhenNOK L [Code,OK,NOK] Redefining virtual procedures

  20. use AccessPointLib system type AccessControl unlock, lock unlock, lock unlock, lock [(inp)] [(outp)] [(validity)] [Code] e c ap(100): AccessPoint CentralUnit d [(validity),Disable, Enable] isOpen, isClosed isOpen, isClosed isOpen, isClosed [(inp)] [(outp)] [Code] e c bp(10): BlockingAccessPoint d [(inp)] [(outp)] [(validity)] [Code] e c lp(20): LoggingAccessPoint d Building a system from components

  21. The Block types in the AccessPointLib Package use SignalLib; package AccessPointLib AccessPoint BlockingAccessPoint LoggingAccessPoint

  22. package SignalLib signal eject-card, lock, unlock /* AccessPoint to ENV */ input-card, isOpen, isClosed /* ENV to AccessPoint*/ display, /* Display to ENV */ keys; /* ENV to Keyboard */ signal Code(integer,integer); /* AccessPoint to CentralUnit */ signal OK,NOK,ERR ; /* 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 BlockingAccessPoint */ /* CentralUnit to BlockingAccessPoint */ /* CentralUnit to

  23. use SignalLib ; use PanelLib / PanelInterface; use DoorLib / DoorInterface; package SystemTypes system type GeneralAccessControl AccessPoint virtual Door virtual Panel CE C e c CentralUnit [(out)] [(inp)] ls(10): [(validity)] [Code] AccessPoint virtual process type Door virtual process type Panel atleast DoorInterface atleast PanelInterface Specialisation of system types d

  24. 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

  25. System Instance use SpecialSystemTypes; system MAC: MyAccessControl

  26. block type AccessPoint 1(1) signal opened,closed ; /* Door -> Controller */ signal open, close ; /* Controller -> Door */ virtual Controller [unlock, [unlock, [(inp)] lock] [(inp)] lock] e CE d Panel Door [isOpen, [isOpen, [(outp)] [(outp)] isClosed] isClosed] [(validity)] P1 [opened, [code] [open, D close] closed] P [(validity)] D apc: U Controller CU [(validity)] [Code] C Context parameters <SIGNAL OK,NOK,ERR,Code(integer,integer), ejectCard, inputCard, display, keys> signallist validity = OK, NOK, ERR ; signallist outp = eject-card, display; signallist inp = input-card, keys ; [Code]

  27. use AccessPointLib/AccessPoint; system AccessControl 1(1) [(validity)] [Code] CE e C ap(100): AccessPoint <Ja,Nei,Feil, Kode, KortUt, KortIn, Skjerm, Taster> [(inp)] [(outp)] C CentralUnit Actual context parameters Actual context parameter

  28. Context parameters for dimensioning system AccessControl <SYNONYM apn Integer, bapn Integer, lapn Integer> 1(1) [(validity)] [Code] CE d e C ap(apn ): AccessPoint [(inp)] [(outp)] C [(validity), Enable, [Code] d CF Disable] e C CentralUnit bap(bapn): Blocking AccessPoint [(inp)] [(outp)] CB d lap(lapn): Logging AccessPoint CG C [(validity)] CL [Code] e [(inp)] [(outp)] [Code,(validity)] Logger L LL

  29. Variability in system families (Product lines) System Installation33: SystemType5 • Is inheritance sufficient? • Additional composition will be needed in many cases! Package system lib Processtypes Blocktypes Systemtypes System Installation45

  30. 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

  31. 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.

  32. 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.

More Related