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 return mappair.hashCode();
45 return mappair.size();
48 public boolean contains(PrefetchPair ppKey) {
49 if(mappair.containsKey(ppKey))
54 public String toString() {
56 Set mapping = mappair.entrySet();
57 Iterator it = mapping.iterator();
58 label = "Mappings are: ";
59 for(; it.hasNext();) {
61 label += o.toString() + " , ";
66 public boolean equals(Object o) {
67 if(o instanceof PairMap) {
68 PairMap pm = (PairMap) o;
69 return mappair.equals(pm.mappair);
74 public boolean isEmpty() {
75 return mappair.isEmpty();