Fixed propagation, different change sets for the x and y branches before a new edge...
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / ReferenceEdgeProperties.java
1 package Analysis.OwnershipAnalysis;
2
3 public class ReferenceEdgeProperties {
4
5     protected boolean isUnique;
6     protected boolean isInitialParamReflexive;
7
8     protected ReachabilitySet beta;
9     protected ReachabilitySet betaNew;
10
11     protected OwnershipNode  src;
12     protected HeapRegionNode dst;
13
14     public ReferenceEdgeProperties() {
15         this( false, false, null );
16     }    
17
18     public ReferenceEdgeProperties( boolean isUnique ) {
19         this( isUnique, false, null );
20     }
21
22     public ReferenceEdgeProperties( boolean isUnique,
23                                     boolean isInitialParamReflexive ) {
24         this( isUnique, isInitialParamReflexive, null );
25     }
26
27     public ReferenceEdgeProperties( boolean         isUnique,
28                                     boolean         isInitialParamReflexive,
29                                     ReachabilitySet beta) {
30         this.isUnique                = isUnique;
31         this.isInitialParamReflexive = isInitialParamReflexive;
32
33         // these members are set by higher-level code
34         // when this ReferenceEdgeProperties object is
35         // applied to an edge
36         this.src = null;
37         this.dst = null;
38
39         if( beta != null ) {
40             this.beta = beta;
41         } else {
42             this.beta = new ReachabilitySet();
43             this.beta = this.beta.makeCanonical();
44         }
45
46         betaNew = new ReachabilitySet();
47         betaNew = betaNew.makeCanonical();
48     }
49
50
51     public OwnershipNode getSrc() {
52         return src;
53     }
54
55     public void setSrc( OwnershipNode on ) {
56         assert on != null;
57         src = on;
58     }
59
60     public HeapRegionNode getDst() {
61         return dst;
62     }
63
64     public void setDst( HeapRegionNode hrn ) {
65         assert hrn != null;
66         dst = hrn;
67     }
68
69
70     // copying does not copy source and destination members!
71     public ReferenceEdgeProperties copy() {
72         return new ReferenceEdgeProperties( isUnique,
73                                             isInitialParamReflexive,
74                                             beta );
75     }
76
77
78
79     public boolean isUnique() {
80         return isUnique;
81     }
82     public void setIsUnique( boolean isUnique ) {
83         this.isUnique = isUnique;
84     }
85
86
87
88     public boolean isInitialParamReflexive() {
89         return isInitialParamReflexive;
90     }
91     public void setIsInitialParamReflexive( boolean isInitialParamReflexive ) {
92         this.isInitialParamReflexive = isInitialParamReflexive;
93     }
94
95
96
97     public ReachabilitySet getBeta() {
98         return beta;
99     }
100
101     public void setBeta( ReachabilitySet beta ) {
102         assert beta != null;
103         this.beta = beta;
104     }
105
106     public ReachabilitySet getBetaNew() {
107         return betaNew;
108     }
109
110     public void setBetaNew( ReachabilitySet beta ) {
111         assert beta != null;
112         this.betaNew = beta;
113     }
114
115     public void applyBetaNew() {
116         assert betaNew != null;
117
118         beta = betaNew;
119
120         betaNew = new ReachabilitySet();
121         betaNew = betaNew.makeCanonical();
122     }
123
124
125     public boolean equals( ReferenceEdgeProperties rep ) {
126         assert rep != null;
127         
128         return isUnique                == rep.isUnique()                &&
129                isInitialParamReflexive == rep.isInitialParamReflexive();
130     }
131
132     public String getBetaString() {
133         return beta.toStringEscapeNewline();
134     }
135     
136     public String toEdgeLabelString() {
137         String edgeLabel = "";
138         /*
139         if( rep.isUnique() ) {
140           edgeLabel += "Unq";
141         }
142         */
143         if( isInitialParamReflexive ) {
144             edgeLabel += "Rflx\\n";
145         }
146         edgeLabel += getBetaString();
147         return edgeLabel;
148     }
149 }