a self replication algorithm to flexibly match join point
play

A Self-Replication Algorithm to Flexibly Match Join Point Traces - PowerPoint PPT Presentation

A Self-Replication Algorithm to Flexibly Match Join Point Traces Paul Leger and ric Tanter Department of Computer Science University of Chile Stateful Aspects In a Nutshell An aspect can only match a single join point A stateful aspect can


  1. A Self-Replication Algorithm to Flexibly Match Join Point Traces Paul Leger and Éric Tanter Department of Computer Science University of Chile

  2. Stateful Aspects In a Nutshell An aspect can only match a single join point A stateful aspect can match a join point trace [Douence+2005] c d a b Stateful aspects are used in security flaws, application errors, and crosscutting concerns 2

  3. Algorithms to Match Join Point Traces a b V Sequence Join Point a a b 1 1 Trace The matches of a sequence depend on Multiple Matches with v=1 Or this Single Match Multiple Matches Single Match the matching semantics of the algorithm 3

  4. Fixed Semantics to Match Traces Autosave feature : the document is automatically saved every three editions Tracematches tracematch() { support sym edit after: call(Editor.edit()); multiple matches sym save after: call(Editor.save()); edit edit edit { An artificial symbol is added to support Editor.save(); single match } } edit → edit → edit → save → edit → edit → edit → save edit → edit → edit → edit → edit → edit To adapt the matching semantics of an algorithm, developers code around it 4

  5. Matcher Cells An algorithm to flexibly match join point traces, where developers can define their own semantics Based on self-replication behavior

  6. Self-Replicating Behavior In a Nutshell Reactions of biological cells into a solution to a reagent trace reagent creation Cell nothing death solution 6

  7. Matcher Cells A cell contains a sequence and bound variables, and a reagent corresponds to a join point v a b b v a 1 a b v a b b v=1 b v=1 v=1 v Seed a b C 0 = { } Match R = { … } cell 7

  8. Examples of Matching Semantics with Matcher Cells With simple reaction rules, Matcher Cells makes it possible to express a wide range of matching semantics

  9. Multiple Matches b b b a a a b a b a b b C 0 = { } a b b R = { apply reaction } a b b 9

  10. Single Match b a a a b b b C 0 = { } a b R = { apply reaction, kill creators } 10

  11. Single Match at a Time (the autosave feature solution) b a a a b b b C 0 = { } a b R = { apply reaction, kill creators, a b add seed } 11

  12. Life-time for a Match Δ t > time a a b a b b … C 0 = { } a b R = { apply reaction, kill creators, trace life-time, add seed } 12

  13. Only the First Match b v=1 b a 1 v=1 a 2 v=z v=z v z a b v z v=z a b v z a b v=z v=z a 2 b v=2 v=z b 2 b 2 C 0 = { } v z a b v=2, z =2 v=z R = { apply reaction, kill all cells after match } 13

  14. An implementation of Matcher Cells Matching semantics is defined by the composition of rules (small functions)

  15. Reaction of a Cell react: Cell x JP → Cell • returns a new cell if matches • returns the same cell if does not match the join point 15

  16. Rules rule: List<Cell> x JP → List<Cell> var applyReaction = function (cells, jp) { The elemental rule return removeDuplicates(append(cells, map(cells, react, jp))); } var killCreators = function (rule) { Rule designators return function (cells, jp) { allow var nextCells = rule (cells, jp); rule composition return difference(nextCells, getCreators(nextCells, cells)); } } var addSeed = function (sequence) { return function (rule) { return function (cells, jp) { Rule designators can be parametrized var nextCells = rule(cells, jp); return length(nextCells) == 0 || onlyMatchCells(nextCells)? append(nextCells,[createSeed(sequence)]): nextCells; }}} 16

  17. Multiple Matches b b b a a b a b a b a b b a b b var multipleMatches = applyReaction; 17

  18. Single Match b a a a b b b var singleMatch = killCreators(applyReaction); 18

  19. Single Match at a Time b a a a b b b a b var singleMatchAtATime = addSeed(sequence)(killCreators(applyReaction)); 19

  20. Life-time for a Match Δ t > time a a b a b b … var lifeTimeForAMatch = addSeed(sequence)(traceLifeTime(delta)(killCreators(applyReaction))); 20

  21. Only the First Match b v=1 b 2 b a 1 a 2 v=1 v=z v=z v z a b v z a b v=2, z =2 v=z v z a b v=z v=z a 2 b v=2 v=z b 2 var onlyTheFirstMatch = killAllCellsAfterMatch(applyReaction); 21

  22. Conclusions The Matcher Cells algorithm - allows developers to define their own matching semantics - using the composition of reaction rules of self-replication algorithms Application We implement an expressive and open stateful aspect language using Matcher Cells (http://pleiad.cl/otm) Try it on-line: http://pleiad.cl/otm/matchercells 22

  23. Adding Customized Information to Cells Some rules require that all cells contain customized information react: Cell x JP x [Seq x Env → Cell] → Cell For example, the lifeTimeForAMatch rule requires a cell time function (seq, env) { env = env.bind(“time”, getTime()); return env; }; 23

  24. Independence between Sequence Language and Matcher Cells • The react ion of a cell strongly depends on the sequence language used • When a cell matches a join point and/or binds a variable, the reaction of a cell has to return the next step in the matching • Apart from the previous restriction, Matcher Cells does not impose another restriction to the sequence language 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend