start of new file
[IRC.git] / Robust / src / Tests / OwnershipAnalysisTest / test03 / test03.java
1
2 public class Parameter1 {
3     flag w;
4     Node root;
5     public Parameter1() {}
6 }
7
8 public class Node {
9     HashSet neighbors;
10
11     public Node() {
12         neighbors = new HashSet();
13     }
14
15     public static Node makeNode() {
16         return new Node();
17     }
18
19     public addNeighbor( Node n ) {
20         neighbors.add( n );
21     }
22 }
23
24 // this empty task should still create a non-empty
25 // ownership graph showing parameter allocation
26 // look for the parameter s as a label referencing
27 // a heap region that is multi-object, flagged, not summary
28 task Startup( StartupObject s{ initialstate } ) {
29
30     Parameter1 p1 = new Parameter1();
31
32     taskexit( s{ !initialstate } );
33 }
34
35
36 task MakeGraph( Parameter1 p1{ !w } ) {
37
38     Node n1 = Node.makeNode();
39     Node n2 = Node.makeNode();
40     Node n3 = Node.makeNode();
41
42     n1.addNeighbor( n2 );
43     n2.addNeighbor( n3 );
44     n3.addNeighbor( n1 );
45
46     p1.root = n1;
47
48
49     taskexit( p1{ w } );
50 }