Skip to content

Commit 02502e6

Browse files
style: correct style of counter
1 parent 3942aba commit 02502e6

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/env/example/Counter.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,30 @@
1010

1111
package example;
1212

13-
import cartago.*;
13+
import cartago.Artifact;
14+
import cartago.OPERATION;
15+
import cartago.ObsProperty;
1416

17+
/**
18+
* Example class for Cartago env.
19+
*/
1520
public class Counter extends Artifact {
16-
void init(int initialValue) {
17-
defineObsProperty("count", initialValue);
18-
}
21+
/**
22+
* Init counter.
23+
* @param initialValue
24+
*/
25+
void init(final int initialValue) {
26+
defineObsProperty("count", initialValue);
27+
}
1928

20-
@OPERATION
21-
void inc() {
22-
ObsProperty prop = getObsProperty("count");
23-
prop.updateValue(prop.intValue()+1);
24-
signal("tick");
25-
}
29+
/**
30+
* Inc operation.
31+
*/
32+
@OPERATION
33+
void inc() {
34+
final ObsProperty prop = getObsProperty("count");
35+
prop.updateValue(prop.intValue() + 1);
36+
signal("tick");
37+
}
2638
}
2739

0 commit comments

Comments
 (0)