Desktop model Roger L. Costello

Desktop model Roger L. Costello Desktop model Roger L. Costello - Start

2018-11-10 6K 6 0 0

Desktop model Roger L. Costello - Description

March 24, 2018. icon2. Desktop0. Desktop1. cut. icon3. Desktop2. paste. icon3. icon1. icon3. It’s time to model software. In the previous examples there was just one or a small number of solutions (instances) satisfying the constraints. . ID: 727421 Download Presentation

Download Presentation

Desktop model Roger L. Costello




Download Presentation - The PPT/PDF document "Desktop model Roger L. Costello" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentations text content in Desktop model Roger L. Costello

Slide1

Desktop model

Roger L. CostelloMarch 24, 2018

icon2

Desktop0

Desktop1

cut

icon3

Desktop2

paste

icon3

icon1

icon3

Slide2

It’s time to model software

In the previous examples there was just one or a small number of solutions (instances) satisfying the constraints. With software there are usually many solutions.

Slide3

Model a desktop and two operations

In this example we model software that allows users to add and remove icons from a desktop. A cut operation removes one icon from the desktop. A paste operation adds one icon to the desktop.

Slide4

Problem Statement

Model a desktop, its icons, and cut and paste operations.We will create two versions of the model:Version #1: Hardcode the icons.Version #2: Arbitrary set of icons.

Slide5

Version #1: Simple Model

Let’s model a desktop that has just two icons named A and B, and a cut operation that removes B.

A

B

Desktop (first)

A

Desktop (second)

cut

Slide6

A set of Desktops, each with a set of icons

sig

Desktop {

icons: set

Icon

}

The set

keyword means that icons

maps each Desktop

to a set of

Icon (an

Icon is either A

or B

).

Desktop0

Desktop0

Desktop1

A

B

A

icons

Desktop0 is mapped to this set: {A, B}

Desktop1 is mapped to this (singleton) set: {A}

Slide7

Order the Desktops -- there is a first Desktop, a second Desktop, etc.

open

util/ordering[Desktop]

“first” denotes the first Desktop. “first.icons” denotes the icons on the first Desktop.

“prev” denotes the previous Desktop. Suppose d denotes one of the Desktops, then d.prev.icons denotes the icons on the previous Desktop.

“last” denotes the last Desktop.

“next” denotes the next Desktop.

Slide8

There are two icons, A and B

abstract

sig

Icon {}

one

sig A

extends Icon {}

one

sig B

extends Icon {}

enum

Icon { A, B }

Alternatively:

Slide9

Constrain the first desktop to contain both icons, the second desktop to contain just A

fact

{

first.icons = A + B

first.next.icons = A

}

Slide10

Specify in the

run command that the instance is to contain 2 Desktops.

run {} for

3 but

2 Desktop

Slide11

open

util/ordering[Desktop]

sig Desktop {

icons:

set Icon

}

enum Icon { A, B }

fact {

first.icons = A + B

first.next.icons = A

}run

{} for

3 but

2 Desktop

Slide12

Version #2: Arbitrary icons, cut/paste operations

We want the model to represent any set of icons on the first Desktop. Let d = the first Desktop and i = an icon on the first Desktop.The second Desktop = d - i, or

The second Desktop = d + j (where j is an icon not on d)Let d = the second Desktop and i = an icon on the second Desktop.The third Desktop = d - i, orThe third Desktop = d + j (where j is an icon not on d)And so forth.

Slide13

Here is one of the instances that Alloy generated:

icon2

Desktop0

Desktop1

cut

icon3

Desktop2

paste

icon3

icon1

icon3

Desktop3

icon3

icon1

icon0

paste

Desktop4

cut

icon3

icon1

Slide14

Desktop signature is same as before

open

util/ordering[Desktop]sig

Desktop {

icons: set

Icon

}

Slide15

Instead of enumerating the icons, have a set of icons:

sig

Icon {}

Slide16

The first Desktop contains a set of icons:

fact

init {

some

i: set

Icon | first.icons = i

}

Slide17

A Desktop cannot hold just any set of icons, a Desktop is derived from its previous Desktop: it has the icons on the previous Desktop, plus or minus one icon

fact

Desktops_through_cut_and_paste {

all d: Desktop - first |

(

some i: d.prev.icons | d.icons = d.prev.icons - i) or

(

some i: Icon - d.prev.icons | d.icons = d.prev.icons + i)

}

Slide18

open

util/ordering[Desktop]

sig Desktop {

icons:

set Icon

}

sig Icon {}

fact init {

some i: set

Icon | first.icons = i

}fact

Desktops_through_cut_and_paste {

all

d: Desktop - first |

(some i: d.prev.icons | d.icons = d.prev.icons - i)

or

(

some

i: Icon - d.prev.icons | d.icons = d.prev.icons + i)

}

run

{}

for

5

Do Lab3

Slide19


About DocSlides
DocSlides allows users to easily upload and share presentations, PDF documents, and images.Share your documents with the world , watch,share and upload any time you want. How can you benefit from using DocSlides? DocSlides consists documents from individuals and organizations on topics ranging from technology and business to travel, health, and education. Find and search for what interests you, and learn from people and more. You can also download DocSlides to read or reference later.