clean code
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / GlobalConstruct.java
diff --git a/src/edu/uci/eecs/specCompiler/specExtraction/GlobalConstruct.java b/src/edu/uci/eecs/specCompiler/specExtraction/GlobalConstruct.java
deleted file mode 100644 (file)
index 499a710..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-package edu.uci.eecs.specCompiler.specExtraction;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-
-public class GlobalConstruct extends Construct {
-       public final SequentialDefineSubConstruct code;
-       private final HashMap<String, HashSet<ConditionalInterface>> interfaceCluster;
-       private final HashMap<ConditionalInterface, HashSet<ConditionalInterface>> originalHBRelations;
-       public final HashMap<ConditionalInterface, HashSet<ConditionalInterface>> hbRelations;
-       public final ArrayList<CommutativityRule> commutativityRules;
-       public final 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;
-               this.commutativityRules = new ArrayList<CommutativityRule>();
-       }
-
-       public void addInterface2Cluster(String clusterName,
-                       ConditionalInterface condInterface) {
-               if (!interfaceCluster.containsKey(clusterName)) {
-                       interfaceCluster.put(clusterName,
-                                       new HashSet<ConditionalInterface>());
-               }
-               HashSet<ConditionalInterface> set = interfaceCluster.get(clusterName);
-               set.add(condInterface);
-       }
-
-       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);
-       }
-       
-       public void addCommutativityRule(String method1, String method2, String condition) {
-               CommutativityRule rule = new CommutativityRule(method1, method2, condition);
-               if (!commutativityRules.contains(rule)) {
-                       commutativityRules.add(rule);
-               }
-       }
-
-       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) {
-               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);
-                       for (ConditionalInterface right : rights) {
-                               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(left + " -> ");
-                       for (ConditionalInterface right : rights) {
-                               sb.append(right + " | ");
-                       }
-                       sb.append(".\n");
-               }
-
-               return sb.toString();
-       }
-}