more
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / ConditionalInterface.java
1 package edu.uci.eecs.specCompiler.specExtraction;
2
3 public class ConditionalInterface {
4         public final String interfaceName;
5         public final String hbConditionLabel;
6
7         public ConditionalInterface(String interfaceName, String hbConditionLabel) {
8                 this.interfaceName = interfaceName;
9                 this.hbConditionLabel = hbConditionLabel;
10         }
11
12         public boolean equals(Object other) {
13                 if (!(other instanceof ConditionalInterface))
14                         return false;
15                 ConditionalInterface another = (ConditionalInterface) other;
16                 return another.interfaceName.equals(interfaceName)
17                                 && (another.hbConditionLabel.equals(hbConditionLabel) || another.hbConditionLabel
18                                                 .equals(""));
19         }
20
21         public int hashCode() {
22                 return interfaceName.hashCode() << 5 ^ hbConditionLabel.hashCode();
23         }
24
25         public String toString() {
26                 if (hbConditionLabel.equals(""))
27                         return interfaceName + "(true)";
28                 else
29                         return interfaceName + "(" + hbConditionLabel + ")";
30         }
31 }