3 * Author: Alokika Dash adash@uci.edu
7 package Analysis.Prefetch;
14 * This class is used to represent mappings between Prefetch sets of a parent and
15 * child flatnode m(PSchildnode --> PSparentnode) Such analysis is used to insert
16 * prefetches during static analysis
19 public class PairMap {
20 public HashMap<PrefetchPair, PrefetchPair> mappair;
23 mappair = new HashMap<PrefetchPair, PrefetchPair>();
26 public void addPair(PrefetchPair ppKey, PrefetchPair ppValue) {
27 mappair.put(ppKey, ppValue);
30 public void removePair(PrefetchPair ppKey) {
31 mappair.remove(ppKey);
34 public PrefetchPair getPair(PrefetchPair ppKey) {
36 return mappair.get(ppKey);
40 public int hashCode() {
41 int hashcode = mappair.hashCode();
45 public String pairMapToString() {
47 Set mapping = mappair.entrySet();
48 Iterator it = mapping.iterator();
49 label = "Mappings are: ";
52 label += o.toString() + " ";
57 public boolean equals(Object o) {
58 if(o instanceof PairMap) {
59 PairMap pm = (PairMap) o;
60 if(mappair == null && pm.mappair == null) {
62 } else if(mappair != null && pm.mappair != null) {
63 if(mappair.equals((HashMap) pm.mappair)) {
73 public boolean isEmpty() {