1 18 package org.objectweb.speedo.genclass.map; 19 20 import org.objectweb.speedo.genclass.api.SpeedoGenClassProxy; 21 import org.objectweb.speedo.mim.api.SpeedoAccessor; 22 23 import java.util.Map ; 24 import java.util.Set ; 25 import java.util.Collection ; 26 import java.util.HashMap ; 27 28 32 public abstract class HashMapImpl 33 extends HashMap 34 implements SpeedoGenClassProxy { 35 36 public HashMapImpl() { 37 super(); 38 accessor = (MapAccessor) createAccessor(); 39 } 40 41 public String toString() { 42 return ""; 43 } 44 45 MapAccessor accessor; 46 47 public SpeedoAccessor getReferenceAccessor() { 48 return accessor; 49 } 50 public void setReferenceAccessor(SpeedoAccessor refAcc) { 51 accessor = (MapAccessor) refAcc; 52 } 53 54 public Object createGenClass() { 55 return new HashMap (); 56 } 57 58 public SpeedoAccessor createAccessor() { 59 return new MapAccessor(this); 60 } 61 62 65 public int size() { 66 if (!jdoIsActive()) { 67 return accessor.size(); 68 } else { 69 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 70 return ma.size(); 71 } 72 } 73 74 public boolean isEmpty() { 75 if (!jdoIsActive()) { 76 return accessor.isEmpty(); 77 } else { 78 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 79 return ma.isEmpty(); 80 } 81 } 82 83 public boolean containsValue(Object o) { 84 if (!jdoIsActive()) { 85 return accessor.containsValue(o); 86 } else { 87 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 88 return ma.containsValue(o); 89 } 90 } 91 92 public synchronized boolean containsKey(Object o) { 93 if (!jdoIsActive()) { 94 return accessor.containsKey(o); 95 } else { 96 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 97 return ma.containsKey(o); 98 } 99 } 100 101 public synchronized Object get(Object o) { 102 if (!jdoIsActive()) { 103 return accessor.get(o); 104 } else { 105 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 106 return ma.get(o); 107 } 108 } 109 110 public synchronized Object put(Object o, Object o1) { 111 if (!jdoIsActive()) { 112 return accessor.put(o, o1); 113 } else { 114 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 115 return ma.put(o, o1); 116 } 117 } 118 119 public synchronized Object remove(Object o) { 120 if (!jdoIsActive()) { 121 return accessor.remove(o); 122 } else { 123 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 124 return ma.remove(o); 125 } 126 } 127 128 public synchronized void putAll(Map map) { 129 if (!jdoIsActive()) { 130 accessor.putAll(map); 131 } else { 132 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 133 ma.putAll(map); 134 } 135 } 136 137 public synchronized void clear() { 138 if (!jdoIsActive()) { 139 accessor.clear(); 140 } else { 141 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 142 ma.clear(); 143 } 144 } 145 146 public Set keySet() { 147 if (!jdoIsActive()) { 148 return accessor.keySet(); 149 } else { 150 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 151 return ma.keySet(); 152 } 153 } 154 155 public Set entrySet() { 156 if (!jdoIsActive()) { 157 return accessor.entrySet(); 158 } else { 159 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 160 return ma.entrySet(); 161 } 162 } 163 164 public Collection values() { 165 if (!jdoIsActive()) { 166 return accessor.values(); 167 } else { 168 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 169 return ma.values(); 170 } 171 } 172 } 173 174 | Popular Tags |