Concept:
Ghost field
Headline
Next to Model field, a Field category in Language:JML.
Description
Ghost fields can be initalized with values, which do not depend on any Java state in the code. But therefore you need to initialize it with a value and change its statement in the java code by using the "set"-keyword. So you can acess a value which is not directly a java variable. For the correct use take a look at the Illustration below.
Illustration
In the following example we will initialize a Ghost Field in the Feature:Cut, which should take care, that a employee´s salary can just get cut one time. Therefore we initialize a boolean Ghost Field in the employee class, which is false at the beginning and when the cut function gets called, it changes to true.
public class employee{
public double salary = 1000;
(...)
// Initialization of the Ghost Field
//@ public ghost boolean gotCut = false;
// Precondition, that takes sure that gotCut is equal to false
//@ requires gotCut == false;
public void cut(){
salary = salary/2;
// Setting the Ghost Field gotCut to true;
//@ set gotCut = true;
}
(...)
}
Backlinks
There are no revisions for this page.
User contributions
User edits
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.