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.TreeMap ; 24 import java.util.Map ; 25 import java.util.Set ; 26 import java.util.Collection ; 27 import java.util.Comparator ; 28 import java.util.SortedMap ; 29 30 34 public abstract class TreeMapImpl extends TreeMap 35 implements SpeedoGenClassProxy { 36 37 public TreeMapImpl() { 38 super(); 39 accessor = (MapAccessor) createAccessor(); 40 } 41 42 public String toString() { 43 return ""; 44 } 45 46 MapAccessor accessor; 47 48 public SpeedoAccessor getReferenceAccessor() { 49 return accessor; 50 } 51 public void setReferenceAccessor(SpeedoAccessor refAcc) { 52 accessor = (MapAccessor) refAcc; 53 } 54 55 public Object createGenClass() { 56 return new TreeMap (); 57 } 58 59 public SpeedoAccessor createAccessor() { 60 return new MapAccessor(this); 61 } 62 63 66 public int size() { 67 if (!jdoIsActive()) { 68 return accessor.size(); 69 } else { 70 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 71 return ma.size(); 72 } 73 } 74 75 public boolean isEmpty() { 76 if (!jdoIsActive()) { 77 return accessor.isEmpty(); 78 } else { 79 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 80 return ma.isEmpty(); 81 } 82 } 83 84 public boolean containsValue(Object o) { 85 if (!jdoIsActive()) { 86 return accessor.containsValue(o); 87 } else { 88 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 89 return ma.containsValue(o); 90 } 91 } 92 93 public synchronized boolean containsKey(Object o) { 94 if (!jdoIsActive()) { 95 return accessor.containsKey(o); 96 } else { 97 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 98 return ma.containsKey(o); 99 } 100 } 101 102 public synchronized Object get(Object o) { 103 if (!jdoIsActive()) { 104 return accessor.get(o); 105 } else { 106 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 107 return ma.get(o); 108 } 109 } 110 111 public synchronized Object put(Object o, Object o1) { 112 if (!jdoIsActive()) { 113 return accessor.put(o, o1); 114 } else { 115 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 116 return ma.put(o, o1); 117 } 118 } 119 120 public synchronized Object remove(Object o) { 121 if (!jdoIsActive()) { 122 return accessor.remove(o); 123 } else { 124 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 125 return ma.remove(o); 126 } 127 } 128 129 public synchronized void putAll(Map map) { 130 if (!jdoIsActive()) { 131 accessor.putAll(map); 132 } else { 133 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 134 ma.putAll(map); 135 } 136 } 137 138 public synchronized void clear() { 139 if (!jdoIsActive()) { 140 accessor.clear(); 141 } else { 142 MapAccessor ma = (MapAccessor) getSpeedoHome().writeIntention(this, null); 143 ma.clear(); 144 } 145 } 146 147 public Set keySet() { 148 if (!jdoIsActive()) { 149 return accessor.keySet(); 150 } else { 151 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 152 return ma.keySet(); 153 } 154 } 155 156 public Set entrySet() { 157 if (!jdoIsActive()) { 158 return accessor.entrySet(); 159 } else { 160 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 161 return ma.entrySet(); 162 } 163 } 164 165 public Collection values() { 166 if (!jdoIsActive()) { 167 return accessor.values(); 168 } else { 169 MapAccessor ma = (MapAccessor) getSpeedoHome().readIntention(this, null); 170 return ma.values(); 171 } 172 } 173 174 public Comparator comparator() { 175 throw new UnsupportedOperationException (); 176 } 177 178 public Object firstKey() { 179 throw new UnsupportedOperationException (); 180 } 181 182 public Object lastKey() { 183 throw new UnsupportedOperationException (); 184 } 185 186 public Object clone() { 187 throw new UnsupportedOperationException (); 188 } 189 190 public SortedMap subMap(Object fromKey, Object toKey) { 191 throw new UnsupportedOperationException (); 192 } 193 194 public SortedMap headMap(Object toKey) { 195 throw new UnsupportedOperationException (); 196 } 197 198 public SortedMap tailMap(Object fromKey) { 199 throw new UnsupportedOperationException (); 200 } 201 202 } 203 | Popular Tags |