package edu.uci.eecs.specCompiler.specExtraction;
+import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
private final HashMap<ConditionalInterface, HashSet<ConditionalInterface>> originalHBRelations;
public final HashMap<ConditionalInterface, HashSet<ConditionalInterface>> hbRelations;
public final HashMap<String, String> options;
-
- public GlobalConstruct(SequentialDefineSubConstruct code, HashMap<String, String> options) {
+
+ public GlobalConstruct(File file, int beginLineNum,
+ SequentialDefineSubConstruct code, HashMap<String, String> options) {
+ super(file, beginLineNum);
this.code = code;
this.interfaceCluster = new HashMap<String, HashSet<ConditionalInterface>>();
this.originalHBRelations = new HashMap<ConditionalInterface, HashSet<ConditionalInterface>>();
this.hbRelations = new HashMap<ConditionalInterface, HashSet<ConditionalInterface>>();
this.options = options;
}
-
- public void addInterface2Cluster(String clusterName, ConditionalInterface condInterface) {
+
+ public void addInterface2Cluster(String clusterName,
+ ConditionalInterface condInterface) {
if (!interfaceCluster.containsKey(clusterName)) {
- interfaceCluster.put(clusterName, new HashSet<ConditionalInterface>());
+ interfaceCluster.put(clusterName,
+ new HashSet<ConditionalInterface>());
}
HashSet<ConditionalInterface> set = interfaceCluster.get(clusterName);
set.add(condInterface);
}
-
- public void addHBCondition(ConditionalInterface left, ConditionalInterface right) {
+
+ public void addHBCondition(ConditionalInterface left,
+ ConditionalInterface right) {
if (!originalHBRelations.containsKey(left)) {
originalHBRelations.put(left, new HashSet<ConditionalInterface>());
}
HashSet<ConditionalInterface> set = originalHBRelations.get(left);
set.add(right);
}
-
- private void addUnfoldedHBCondition(ConditionalInterface left, ConditionalInterface right) {
+
+ private void addUnfoldedHBCondition(ConditionalInterface left,
+ ConditionalInterface right) {
if (!hbRelations.containsKey(left)) {
hbRelations.put(left, new HashSet<ConditionalInterface>());
}
HashSet<ConditionalInterface> set = hbRelations.get(left);
set.add(right);
}
-
- private HashSet<ConditionalInterface> getByName(ConditionalInterface condInterface) {
+
+ private HashSet<ConditionalInterface> getByName(
+ ConditionalInterface condInterface) {
if (interfaceCluster.containsKey(condInterface.interfaceName))
return interfaceCluster.get(condInterface.interfaceName);
HashSet<ConditionalInterface> res = new HashSet<ConditionalInterface>();
res.add(condInterface);
return res;
}
-
+
public void unfoldInterfaceCluster() {
for (ConditionalInterface left : originalHBRelations.keySet()) {
- HashSet<ConditionalInterface> rights = originalHBRelations.get(left);
+ HashSet<ConditionalInterface> rights = originalHBRelations
+ .get(left);
for (ConditionalInterface right : rights) {
- HashSet<ConditionalInterface> leftCondInterfaces = getByName(left),
- rightCondInterfaces = getByName(right);
+ HashSet<ConditionalInterface> leftCondInterfaces = getByName(left), rightCondInterfaces = getByName(right);
for (ConditionalInterface l : leftCondInterfaces) {
for (ConditionalInterface r : rightCondInterfaces) {
addUnfoldedHBCondition(l, r);
}
}
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder("GlobalConstruct:\n");
sb.append("@Code:\n");
sb.append(code);
-
+
sb.append("@Happens_before:\n");
for (ConditionalInterface left : hbRelations.keySet()) {
HashSet<ConditionalInterface> rights = hbRelations.get(left);
}
sb.append(".\n");
}
-
+
return sb.toString();
}
}