1.1 --- a/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Tue Jul 02 23:44:22 2002 +0000
1.2 +++ b/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Wed Jul 03 18:33:17 2002 +0000
1.3 @@ -67,7 +67,7 @@
1.4
1.5 private Map classProxies = null;
1.6 private Map associationProxies = null;
1.7 - private Map classProxiesMofIds = null;
1.8 + private Map classProxiesMofIds = null;
1.9
1.10 private final Map parameters;
1.11
1.12 @@ -321,7 +321,7 @@
1.13 // Traverse the metamodel containtment
1.14 classProxies = new HashMap();
1.15 associationProxies = new HashMap();
1.16 - classProxiesMofIds = new HashMap();
1.17 + classProxiesMofIds = new HashMap();
1.18
1.19 if (existingInstances != null) {
1.20 for (int i = 0; i < existingInstances.length; i++) {
1.21 @@ -548,8 +548,7 @@
1.22 }
1.23 sc.addSuperclass(current.getMofId());
1.24 current.addSubclass(sc.getMofId());
1.25 - }
1.26 - indexTags = new LinkedList ();
1.27 + }
1.28 for (Iterator contents = cls.getContents().iterator(); contents.hasNext();) {
1.29 me = (ModelElement) contents.next();
1.30 if (me instanceof Reference) {
1.31 @@ -557,10 +556,14 @@
1.32 //System.out.println("registering reference: " + me.getName() + " for end: " + end.getName());
1.33 sc.addReferenceDescriptor(me.refMofId(), me.getName(), (String) associationProxies.get(end.getContainer().refMofId()), end.getName());
1.34 }
1.35 - if ((me instanceof Tag) && (TAGID_INDEX.equals (((Tag) me).getTagId()))) {
1.36 - indexTags.add (me);
1.37 - }
1.38 } // for
1.39 + indexTags = new LinkedList ();
1.40 + Iterator tags = ((ModelPackage) cls.refOutermostPackage()).getAttachesTo().getTag(cls).iterator();
1.41 + while (tags.hasNext ()) {
1.42 + Tag tag = (Tag) tags.next ();
1.43 + if (TAGID_INDEX.equals (tag.getTagId()))
1.44 + indexTags.add (tag);
1.45 + }
1.46 if (indexTags.size() > 0) {
1.47 try {
1.48 sc.buildAdditionalIndexes (indexTags, associationProxies);
1.49 @@ -569,6 +572,7 @@
1.50 }
1.51 }
1.52 } // for
1.53 +
1.54 }
1.55
1.56 /**
2.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexSet.java Tue Jul 02 23:44:22 2002 +0000
2.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexSet.java Wed Jul 03 18:33:17 2002 +0000
2.3 @@ -26,6 +26,7 @@
2.4 */
2.5 public class AssocEndIndexSet extends IndexImmutSet implements TypedCollection {
2.6 protected final String metaMofId;
2.7 + protected final String metaMofIdOther;
2.8 protected final Class type;
2.9 protected final int maxSize;
2.10 protected final StorableAssociation storable;
2.11 @@ -33,11 +34,14 @@
2.12 protected final boolean mutable;
2.13 protected final boolean isAggregate;
2.14 protected final boolean isAggregateOther;
2.15 + protected final boolean isIndexed;
2.16 + protected final boolean isIndexedOther;
2.17 protected final StorableObject keyObject;
2.18
2.19 - protected AssocEndIndexSet(StorableAssociation storable, String metaMofId, MultivaluedIndex index, Object indexKey, Index secondIndex, Class type, int max, boolean mutable, boolean isAggregate, boolean isAggregateOther) {
2.20 + protected AssocEndIndexSet(StorableAssociation storable, String metaMofId, String metaMofIdOther, MultivaluedIndex index, Object indexKey, Index secondIndex, Class type, int max, boolean mutable, boolean isAggregate, boolean isAggregateOther, boolean isIndexed, boolean isIndexedOther) {
2.21 super(storable.getMdrStorage(), index, indexKey);
2.22 this.metaMofId = metaMofId;
2.23 + this.metaMofIdOther = metaMofIdOther;
2.24 this.type = type;
2.25 this.maxSize = max;
2.26 this.storable = storable;
2.27 @@ -45,8 +49,10 @@
2.28 this.mutable = mutable;
2.29 this.isAggregate = isAggregate;
2.30 this.isAggregateOther = isAggregateOther;
2.31 + this.isIndexed = isIndexed;
2.32 + this.isIndexedOther = isIndexedOther;
2.33
2.34 - if (isAggregate || isAggregateOther) {
2.35 + if (isAggregate || isAggregateOther || isIndexed) {
2.36 try {
2.37 keyObject = (StorableObject) storage.getObject((String) indexKey);
2.38 } catch (StorageException e) {
2.39 @@ -87,21 +93,41 @@
2.40 }
2.41
2.42 public boolean remove(Object o) {
2.43 - try {
2.44 + try {
2.45 + StorableObject so = null;
2.46 +
2.47 if (isAggregate) {
2.48 keyObject.clearComposite();
2.49 } else if (isAggregateOther) {
2.50 - ((StorableObject) storage.getObject((String) o)).clearComposite();
2.51 + if (so == null)
2.52 + so = (StorableObject) storage.getObject((String) o);
2.53 + so.clearComposite();
2.54 }
2.55 -
2.56 +
2.57 + if (isIndexed) {
2.58 + keyObject.removeFromIndex (metaMofId);
2.59 + }
2.60 + if (isIndexedOther) {
2.61 + if (so == null)
2.62 + so = (StorableObject) storage.getObject((String) o);
2.63 + so.removeFromIndex (metaMofIdOther);
2.64 + }
2.65 +
2.66 boolean result = this.index.remove(indexKey, o);
2.67 if (result) {
2.68 if (secondIndex instanceof SinglevaluedIndex) {
2.69 secondIndex.remove(o);
2.70 } else {
2.71 ((MultivaluedIndex) secondIndex).remove(o, indexKey);
2.72 - }
2.73 + }
2.74 }
2.75 + if (isIndexed) {
2.76 + keyObject.addToIndex (metaMofId);
2.77 + }
2.78 + if (isIndexedOther) {
2.79 + so.addToIndex (metaMofIdOther);
2.80 + }
2.81 +
2.82 return result;
2.83 } catch (StorageException e) {
2.84 e.printStackTrace();
2.85 @@ -112,13 +138,30 @@
2.86 public boolean add(Object obj) {
2.87 checkMaxSize(size() + 1);
2.88 try {
2.89 - if (isAggregate) {
2.90 + StorableObject so = null;
2.91 + if (isAggregate) {
2.92 keyObject.setComposite((String) obj, (String) obj, metaMofId);
2.93 } else if (isAggregateOther) {
2.94 - ((StorableObject) storage.getObject((String) obj)).setComposite(keyObject, (String) obj, metaMofId);
2.95 + if (so == null)
2.96 + so = (StorableObject) storage.getObject((String) obj);
2.97 + so.setComposite(keyObject, (String) obj, metaMofId);
2.98 + }
2.99 + if (isIndexed) {
2.100 + keyObject.removeFromIndex (metaMofId);
2.101 + }
2.102 + if (isIndexedOther) {
2.103 + if (so == null)
2.104 + so = (StorableObject) storage.getObject((String) obj);
2.105 + so.removeFromIndex (metaMofIdOther);
2.106 }
2.107 index.add(indexKey, obj);
2.108 secondIndex.add(obj, indexKey);
2.109 + if (isIndexed) {
2.110 + keyObject.addToIndex (metaMofId);
2.111 + }
2.112 + if (isIndexedOther) {
2.113 + so.addToIndex (metaMofIdOther);
2.114 + }
2.115 return true;
2.116 } catch (StorageBadRequestException e) {
2.117 // duplicate element -> return false
2.118 @@ -169,12 +212,26 @@
2.119 ((StorableObject) lastRead).clearComposite();
2.120 }
2.121
2.122 + if (isIndexed) {
2.123 + keyObject.removeFromIndex (metaMofId);
2.124 + }
2.125 + if (isIndexedOther) {
2.126 + ((StorableObject) lastRead).removeFromIndex (metaMofIdOther);
2.127 + }
2.128 +
2.129 String key = ((StorableBaseObject) lastRead).getMofId ();
2.130 if (secondIndex instanceof MultivaluedIndex) {
2.131 ((MultivaluedIndex) secondIndex).remove(key, indexKey);
2.132 } else {
2.133 secondIndex.remove(key);
2.134 }
2.135 +
2.136 + if (isIndexed) {
2.137 + keyObject.addToIndex (metaMofId);
2.138 + }
2.139 + if (isIndexedOther) {
2.140 + ((StorableObject) lastRead).addToIndex (metaMofIdOther);
2.141 + }
2.142 } catch (StorageException e) {
2.143 throw new DebugException();
2.144 }
3.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexUList.java Tue Jul 02 23:44:22 2002 +0000
3.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AssocEndIndexUList.java Wed Jul 03 18:33:17 2002 +0000
3.3 @@ -27,8 +27,8 @@
3.4 public class AssocEndIndexUList extends AssocEndIndexSet implements List {
3.5 private final MultivaluedOrderedIndex orderedIndex;
3.6
3.7 - protected AssocEndIndexUList(StorableAssociation storable, String metaMofId, MultivaluedOrderedIndex index, Object indexKey, Index secondIndex, Class type, int max, boolean mutable, boolean isAggregate, boolean isAggregateOther) {
3.8 - super(storable, metaMofId, index, indexKey, secondIndex, type, max, mutable, isAggregate, isAggregateOther);
3.9 + protected AssocEndIndexUList(StorableAssociation storable, String metaMofId, String metaMofIdOther, MultivaluedOrderedIndex index, Object indexKey, Index secondIndex, Class type, int max, boolean mutable, boolean isAggregate, boolean isAggregateOther, boolean isIndexed, boolean isIndexedOther) {
3.10 + super(storable, metaMofId, metaMofIdOther, index, indexKey, secondIndex, type, max, mutable, isAggregate, isAggregateOther, isIndexed, isIndexedOther);
3.11 this.orderedIndex = index;
3.12 }
3.13
3.14 @@ -88,6 +88,14 @@
3.15 ((StorableObject) storage.getObject((String) object)).setComposite(keyObject, (String) object, metaMofId);
3.16 }
3.17
3.18 + if (isIndexed) {
3.19 + keyObject.removeFromIndex (metaMofId);
3.20 + }
3.21 + if (isIndexedOther) {
3.22 + ((StorableObject) storage.getObject((String) oldValue)).removeFromIndex (metaMofIdOther);
3.23 + ((StorableObject) storage.getObject((String) object)).removeFromIndex (metaMofIdOther);
3.24 + }
3.25 +
3.26 orderedIndex.replace(indexKey, index, object);
3.27 if (secondIndex instanceof SinglevaluedIndex) {
3.28 secondIndex.remove(oldValue);
3.29 @@ -95,6 +103,15 @@
3.30 ((MultivaluedIndex) secondIndex).remove(oldValue, indexKey);
3.31 }
3.32 secondIndex.add(object, indexKey);
3.33 +
3.34 + if (isIndexed) {
3.35 + keyObject.addToIndex (metaMofId);
3.36 + }
3.37 + if (isIndexedOther) {
3.38 + ((StorableObject) storage.getObject((String) oldValue)).addToIndex (metaMofIdOther);
3.39 + ((StorableObject) storage.getObject((String) object)).addToIndex (metaMofIdOther);
3.40 + }
3.41 +
3.42 return storage.getObject((String) oldValue);
3.43 } catch (StorageException e) {
3.44 throw new DebugException();
3.45 @@ -104,13 +121,32 @@
3.46 public void add(int index, Object element) {
3.47 try {
3.48 checkMaxSize(size() + 1);
3.49 + StorableObject so = null;
3.50 if (isAggregate) {
3.51 keyObject.setComposite((String) element, (String) element, metaMofId);
3.52 } else if (isAggregateOther) {
3.53 - ((StorableObject) storage.getObject((String) element)).setComposite(keyObject, (String) element, metaMofId);
3.54 + if (so == null)
3.55 + so = (StorableObject) storage.getObject((String) element);
3.56 + so.setComposite(keyObject, (String) element, metaMofId);
3.57 + }
3.58 + if (isIndexed) {
3.59 + keyObject.removeFromIndex (metaMofId);
3.60 }
3.61 + if (isIndexedOther) {
3.62 + if (so == null)
3.63 + so = (StorableObject) storage.getObject((String) element);
3.64 + so.removeFromIndex (metaMofIdOther);
3.65 + }
3.66 +
3.67 orderedIndex.add(indexKey, index, element);
3.68 secondIndex.add(element, indexKey);
3.69 +
3.70 + if (isIndexed) {
3.71 + keyObject.addToIndex (metaMofId);
3.72 + }
3.73 + if (isIndexedOther) {
3.74 + so.addToIndex (metaMofIdOther);
3.75 + }
3.76 } catch (StorageException e) {
3.77 throw new DebugException();
3.78 }
3.79 @@ -119,17 +155,38 @@
3.80 public Object remove(int index) {
3.81 try {
3.82 Object oldValue = getItemsList().get(index);
3.83 + StorableObject so = null;
3.84 if (isAggregate) {
3.85 keyObject.clearComposite();
3.86 } else if (isAggregateOther) {
3.87 - ((StorableObject) storage.getObject((String) oldValue)).clearComposite();
3.88 + if (so == null)
3.89 + so = (StorableObject) storage.getObject((String) oldValue);
3.90 + so.clearComposite();
3.91 }
3.92 +
3.93 + if (isIndexed) {
3.94 + keyObject.removeFromIndex (metaMofId);
3.95 + }
3.96 + if (isIndexedOther) {
3.97 + if (so == null)
3.98 + so = (StorableObject) storage.getObject((String) oldValue);
3.99 + so.removeFromIndex (metaMofIdOther);
3.100 + }
3.101 +
3.102 orderedIndex.remove(indexKey, index);
3.103 if (secondIndex instanceof SinglevaluedIndex) {
3.104 secondIndex.remove(oldValue);
3.105 } else {
3.106 ((MultivaluedIndex) secondIndex).remove(oldValue, indexKey);
3.107 }
3.108 +
3.109 + if (isIndexed) {
3.110 + keyObject.addToIndex (metaMofId);
3.111 + }
3.112 + if (isIndexedOther) {
3.113 + so.addToIndex (metaMofIdOther);
3.114 + }
3.115 +
3.116 return storage.getObject((String) oldValue);
3.117 } catch (StorageException e) {
3.118 throw new DebugException();
3.119 @@ -157,7 +214,19 @@
3.120 } else if (isAggregateOther) {
3.121 ((StorableObject) storage.getObject((String) obj)).setComposite(keyObject, (String) obj, metaMofId);
3.122 }
3.123 + if (isIndexed) {
3.124 + keyObject.removeFromIndex (metaMofId);
3.125 + }
3.126 + if (isIndexedOther) {
3.127 + ((StorableObject) storage.getObject((String) obj)).removeFromIndex (metaMofIdOther);
3.128 + }
3.129 secondIndex.add(obj, indexKey);
3.130 + if (isIndexed) {
3.131 + keyObject.addToIndex (metaMofId);
3.132 + }
3.133 + if (isIndexedOther) {
3.134 + ((StorableObject) storage.getObject((String) obj)).addToIndex (metaMofIdOther);
3.135 + }
3.136 } catch (StorageException e) {
3.137 throw new DebugException();
3.138 }
3.139 @@ -190,12 +259,30 @@
3.140 ((StorableObject) lastRead).clearComposite();
3.141 ((StorableObject) lastRead).setComposite(keyObject, (String) key, metaMofId);
3.142 }
3.143 +
3.144 + if (isIndexed) {
3.145 + keyObject.removeFromIndex (metaMofId);
3.146 + }
3.147 + if (isIndexedOther) {
3.148 + ((StorableObject) lastRead).removeFromIndex (metaMofIdOther);
3.149 + ((StorableObject) storage.getObject((String) obj)).removeFromIndex (metaMofIdOther);
3.150 + }
3.151 +
3.152 if (secondIndex instanceof MultivaluedIndex) {
3.153 ((MultivaluedIndex) secondIndex).remove(key, indexKey);
3.154 } else {
3.155 secondIndex.remove(key);
3.156 }
3.157 secondIndex.add(obj, indexKey);
3.158 +
3.159 + if (isIndexed) {
3.160 + keyObject.addToIndex (metaMofId);
3.161 + }
3.162 + if (isIndexedOther) {
3.163 + ((StorableObject) lastRead).addToIndex (metaMofIdOther);
3.164 + ((StorableObject) storage.getObject((String) obj)).addToIndex (metaMofIdOther);
3.165 + }
3.166 +
3.167 } catch (StorageException e) {
3.168 e.printStackTrace ();
3.169 throw new DebugException();
4.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Tue Jul 02 23:44:22 2002 +0000
4.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Wed Jul 03 18:33:17 2002 +0000
4.3 @@ -40,6 +40,7 @@
4.4 protected transient Class type;
4.5 protected transient boolean isRefObject;
4.6 protected transient String metaMofId;
4.7 + protected transient boolean isIndexed = false;
4.8
4.9 public AttrCollection() {
4.10 }
4.11 @@ -108,6 +109,7 @@
4.12 this.maxSize = attrDesc.getMaxSize();
4.13 this.isRefObject = RefObject.class.isAssignableFrom(this.type);
4.14 this.metaMofId = attrDesc.getMofId();
4.15 + this.isIndexed = (mdrObject instanceof StorableObject) && attrDesc.isIndexed ();
4.16 }
4.17
4.18 protected RefObject getMetaElement() {
4.19 @@ -121,6 +123,8 @@
4.20 public boolean add(Object obj) {
4.21 checkType(obj);
4.22 checkMaxSize(inner.size() + 1);
4.23 + if (isIndexed)
4.24 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
4.25 boolean result = inner.add(obj);
4.26 if (result) {
4.27 if (isRefObject) {
4.28 @@ -133,6 +137,8 @@
4.29 }
4.30 mdrObject.objectChanged();
4.31 }
4.32 + if (isIndexed)
4.33 + ((StorableObject) mdrObject).addToIndex (metaMofId);
4.34 return result;
4.35 }
4.36
4.37 @@ -177,6 +183,8 @@
4.38 }
4.39
4.40 public boolean remove(Object obj) {
4.41 + if (isIndexed)
4.42 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
4.43 boolean result = inner.remove(obj);
4.44 if (result) {
4.45 if (isRefObject) {
4.46 @@ -189,6 +197,8 @@
4.47 }
4.48 mdrObject.objectChanged();
4.49 }
4.50 + if (isIndexed)
4.51 + ((StorableObject) mdrObject).addToIndex (metaMofId);
4.52 return result;
4.53 }
4.54
4.55 @@ -247,6 +257,8 @@
4.56 }
4.57
4.58 public void remove() {
4.59 + if (isIndexed)
4.60 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
4.61 inner.remove();
4.62 if (isRefObject) {
4.63 try {
4.64 @@ -256,6 +268,8 @@
4.65 throw new DebugException();
4.66 }
4.67 }
4.68 + if (isIndexed)
4.69 + ((StorableObject) mdrObject).addToIndex (metaMofId);
4.70 mdrObject.objectChanged();
4.71 }
4.72
5.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrList.java Tue Jul 02 23:44:22 2002 +0000
5.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrList.java Wed Jul 03 18:33:17 2002 +0000
5.3 @@ -46,6 +46,10 @@
5.4 public void add(int param, Object obj) {
5.5 checkType(obj);
5.6 checkMaxSize(size() + 1);
5.7 +
5.8 + if (isIndexed)
5.9 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
5.10 +
5.11 innerList.add(param, obj);
5.12 if (isRefObject) {
5.13 try {
5.14 @@ -55,6 +59,10 @@
5.15 throw new DebugException();
5.16 }
5.17 }
5.18 +
5.19 + if (isIndexed)
5.20 + ((StorableObject) mdrObject).addToIndex (metaMofId);
5.21 +
5.22 mdrObject.objectChanged();
5.23 }
5.24
5.25 @@ -83,7 +91,10 @@
5.26 return new AttrListIterator(innerList.listIterator(param));
5.27 }
5.28
5.29 - public Object remove(int param) {
5.30 + public Object remove(int param) {
5.31 + if (isIndexed)
5.32 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
5.33 +
5.34 Object result = innerList.remove(param);
5.35 if (isRefObject) {
5.36 try {
5.37 @@ -93,12 +104,20 @@
5.38 throw new DebugException();
5.39 }
5.40 }
5.41 +
5.42 + if (isIndexed)
5.43 + ((StorableObject) mdrObject).addToIndex (metaMofId);
5.44 +
5.45 mdrObject.objectChanged();
5.46 return result;
5.47 }
5.48
5.49 public Object set(int param, Object obj) {
5.50 checkType(obj);
5.51 +
5.52 + if (isIndexed)
5.53 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
5.54 +
5.55 Object result = innerList.set(param, obj);
5.56 if (isRefObject) {
5.57 try {
5.58 @@ -109,6 +128,10 @@
5.59 throw new DebugException();
5.60 }
5.61 }
5.62 +
5.63 + if (isIndexed)
5.64 + ((StorableObject) mdrObject).addToIndex (metaMofId);
5.65 +
5.66 mdrObject.objectChanged();
5.67 return result;
5.68 }
5.69 @@ -128,6 +151,10 @@
5.70 public void add(Object obj) {
5.71 checkType(obj);
5.72 checkMaxSize(innerList.size() + 1);
5.73 +
5.74 + if (isIndexed)
5.75 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
5.76 +
5.77 innerIterator.add(obj);
5.78 if (isRefObject) {
5.79 try {
5.80 @@ -137,6 +164,10 @@
5.81 throw new DebugException();
5.82 }
5.83 }
5.84 +
5.85 + if (isIndexed)
5.86 + ((StorableObject) mdrObject).addToIndex (metaMofId);
5.87 +
5.88 mdrObject.objectChanged();
5.89 }
5.90
5.91 @@ -158,6 +189,10 @@
5.92
5.93 public void set(Object obj) {
5.94 checkType(obj);
5.95 +
5.96 + if (isIndexed)
5.97 + ((StorableObject) mdrObject).removeFromIndex (metaMofId);
5.98 +
5.99 innerIterator.set(obj);
5.100 if (isRefObject) {
5.101 try {
5.102 @@ -168,6 +203,10 @@
5.103 throw new DebugException();
5.104 }
5.105 }
5.106 +
5.107 + if (isIndexed)
5.108 + ((StorableObject) mdrObject).addToIndex (metaMofId);
5.109 +
5.110 mdrObject.objectChanged();
5.111 }
5.112 }
6.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrUList.java Tue Jul 02 23:44:22 2002 +0000
6.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrUList.java Wed Jul 03 18:33:17 2002 +0000
6.3 @@ -125,7 +125,7 @@
6.4 innerSet.remove(lastRead);
6.5 }
6.6
6.7 - public void add(Object obj) {
6.8 + public void add(Object obj) {
6.9 if (!innerSet.add(obj)) {
6.10 throw new DuplicateException(obj, getMetaElement());
6.11 }
7.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/MdrStorage.java Tue Jul 02 23:44:22 2002 +0000
7.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/MdrStorage.java Wed Jul 03 18:33:17 2002 +0000
7.3 @@ -61,6 +61,7 @@
7.4 // prefixes for context-specific indexes
7.5 private static final String PREFIX_ATTR_INDEX = "ai:";
7.6 private static final String PREFIX_ATTR_INDEXES_BY_NAME = "aibn:";
7.7 + private static final String PREFIX_ATTR_INDEXES_CLASS_PROXY = "aicp:";
7.8 private static final String PREFIX_ASSOC_END = "ae:";
7.9
7.10 /** name of storage property which holds MOFID of outermost package
7.11 @@ -789,6 +790,7 @@
7.12 }
7.13 // create set of context specific indexes
7.14 storage.createSinglevaluedIndex(PREFIX_ATTR_INDEXES_BY_NAME + mofId, Storage.EntryType.STRING, Storage.EntryType.STRING);
7.15 + storage.createSinglevaluedIndex(PREFIX_ATTR_INDEXES_CLASS_PROXY + mofId, Storage.EntryType.STRING, Storage.EntryType.MOFID);
7.16
7.17 // add context to the index of contexts
7.18 if (name != null) {
7.19 @@ -821,6 +823,7 @@
7.20
7.21 // drop the rest of context indexes
7.22 storage.dropIndex(PREFIX_ATTR_INDEXES_BY_NAME + mofId);
7.23 + storage.dropIndex(PREFIX_ATTR_INDEXES_CLASS_PROXY + mofId);
7.24
7.25 // delete context
7.26 if (name != null) {
7.27 @@ -890,12 +893,14 @@
7.28 * @param indexName names the index to be created
7.29 * @throws StorageException
7.30 */
7.31 - public void createAdditionalIndex(String context, String indexName) throws StorageException {
7.32 + public void createAdditionalIndex(String context, String indexName, String proxyId) throws StorageException {
7.33 Storage storage = getStorageByMofId(context);
7.34 if (storage == null) {
7.35 throw new DebugException("Storage not found");
7.36 }
7.37 + // the following two indexes can be merged if index is able to return 'key iterator'
7.38 storage.getSinglevaluedIndex(PREFIX_ATTR_INDEXES_BY_NAME + context).put(indexName, indexName);
7.39 + storage.getSinglevaluedIndex(PREFIX_ATTR_INDEXES_CLASS_PROXY + context).put(indexName, proxyId);
7.40 storage.createMultivaluedIndex(getAdditionalIndexName(context, indexName), Storage.EntryType.STRING, Storage.EntryType.MOFID, false);
7.41 }
7.42
7.43 @@ -918,6 +923,18 @@
7.44 }
7.45 }
7.46
7.47 + private StorableClass getIndexClassProxy (String context, String indexName) {
7.48 + try {
7.49 + Storage storage = getStorageByMofId(context);
7.50 + if (storage == null) {
7.51 + throw new DebugException("Storage not found");
7.52 + }
7.53 + return (StorableClass) getObject((String)storage.getSinglevaluedIndex(PREFIX_ATTR_INDEXES_CLASS_PROXY + context).get(indexName));
7.54 + } catch (StorageException e) {
7.55 + return null;
7.56 + }
7.57 + }
7.58 +
7.59 /**
7.60 * The same as {@link #getAdditionalIndex(String, String)}.
7.61 *
7.62 @@ -935,13 +952,31 @@
7.63 }
7.64
7.65 /**
7.66 - * @param context
7.67 - * @param indexName
7.68 - * @param valueToString
7.69 + * This method is for internal usage only (NamespaceImpl) !
7.70 + */
7.71 + public Collection objectsFromAdditionalIndex(String context, String indexName, String value) {
7.72 + try {
7.73 + SinglevaluedIndex objectsIndex = getObjectsIndexByMofId (context);
7.74 + return getAdditionalIndex (context, resolveAttrMofId(context, indexName)).getObjects (value, objectsIndex);
7.75 + } catch (StorageException e) {
7.76 + return null;
7.77 + }
7.78 + }
7.79 +
7.80 + /**
7.81 + * @param context mof id of related outermost package extent
7.82 + * @param indexName name of the queried index
7.83 + * @param value queried key value, can be used only in case of one-field indexes
7.84 * @return
7.85 */
7.86 - public Collection getItemsFromAdditionalIndex(String context, String indexName, String valueToString) {
7.87 + public Collection getItemsFromAdditionalIndex(String context, String indexName, Object value) {
7.88 try {
7.89 + StorableClass sc = getIndexClassProxy (context, indexName);
7.90 + if (sc == null) {
7.91 + throw new DebugException ("Index " + indexName + " does not exist in the specified context.");
7.92 + }
7.93 + StorableClass.IndexDescriptor desc = sc.getAdditionalIndex (indexName);
7.94 + String valueToString = StorableObject.valueToKey (value, desc.getFields());
7.95 return getAdditionalIndex(context, resolveAttrMofId(context, indexName)).getItems(valueToString);
7.96 } catch (StorageException e) {
7.97 return null;
7.98 @@ -949,25 +984,43 @@
7.99 }
7.100
7.101 /**
7.102 - * @param context
7.103 - * @param indexName
7.104 - * @param valueToString key represented by a String, see @link#StorableObject.objectToString method for key to String coding
7.105 + * @param context mof id of related outermost package extent
7.106 + * @param indexName name of the queried index
7.107 + * @param value queried key value, can be used only in case of one-field indexes
7.108 * @return
7.109 */
7.110 - public Collection getObjectsFromAdditionalIndex(String context, String indexName, String valueToString) {
7.111 + public Collection getObjectsFromAdditionalIndex(String context, String indexName, Object value) {
7.112 try {
7.113 + StorableClass sc = getIndexClassProxy (context, indexName);
7.114 + if (sc == null) {
7.115 + throw new DebugException ("Index " + indexName + " does not exist in the specified context.");
7.116 + }
7.117 + StorableClass.IndexDescriptor desc = sc.getAdditionalIndex (indexName);
7.118 + String valueToString = StorableObject.valueToKey (value, desc.getFields());
7.119 SinglevaluedIndex objectsIndex = getObjectsIndexByMofId (context);
7.120 return getAdditionalIndex (context, resolveAttrMofId(context, indexName)).getObjects (valueToString, objectsIndex);
7.121 } catch (StorageException e) {
7.122 return null;
7.123 }
7.124 }
7.125 -
7.126 - public Collection getObjectsFromAdditionalIndex(String context, String indexName, List values) {
7.127 +
7.128 + /**
7.129 + * @param context mof id of related outermost package extent
7.130 + * @param indexName name of the queried index
7.131 + * @param map map of pairs (field name, queried value)
7.132 + * @return
7.133 + */
7.134 + public Collection queryAdditionalIndex(String context, String indexName, Map map) {
7.135 try {
7.136 + StorableClass sc = getIndexClassProxy (context, indexName);
7.137 + if (sc == null) {
7.138 + Thread.dumpStack();
7.139 + throw new DebugException ("Index " + indexName + " does not exist in the specified context.");
7.140 + }
7.141 + StorableClass.IndexDescriptor desc = sc.getAdditionalIndex (indexName);
7.142 + String valueToString = StorableObject.valuesToKey (map, desc.getFields());
7.143 SinglevaluedIndex objectsIndex = getObjectsIndexByMofId (context);
7.144 - String key = StorableObject.valuesToKey (values);
7.145 - return getAdditionalIndex (context, resolveAttrMofId(context, indexName)).getObjects (key, objectsIndex);
7.146 + return getAdditionalIndex (context, resolveAttrMofId(context, indexName)).getObjects (valueToString, objectsIndex);
7.147 } catch (StorageException e) {
7.148 return null;
7.149 }
7.150 @@ -1060,6 +1113,7 @@
7.151 }
7.152
7.153 storage.dropIndex(PREFIX_ATTR_INDEXES_BY_NAME + extent);
7.154 + storage.dropIndex(PREFIX_ATTR_INDEXES_CLASS_PROXY + extent);
7.155 contextsIndex.remove(name);
7.156
7.157 bootObjects = null;
8.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableAssociation.java Tue Jul 02 23:44:22 2002 +0000
8.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableAssociation.java Wed Jul 03 18:33:17 2002 +0000
8.3 @@ -284,17 +284,30 @@
8.4 Class type = isEndA ? typeA : typeB;
8.5 int min = isEndA ? minA : minB;
8.6 int max = isEndA ? maxA : maxB;
8.7 - String endId = isEndA ? endBId : endAId;
8.8 + String endId, otherEndId;
8.9 + boolean isIndexed, isOtherIndexed;
8.10 + if (isEndA) {
8.11 + endId = endAId;
8.12 + otherEndId = endBId;
8.13 + isIndexed = indexedA;
8.14 + isOtherIndexed = indexedB;
8.15 + } else {
8.16 + endId = endBId;
8.17 + otherEndId = endAId;
8.18 + isIndexed = indexedB;
8.19 + isOtherIndexed = indexedA;
8.20 + }
8.21 boolean aggr = isEndA ? aggrA : aggrB;
8.22 boolean otherAggr = isEndA ? aggrB : aggrA;
8.23 +
8.24 Object result;
8.25 if (obj == null) throw new NullPointerException();
8.26
8.27 if (multi) {
8.28 if (order) {
8.29 - result = new AssocEndIndexUList(this, endId, (MultivaluedOrderedIndex) index, obj, secondIndex, type, max, true, aggr, otherAggr);
8.30 + result = new AssocEndIndexUList(this, endId, otherEndId, (MultivaluedOrderedIndex) index, obj, secondIndex, type, max, true, aggr, otherAggr, isIndexed, isOtherIndexed);
8.31 } else {
8.32 - result = new AssocEndIndexSet(this, endId, (MultivaluedIndex) index, obj, secondIndex, type, max, true, aggr, otherAggr);
8.33 + result = new AssocEndIndexSet(this, endId, otherEndId, (MultivaluedIndex) index, obj, secondIndex, type, max, true, aggr, otherAggr, isIndexed, isOtherIndexed);
8.34 }
8.35 } else {
8.36 result = getMdrStorage().getObjectFromIndexIfExists((SinglevaluedIndex) index, obj);
8.37 @@ -353,10 +366,10 @@
8.38 oA = (StorableObject) getMdrStorage().getObject(a);
8.39 oB = (StorableObject) getMdrStorage().getObject(b);
8.40 if (indexedA) {
8.41 - oB.removeFromIndex (getMofId(), endAId);
8.42 + oB.removeFromIndex (endAId);
8.43 }
8.44 if (indexedB) {
8.45 - oA.removeFromIndex (getMofId(), endBId);
8.46 + oA.removeFromIndex (endBId);
8.47 }
8.48 // set composites
8.49 if (aggrA) {
8.50 @@ -367,12 +380,10 @@
8.51 aIndex.add(b, a);
8.52 bIndex.add(a, b);
8.53 if (indexedA) {
8.54 - // oB = (StorableObject) getMdrStorage().getObject(b);
8.55 - oB.addToIndex (getMofId(), endAId);
8.56 + oB.addToIndex (endAId);
8.57 }
8.58 if (indexedB) {
8.59 - // oA = (StorableObject) getMdrStorage().getObject(a);
8.60 - oA.addToIndex (getMofId(), endBId);
8.61 + oA.addToIndex (endBId);
8.62 }
8.63
8.64 return true;
8.65 @@ -394,10 +405,10 @@
8.66 oA = (StorableObject) getMdrStorage().getObject(a);
8.67 oB = (StorableObject) getMdrStorage().getObject(b);
8.68 if (indexedA) {
8.69 - oB.removeFromIndex (getMofId(), endAId);
8.70 + oB.removeFromIndex (endAId);
8.71 }
8.72 if (indexedB) {
8.73 - oA.removeFromIndex (getMofId(), endBId);
8.74 + oA.removeFromIndex (endBId);
8.75 }
8.76 // remove composites
8.77 if (aggrA) {
8.78 @@ -408,12 +419,10 @@
8.79 removeLinkEnd(b, a, aIndex, multiValuedA);
8.80 removeLinkEnd(a, b, bIndex, multiValuedB);
8.81 if (indexedA) {
8.82 - // oB = (StorableObject) getMdrStorage().getObject(b);
8.83 - oB.addToIndex (getMofId(), endAId);
8.84 + oB.addToIndex (endAId);
8.85 }
8.86 if (indexedB) {
8.87 - // oA = (StorableObject) getMdrStorage().getObject(a);
8.88 - oA.addToIndex (getMofId(), endBId);
8.89 + oA.addToIndex (endBId);
8.90 }
8.91 return true;
8.92 } catch (StorageBadRequestException e) {
9.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Tue Jul 02 23:44:22 2002 +0000
9.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Wed Jul 03 18:33:17 2002 +0000
9.3 @@ -76,7 +76,12 @@
9.4 * Maps attribute's ant assoc. end's ids to list of related additional indexes.
9.5 */
9.6 private HashMap indexMap;
9.7 -
9.8 +
9.9 + /**
9.10 + * Map of all additional indexes by name.
9.11 + */
9.12 + private HashMap indexesByName;
9.13 +
9.14 // mutexes
9.15 private final Object attrMutex = new Object();
9.16 private final Object superclassMutex = new Object();
9.17 @@ -156,30 +161,29 @@
9.18 throw new DebugException ("Cannot create unnamed additional index.");
9.19 }
9.20 String indexName = (String) values.get (0);
9.21 - List elements = new ArrayList (tag.getElements ());
9.22 - Collections.sort (elements, IndexFieldsComparator.getDefault ());
9.23 - int size = elements.size ();
9.24 + List elements = new ArrayList (tag.getElements ());
9.25 + int size = elements.size () - 1;
9.26 Iterator elementsIter = elements.iterator ();
9.27 IndexDescriptor.Field [] fields = new IndexDescriptor.Field [size];
9.28
9.29 - for (x = 0; x < size; x++) {
9.30 + x = 0;
9.31 + while (elementsIter.hasNext()) {
9.32 ModelElement elem = (ModelElement) elementsIter.next ();
9.33 -
9.34 - if (elem instanceof Attribute) {
9.35 -
9.36 - fields[x] = new IndexDescriptor.Attrib (elem.refMofId (), elem.getName ());
9.37 + if (elem.refMofId().equals (getMetaObjectId()))
9.38 + continue;
9.39 + if (elem instanceof Attribute) {
9.40 + fields[x] = new IndexDescriptor.Attrib (elem.refMofId (), elem.getName (), ((Attribute)elem).getMultiplicity().isOrdered());
9.41 } else if (elem instanceof AssociationEnd) {
9.42 String assocId = (String) associationProxies.get (elem.getContainer ().refMofId());
9.43 - fields [x] = new IndexDescriptor.AssocEnd (assocId, elem.refMofId(), elem.getName());
9.44 + fields [x] = new IndexDescriptor.AssocEnd (elem.refMofId(), elem.getName(), ((AssociationEnd)elem).getMultiplicity().isOrdered(), assocId);
9.45 } else {
9.46 - throw new DebugException ("Cannot create additional index " + indexName + ", element is not attribute or reference.");
9.47 + throw new DebugException ("Cannot create additional index " + indexName + ", element " + elem.getName() + " is not an attribute or an association end.");
9.48 }
9.49 + x++;
9.50 } // for
9.51 IndexDescriptor indexDesc = new IndexDescriptor (indexName, fields);
9.52 indexDescs [y] = indexDesc;
9.53 -// [???] why was it checking for outermost == null?
9.54 -// getMdrStorage().createAdditionalIndex((getOutermostPackageId() == null ? getImmediatePackageId() : getOutermostPackageId()), indexName);
9.55 - getMdrStorage().createAdditionalIndex(getOutermostPackageId(), indexName);
9.56 + getMdrStorage().createAdditionalIndex(getOutermostPackageId(), indexName, getMofId ());
9.57 } // for
9.58 objectChanged ();
9.59 }
9.60 @@ -189,9 +193,11 @@
9.61 */
9.62 private void buildIndexMap () throws StorageException {
9.63 indexMap = new HashMap();
9.64 + indexesByName = new HashMap();
9.65 Iterator iter = indexDescriptors.iterator();
9.66 while (iter.hasNext()) {
9.67 IndexDescriptor desc = (IndexDescriptor) iter.next();
9.68 + indexesByName.put (desc.getName(), desc);
9.69 Object [] fields = desc.getFields();
9.70 for (int x = 0; x < fields.length; x++) {
9.71 String id;
9.72 @@ -206,13 +212,17 @@
9.73 indexMap.put(id, list = new LinkedList());
9.74 list.add(desc);
9.75 } // for
9.76 - } // while
9.77 + } // while
9.78 }
9.79
9.80 - public List getIndexes(String mofId) throws StorageException {
9.81 + List getIndexes(String mofId) throws StorageException {
9.82 checkAttributes();
9.83 return (List) indexMap.get(mofId);
9.84 }
9.85 +
9.86 + public IndexDescriptor getAdditionalIndex(String indexName) {
9.87 + return (IndexDescriptor) indexesByName.get (indexName);
9.88 + }
9.89
9.90 public DatatypeDescriptor getDatatypeDesc(String name) {
9.91 return (DatatypeDescriptor) datatypes.get(name);
9.92 @@ -859,18 +869,13 @@
9.93 IOUtils.writeString(stream, indexName);
9.94 IOUtils.writeInt(stream, fields.length);
9.95 for (int i = 0; i < fields.length; i++) {
9.96 + // Since reading of field id is not part of Field.read() method, we exclude it from write method too.
9.97 if (fields[i] instanceof Attrib) {
9.98 - IOUtils.writeInt(stream, ATTRIB_ID);
9.99 - Attrib attr = (Attrib) fields[i];
9.100 - IOUtils.writeString(stream, attr.id);
9.101 - IOUtils.writeString(stream, attr.name);
9.102 + IOUtils.writeInt(stream, ATTRIB_ID);
9.103 } else {
9.104 - IOUtils.writeInt(stream, ASSOC_END_ID);
9.105 - AssocEnd end = (AssocEnd) fields[i];
9.106 - IOUtils.writeString(stream, end.assocId);
9.107 - IOUtils.writeString(stream, end.endId);
9.108 - IOUtils.writeString(stream, end.endName);
9.109 + IOUtils.writeInt(stream, ASSOC_END_ID);
9.110 }
9.111 + fields[i].write (stream);
9.112 } // for
9.113 }
9.114
9.115 @@ -882,106 +887,88 @@
9.116 for (int i = 0; i < fieldsCount; i++) {
9.117 int id = IOUtils.readInt(stream);
9.118 switch (id) {
9.119 - case ATTRIB_ID:
9.120 - mofId = IOUtils.readString(stream);
9.121 - name = IOUtils.readString(stream);
9.122 - fields[i] = new Attrib(mofId, name);
9.123 + case ATTRIB_ID:
9.124 + fields[i] = new Attrib(null, null, false);
9.125 break;
9.126 case ASSOC_END_ID:
9.127 - assocId = IOUtils.readString(stream);
9.128 - mofId = IOUtils.readString(stream);
9.129 - name = IOUtils.readString(stream);
9.130 - fields[i] = new AssocEnd(assocId, mofId, name);
9.131 + fields[i] = new AssocEnd(null, null, false, null);
9.132 } // switch
9.133 + fields[i].read (stream);
9.134 } // for
9.135 return new IndexDescriptor (indexName, fields);
9.136 }
9.137
9.138 public static abstract class Field {
9.139 - public abstract String getId ();
9.140 - }
9.141 -
9.142 - public static final class Attrib extends Field {
9.143 - private String id;
9.144 - private String name;
9.145 -
9.146 - public Attrib (String id, String name) {
9.147 + protected String id;
9.148 + protected String name;
9.149 + protected boolean isOrdered;
9.150 +
9.151 + public Field (String id, String name, boolean ordered) {
9.152 this.id = id;
9.153 this.name = name;
9.154 + this.isOrdered = ordered;
9.155 }
9.156 -
9.157 +
9.158 public String getId () {
9.159 return id;
9.160 }
9.161 -
9.162 public String getName () {
9.163 return name;
9.164 }
9.165 + public boolean isOrdered () {
9.166 + return isOrdered;
9.167 + }
9.168 +
9.169 + public void write (java.io.OutputStream stream) throws IOException {
9.170 + IOUtils.writeString(stream, id);
9.171 + IOUtils.writeString(stream, name);
9.172 + IOUtils.writeBoolean(stream, isOrdered);
9.173 + }
9.174 +
9.175 + public void read (java.io.InputStream stream) throws IOException {
9.176 + id = IOUtils.readString(stream);
9.177 + name = IOUtils.readString(stream);
9.178 + isOrdered = IOUtils.readBoolean(stream);
9.179 + }
9.180 + } // class Field
9.181 +
9.182 +
9.183 + public static final class Attrib extends Field {
9.184 +
9.185 + public Attrib (String id, String name, boolean ordered) {
9.186 + super (id, name, ordered);
9.187 + }
9.188 +
9.189 + // no additional features required at the moment ...
9.190 +
9.191 + } // class Attrib
9.192
9.193 - }
9.194 +
9.195 + public static final class AssocEnd extends Field {
9.196 +
9.197 + private String assocId;
9.198
9.199 - public static final class AssocEnd extends Field {
9.200 - private String assocId;
9.201 - private String endId;
9.202 - private String endName;
9.203 -
9.204 - public AssocEnd (String assocId, String endId, String endName) {
9.205 - this.assocId = assocId;
9.206 - this.endId = endId;
9.207 - this.endName = endName;
9.208 + public AssocEnd (String id, String name, boolean ordered, String assocId) {
9.209 + super (id, name, ordered);
9.210 + this.assocId = assocId;
9.211 }
9.212
9.213 public String getAssociation () {
9.214 return assocId;
9.215 }
9.216 -
9.217 - public String getId () {
9.218 - return endId;
9.219 +
9.220 + public void write (java.io.OutputStream stream) throws IOException {
9.221 + super.write (stream);
9.222 + IOUtils.writeString(stream, assocId);
9.223 }
9.224 -
9.225 - public String getEndName () {
9.226 - return endName;
9.227 +
9.228 + public void read (java.io.InputStream stream) throws IOException {
9.229 + super.read (stream);
9.230 + assocId = IOUtils.readString(stream);
9.231 }
9.232 -
9.233 - }
9.234 +
9.235 + } // class AssocEnd
9.236
9.237 } // IndexDescriptor
9.238 -
9.239 - private static final class IndexFieldsComparator implements Comparator {
9.240 -
9.241 - private static IndexFieldsComparator DEFAULT = null;
9.242 -
9.243 - public static IndexFieldsComparator getDefault () {
9.244 - if (DEFAULT == null)
9.245 - DEFAULT = new IndexFieldsComparator ();
9.246 - return DEFAULT;
9.247 - }
9.248 -
9.249 - private static String qualifiedName (ModelElement elem) {
9.250 - List list = elem.getQualifiedName ();
9.251 - Iterator iter = list.iterator ();
9.252 - String name = (String) iter.next ();
9.253 - while (iter.hasNext ())
9.254 - name = name + '.' + (String) iter.next ();
9.255 - return name;
9.256 - }
9.257 -
9.258 - public int compare (Object o1, Object o2) {
9.259 - if (o1 instanceof AssociationEnd) {
9.260 - if (o2 instanceof Attribute)
9.261 - return 1;
9.262 - } else {
9.263 - if (o2 instanceof AssociationEnd)
9.264 - return -1;
9.265 - }
9.266 - if (o1 == o2)
9.267 - return 0;
9.268 - int result = ((ModelElement) o1).getName().compareTo(((ModelElement) o2).getName());
9.269 - if (result == 0)
9.270 - result = qualifiedName((ModelElement) o1).compareTo(qualifiedName((ModelElement) o2));
9.271 - return result;
9.272 - }
9.273 -
9.274 - }
9.275
9.276 }
10.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableObject.java Tue Jul 02 23:44:22 2002 +0000
10.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableObject.java Wed Jul 03 18:33:17 2002 +0000
10.3 @@ -37,6 +37,7 @@
10.4 protected Object values[];
10.5
10.6 static final String INDEX_KEY_DELIMITER = "@";
10.7 + static final String INDEX_KEY_DELIMITER_2 = "#";
10.8 static final String NULL_VALUE_SUBSTITUTE = "NULL";
10.9
10.10 private String classProxyId;
10.11 @@ -72,10 +73,13 @@
10.12 for (int i = 0; i < params.length; i++) {
10.13 StorableClass.AttributeDescriptor desc = getClassProxy().getAttrDesc(i);
10.14 values[i] = getInitialValue(desc, params[i]);
10.15 - modifyIndex(i, null, this.values[i]);
10.16 + // modifyIndex(i, null, this.values[i]);
10.17 } // for
10.18 } // if
10.19 this.addInstance ();
10.20 + if (params != null) {
10.21 + modifyIndex (getClassProxy().getIndexDescriptors(), false);
10.22 + }
10.23 initFinished = true;
10.24 }
10.25
10.26 @@ -259,6 +263,7 @@
10.27 public void delete() throws StorageException {
10.28 deleteAttributes();
10.29 deleteLinksAndComponents();
10.30 + modifyIndex (getClassProxy().getIndexDescriptors(), true);
10.31 deleteRecursive();
10.32 }
10.33
10.34 @@ -446,8 +451,8 @@
10.35 }
10.36 }
10.37
10.38 - String oldValStr = objectToString(oldValue);
10.39 - String newValStr = objectToString(newValue);
10.40 + String oldValStr = objectToString(oldValue, fields[currPosition].isOrdered());
10.41 + String newValStr = objectToString(newValue, fields[currPosition].isOrdered());
10.42 String prefix = valuesToKey(fields, 0, currPosition - 1);
10.43 String suffix = valuesToKey(fields, currPosition + 1, fields.length - 1);
10.44
10.45 @@ -491,7 +496,7 @@
10.46 protected void deleteAttributes() throws StorageException {
10.47 String key;
10.48 for (int i = 0; i < values.length; i++) {
10.49 - modifyIndex(i, values[i], null);
10.50 + //modifyIndex(i, values[i], null);
10.51 if (values[i] instanceof RefObject)
10.52 ((RefObject)values[i]).refDelete();
10.53 else if (values[i] instanceof Collection) {
10.54 @@ -506,23 +511,33 @@
10.55 }
10.56 }
10.57
10.58 - void addToIndex (String proxyId, String endId) throws StorageException {
10.59 - modifyIndex (proxyId, endId, false);
10.60 + void addToIndex (String id) {
10.61 + try {
10.62 + StorableClass proxy = getClassProxy();
10.63 + modifyIndex (proxy.getIndexes(id), false);
10.64 + } catch (StorageException e) {
10.65 + e.printStackTrace ();
10.66 + throw new DebugException ();
10.67 + }
10.68 }
10.69
10.70 - void removeFromIndex (String proxyId, String endId) throws StorageException {
10.71 - modifyIndex (proxyId, endId, true);
10.72 + void removeFromIndex (String id) {
10.73 + try {
10.74 + StorableClass proxy = getClassProxy();
10.75 + modifyIndex (proxy.getIndexes(id), true);
10.76 + } catch (StorageException e) {
10.77 + e.printStackTrace ();
10.78 + throw new DebugException ();
10.79 + }
10.80 }
10.81
10.82 - private void modifyIndex(String proxyId, String endId, boolean remove) throws StorageException {
10.83 - StorableClass proxy = getClassProxy();
10.84 - List list = proxy.getIndexes(endId);
10.85 - if (list == null)
10.86 + private void modifyIndex(List descriptors, boolean remove) throws StorageException {
10.87 + if (descriptors == null)
10.88 return;
10.89 MultivaluedIndex attrIndex = null;
10.90 String outermostPackageId = getOutermostPackageId();
10.91 String mofId = getMofId();
10.92 - Iterator iter = list.iterator();
10.93 + Iterator iter = descriptors.iterator();
10.94 while (iter.hasNext()) {
10.95 StorableClass.IndexDescriptor desc = (StorableClass.IndexDescriptor) iter.next();
10.96 StorableClass.IndexDescriptor.Field [] fields = desc.getFields();
10.97 @@ -541,7 +556,7 @@
10.98 } // while
10.99 }
10.100
10.101 - private static String objectToString(Object o) {
10.102 + private static String objectToString(Object o, boolean isOrdered) {
10.103 if (o == null)
10.104 return NULL_VALUE_SUBSTITUTE;
10.105 if (o instanceof RefObject)
10.106 @@ -551,13 +566,21 @@
10.107 if (o instanceof Collection) {
10.108 StringBuffer buf = new StringBuffer();
10.109 Iterator iter = ((Collection) o).iterator();
10.110 + List list = new LinkedList ();
10.111 + while (iter.hasNext ()) {
10.112 + list.add (objectToString(iter.next(), true));
10.113 + }
10.114 + if (!isOrdered) {
10.115 + Collections.sort (list);
10.116 + }
10.117 + iter = list.iterator ();
10.118 if (iter.hasNext())
10.119 - buf.append(objectToString(iter.next()));
10.120 + buf.append(iter.next());
10.121 while (iter.hasNext()) {
10.122 buf.append(INDEX_KEY_DELIMITER);
10.123 - buf.append(objectToString(iter.next()));
10.124 + buf.append(iter.next());
10.125 } // while
10.126 - return buf.toString();
10.127 + return buf.toString();
10.128 } // if
10.129 return o.toString();
10.130 }
10.131 @@ -568,21 +591,48 @@
10.132 String res;
10.133 if (fields[x] instanceof StorableClass.IndexDescriptor.Attrib) {
10.134 String name = ((StorableClass.IndexDescriptor.Attrib) fields[x]).getName();
10.135 - res = objectToString(values[getClassProxy().getAttrIndex(name)]);
10.136 + res = objectToString(values[getClassProxy().getAttrIndex(name)], fields[x].isOrdered());
10.137 + //System.out.println("valuesToKey, Attrib: " + res);
10.138 } else {
10.139 StorableClass.IndexDescriptor.AssocEnd endDesc = (StorableClass.IndexDescriptor.AssocEnd)fields[x];
10.140 StorableAssociation sa = (StorableAssociation) getMdrStorage().getObject(endDesc.getAssociation());
10.141 - res = objectToString(sa.queryObjects(endDesc.getEndName(), getMofId()));
10.142 + String otherEndName = sa.getEnd1Name ();
10.143 + if (otherEndName.equals (endDesc.getName()))
10.144 + otherEndName = sa.getEnd2Name ();
10.145 + res = objectToString(sa.queryObjects(otherEndName, getMofId()), fields[x].isOrdered());
10.146 + //System.out.println("valuesToKey, AssocEnd: " + res);
10.147 }
10.148 buf.append(res);
10.149 if (x < pos_2)
10.150 - buf.append(INDEX_KEY_DELIMITER);
10.151 + buf.append(INDEX_KEY_DELIMITER_2);
10.152 }
10.153 return buf.toString();
10.154 }
10.155
10.156 - public static String valuesToKey (List values) {
10.157 - return objectToString(values);
10.158 - }
10.159 + public static String valuesToKey (Map map, StorableClass.IndexDescriptor.Field [] fields) {
10.160 + StringBuffer buf = new StringBuffer ();
10.161 + if (map.size () != fields.length) {
10.162 + throw new DebugException ("Wrong query on additional index, incorrect number of passed parameters.");
10.163 + }
10.164 + for (int x = 0; x < fields.length; x++) {
10.165 + String name = fields[x].getName ();
10.166 + if (!map.containsKey (name)) {
10.167 + throw new DebugException ("Wrong query on additional index, value of field " + name + " not specified.");
10.168 + }
10.169 + Object value = map.get (name);
10.170 + String str = objectToString (value, fields[x].isOrdered());
10.171 + buf.append(str);
10.172 + if (x < fields.length - 1)
10.173 + buf.append(INDEX_KEY_DELIMITER_2);
10.174 + } // for
10.175 + return buf.toString ();
10.176 + }
10.177
10.178 -}
10.179 + public static String valueToKey (Object value, StorableClass.IndexDescriptor.Field [] fields) {
10.180 + if (fields.length != 1) {
10.181 + throw new DebugException ("Wrong query on additional index, more than one parameter expected.");
10.182 + }
10.183 + return objectToString (value, fields[0].isOrdered());
10.184 + }
10.185 +
10.186 +}
10.187 \ No newline at end of file
11.1 --- a/mdr/test/unit/src/org/netbeans/mdr/test/AdditionalIndexTest.java Tue Jul 02 23:44:22 2002 +0000
11.2 +++ b/mdr/test/unit/src/org/netbeans/mdr/test/AdditionalIndexTest.java Wed Jul 03 18:33:17 2002 +0000
11.3 @@ -41,7 +41,7 @@
11.4 public class AdditionalIndexTest extends MDRTestCase {
11.5
11.6 private static final int KEY_COUNT = 3;
11.7 - private static final int NUMBER_OF_INSTANCES = 500;
11.8 + private static final int MAX = 400;
11.9 private static final String INDEX_NAME = "Indexik";
11.10
11.11 public AdditionalIndexTest(String testName) {
11.12 @@ -65,7 +65,7 @@
11.13 return setup;
11.14 }
11.15
11.16 - public void test () {
11.17 + public void test_1 () {
11.18 Iterator iter;
11.19 int x, y, z;
11.20
11.21 @@ -94,7 +94,7 @@
11.22 WordClass proxy = pkg.getWord ();
11.23 Word2Class proxy2 = pkg.getWord2 ();
11.24 Random random = new Random (0);
11.25 - for (x = 0; x < NUMBER_OF_INSTANCES; x++) {
11.26 + for (x = 0; x < MAX; x++) {
11.27 boolean wordInstance = random.nextBoolean();
11.28 int [] index = new int [KEY_COUNT];
11.29 for (y = 0; y < KEY_COUNT; y++) {
11.30 @@ -118,11 +118,11 @@
11.31 for (x = 0; x < KEY_COUNT; x++) {
11.32 for (y = 0; y < KEY_COUNT; y++) {
11.33 for (z = 0; z < KEY_COUNT; z++) {
11.34 - List values = new LinkedList ();
11.35 - values.add (keys[0][x]);
11.36 - values.add (keys[1][y]);
11.37 - values.add (keys[2][z]);
11.38 - int size = storage.getObjectsFromAdditionalIndex(pkg.refMofId(), INDEX_NAME, values).size();
11.39 + Map map = new HashMap ();
11.40 + map.put ("color", keys[0][x]);
11.41 + map.put ("number", keys[1][y]);
11.42 + map.put ("sentence", keys[2][z]);
11.43 + int size = storage.queryAdditionalIndex(pkg.refMofId(), INDEX_NAME, map).size();
11.44 if (size != counts[x][y][z]) {
11.45 System.out.println("Wrong result, indexes: " + x + " " + y + " " + z);
11.46 fail();
11.47 @@ -133,5 +133,174 @@
11.48
11.49 }
11.50
11.51 -}
11.52 -
11.53 \ No newline at end of file
11.54 + public void test_2 () {
11.55 + ModelPackage modelPackage = loadMOFModel ("IndexedModel.xml", "Text");
11.56 + TextPackage pkg = (TextPackage) createExtent (findMofPackage (modelPackage, "Text"), "test");
11.57 +
11.58 + int x;
11.59 + int num = 'z' - 'a' + 1;
11.60 + Random random = new Random (0);
11.61 + int [] count = new int [num];
11.62 + Word [] word = new Word [MAX];
11.63 +
11.64 + for (x = 0; x < num; x++)
11.65 + count[x] = 0;
11.66 +
11.67 + WordClass proxy = pkg.getWord ();
11.68 + Word2Class proxy2 = pkg.getWord2 ();
11.69 + MdrStorage storage = ((BaseObjectHandler) proxy)._getDelegate().getMdrStorage ();
11.70 +
11.71 + for (x = 0; x < MAX; x++) {
11.72 + int n = random.nextInt (num);
11.73 + count[n]++;
11.74 + String s = "" + ((char) ('a' + n));
11.75 + if (random.nextBoolean())
11.76 + word [x] = proxy.createWord (s, 1, 2);
11.77 + else
11.78 + word [x] = proxy2.createWord2 (s, 1, 2, s);
11.79 + }
11.80 +
11.81 + for (x = 0; x < MAX * 4; x++) {
11.82 + int n = random.nextInt (num);
11.83 + int index = random.nextInt (MAX);
11.84 + int old = word[index].getColor().charAt (0) - 'a';
11.85 + count[old]--;
11.86 + word[index].setColor ("" + ((char) ('a' + n)));
11.87 + count[n]++;
11.88 + }
11.89 +
11.90 + for (x = 0; x < MAX / 3; x++) {
11.91 + int index = random.nextInt (MAX);
11.92 + if (word[index] != null) {
11.93 + int old = word[index].getColor().charAt (0) - 'a';
11.94 + count[old]--;
11.95 + word[index].refDelete();
11.96 + word[index] = null;
11.97 + }
11.98 + }
11.99 +
11.100 + for (x = 0; x < num; x++) {
11.101 + String s = "" + ((char) ('a' + x));
11.102 + int size = storage.getObjectsFromAdditionalIndex(pkg.refMofId(), "Indexik2", s).size();
11.103 + if (size != count[x]) {
11.104 + System.out.println("counts do not match: expected " + count[x] + ", found " + size);
11.105 + fail ();
11.106 + } // if
11.107 + } // for
11.108 +
11.109 + }
11.110 +
11.111 + public void test_3 () {
11.112 + ModelPackage modelPackage = loadMOFModel ("IndexedModel.xml", "Text");
11.113 + TextPackage pkg = (TextPackage) createExtent (findMofPackage (modelPackage, "Text"), "test");
11.114 +
11.115 + Sentence s1 = pkg.getSentence().createSentence();
11.116 + Sentence s2 = pkg.getSentence().createSentence();
11.117 +
11.118 + // generate instances
11.119 + WordClass proxy = pkg.getWord ();
11.120 + Word2Class proxy2 = pkg.getWord2 ();
11.121 +
11.122 + proxy.createWord ("a", 1, 2).setSentence (s1);
11.123 + proxy.createWord ("b", 1, 2);
11.124 + Word w = proxy.createWord ("c", 1, 2);
11.125 + w.setSentence (s2);
11.126 + w.setSentence (s1);
11.127 + w.setSentence (s2);
11.128 + proxy.createWord ("a", 1, 2).setSentence (s1);
11.129 + proxy.createWord ("b", 1, 2).refDelete ();
11.130 +
11.131 + MdrStorage storage = ((BaseObjectHandler) proxy)._getDelegate().getMdrStorage ();
11.132 + int size;
11.133 +
11.134 + size = storage.getObjectsFromAdditionalIndex(pkg.refMofId(), "Indexik3", s1).size();
11.135 + if (size != 2)
11.136 + fail ("found: " + size);
11.137 +
11.138 + size = storage.getObjectsFromAdditionalIndex(pkg.refMofId(), "Indexik3", s2).size();
11.139 + if (size != 1)
11.140 + fail ("found: " + size);
11.141 +
11.142 + size = storage.getObjectsFromAdditionalIndex(pkg.refMofId(), "Indexik3", null).size();
11.143 + if (size != 1)
11.144 + fail ("found: " + size);
11.145 + }
11.146 +
11.147 + public void test_4 () {
11.148 + ModelPackage modelPackage = loadMOFModel ("IndexedModel.xml", "Text");
11.149 + TextPackage pkg = (TextPackage) createExtent (findMofPackage (modelPackage, "Text"), "test");
11.150 +
11.151 + WordClass proxy = pkg.getWord ();
11.152 + Word3Class proxy3 = pkg.getWord3 ();
11.153 + MdrStorage storage = ((BaseObjectHandler) proxy)._getDelegate().getMdrStorage ();
11.154 +
11.155 + Integer i1 = new Integer (10);
11.156 + Integer i2 = new Integer (222);
11.157 + Integer i3 = new Integer (3000);
11.158 +
11.159 + Sentence s1 = pkg.getSentence().createSentence();
11.160 + Sentence s2 = pkg.getSentence().createSentence();
11.161 + Sentence s3 = pkg.getSentence().createSentence();
11.162 +
11.163 + Word v1 = proxy.createWord ("a", 1, 2);
11.164 + Word v2 = proxy.createWord ("a", 1, 3);
11.165 + Word v3 = proxy.createWord ("a", 1, 3);
11.166 +
11.167 + List list_1 = new LinkedList ();
11.168 + list_1.add ("a"); list_1.add ("b"); list_1.add ("c");
11.169 + List list_2 = new LinkedList ();
11.170 + list_2.add ("b"); list_2.add ("a"); list_2.add ("c");
11.171 + List list_3 = new LinkedList ();
11.172 + list_3.add ("b"); list_3.add ("c"); list_3.add ("a");
11.173 +
11.174 + Word3 w1, w2, w3, w4, w5;
11.175 + w1 = proxy3.createWord3 ("a", 0, 0, "a", list_1, list_2);
11.176 + w2 = proxy3.createWord3 ("a", 0, 0, "a", list_2, null);
11.177 + w3 = proxy3.createWord3 ("a", 0, 0, "a", list_2, null);
11.178 + w4 = proxy3.createWord3 ("b", 0, 0, "a", null, null);
11.179 + w5 = proxy3.createWord3 ();
11.180 +
11.181 + w5.setColor ("blue");
11.182 + Collection list = w5.getOrderedMulti ();
11.183 + System.out.println(list.getClass().getName());
11.184 + list.add ("a"); list.add ("b"); list.add ("c");
11.185 + list = w5.getUnorderedMulti ();
11.186 + list.add ("c"); list.add ("b"); list.add ("a");
11.187 +
11.188 + HashMap map = new HashMap ();
11.189 + map.put ("orderedMulti", list_1);
11.190 + map.put ("secondEnd", new LinkedList ());
11.191 + map.put ("unorderedMulti", list_3);
11.192 +
11.193 + int size = storage.queryAdditionalIndex(pkg.refMofId(), "Index", map).size();
11.194 + if (size != 2)
11.195 + fail ("found: " + size);
11.196 +
11.197 + list = w2.getRef ();
11.198 + list.add (v1); list.add (v2); list.add (v3);
11.199 + list = w3.getRef ();
11.200 + list.add (v2); list.add (v3); list.add (v1);
11.201 + list = w4.getRef ();
11.202 + list.add (v2); list.add (v3); list.add (v1);
11.203 + w4.refDelete ();
11.204 + ListIterator iter = w2.getOrderedMulti ().listIterator ();
11.205 + iter.next (); iter.remove (); iter.next (); iter.add ("d");
11.206 + iter = w3.getOrderedMulti ().listIterator ();
11.207 + iter.next (); iter.remove (); iter.next (); iter.add ("d");
11.208 +
11.209 + list_1.clear ();
11.210 + list_1.add ("a"); list_1.add ("d"); list_1.add ("c");
11.211 + list_2.clear ();
11.212 + list_2.add (v1); list_2.add (v2); list_2.add (v3);
11.213 +
11.214 + map.clear ();
11.215 + map.put ("orderedMulti", list_1);
11.216 + map.put ("secondEnd", list_2);
11.217 + map.put ("unorderedMulti", new LinkedList ());
11.218 +
11.219 + size = storage.queryAdditionalIndex(pkg.refMofId(), "Index", map).size();
11.220 + if (size != 2)
11.221 + fail ("found: " + size);
11.222 + }
11.223 +
11.224 +}
11.225 \ No newline at end of file
12.1 --- a/mdr/test/unit/src/org/netbeans/mdr/test/data/IndexedModel.xml Tue Jul 02 23:44:22 2002 +0000
12.2 +++ b/mdr/test/unit/src/org/netbeans/mdr/test/data/IndexedModel.xml Wed Jul 03 18:33:17 2002 +0000
12.3 @@ -11,6 +11,55 @@
12.4 isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis'>
12.5 <Model:Namespace.contents>
12.6
12.7 + <Model:Class xmi.id = 'Word3' name = 'Word3' annotation = '' isRoot = 'false'
12.8 + isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis' isSingleton = 'false'>
12.9 + <Model:Namespace.contents>
12.10 +
12.11 + <Model:Tag xmi.id = 'tag_Index' name = 'Index'
12.12 + annotation = '' tagId = 'org.netbeans.attributeIndex' values = 'Index'>
12.13 + <Model:Tag.elements>
12.14 + <Model:Attribute xmi.idref = 'atr_ordered_multi'/>
12.15 + <Model:Attribute xmi.idref = 'atr_unordered_multi'/>
12.16 + <Model:AssociationEnd xmi.idref = 'end_word'/>
12.17 + <Model:Class xmi.idref = 'Word3'/>
12.18 + </Model:Tag.elements>
12.19 + </Model:Tag>
12.20 +
12.21 + <Model:Attribute xmi.id="atr_ordered_multi"
12.22 + name="orderedMulti" annotation="color's annotation" scope="instance_level"
12.23 + visibility="public_vis" type="a8" isChangeable="true" isDerived="false">
12.24 + <Model:StructuralFeature.multiplicity>
12.25 + <Model:MultiplicityType lower="1" upper="-1" is_ordered="true" is_unique="false" />
12.26 + </Model:StructuralFeature.multiplicity>
12.27 + </Model:Attribute>
12.28 + <Model:Attribute xmi.id="atr_unordered_multi"
12.29 + name="unorderedMulti" annotation="color's annotation" scope="instance_level"
12.30 + visibility="public_vis" type="a8" isChangeable="true" isDerived="false">
12.31 + <Model:StructuralFeature.multiplicity>
12.32 + <Model:MultiplicityType lower="1" upper="-1" is_ordered="false" is_unique="false" />
12.33 + </Model:StructuralFeature.multiplicity>
12.34 + </Model:Attribute>
12.35 + <Model:Reference xmi.id = 'reference' name = 'ref' annotation = '' scope = 'instance_level'
12.36 + visibility = 'public_vis' isChangeable = 'true'>
12.37 + <Model:StructuralFeature.multiplicity>
12.38 + <XMI.field>0</XMI.field>
12.39 + <XMI.field>-1</XMI.field>
12.40 + <XMI.field>false</XMI.field>
12.41 + <XMI.field>false</XMI.field>
12.42 + </Model:StructuralFeature.multiplicity>
12.43 + <Model:TypedElement.type>
12.44 + <Model:Class xmi.idref = 'a2'/>
12.45 + </Model:TypedElement.type>
12.46 + <Model:Reference.referencedEnd>
12.47 + <Model:AssociationEnd xmi.idref = 'end_word'/>
12.48 + </Model:Reference.referencedEnd>
12.49 + </Model:Reference>
12.50 + </Model:Namespace.contents>
12.51 + <Model:GeneralizableElement.supertypes>
12.52 + <Model:Class xmi.idref = 'Word2'/>
12.53 + </Model:GeneralizableElement.supertypes>
12.54 + </Model:Class>
12.55 +
12.56 <Model:Class xmi.id = 'Word2' name = 'Word2' annotation = '' isRoot = 'false'
12.57 isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis' isSingleton = 'false'>
12.58 <Model:Namespace.contents>
12.59 @@ -20,7 +69,7 @@
12.60 <Model:StructuralFeature.multiplicity>
12.61 <Model:MultiplicityType lower="1" upper="1" is_ordered="false" is_unique="false" />
12.62 </Model:StructuralFeature.multiplicity>
12.63 - </Model:Attribute>
12.64 + </Model:Attribute>
12.65 </Model:Namespace.contents>
12.66 <Model:GeneralizableElement.supertypes>
12.67 <Model:Class xmi.idref = 'a2'/>
12.68 @@ -30,14 +79,31 @@
12.69 <Model:Class xmi.id = 'a2' name = 'Word' annotation = '' isRoot = 'false'
12.70 isLeaf = 'false' isAbstract = 'false' visibility = 'public_vis' isSingleton = 'false'>
12.71 <Model:Namespace.contents>
12.72 +
12.73 <Model:Tag xmi.id = 'tag' name = 'Indexik'
12.74 annotation = '' tagId = 'org.netbeans.attributeIndex' values = 'Indexik'>
12.75 <Model:Tag.elements>
12.76 <Model:Attribute xmi.idref = 'aa2'/>
12.77 <Model:Attribute xmi.idref = 'aa3'/>
12.78 <Model:AssociationEnd xmi.idref = 'a5'/>
12.79 + <Model:Class xmi.idref = 'a2'/>
12.80 </Model:Tag.elements>
12.81 </Model:Tag>
12.82 + <Model:Tag xmi.id = 'tag2' name = 'Indexik2'
12.83 + annotation = '' tagId = 'org.netbeans.attributeIndex' values = 'Indexik2'>
12.84 + <Model:Tag.elements>
12.85 + <Model:Attribute xmi.idref = 'aa2'/>
12.86 + <Model:Class xmi.idref = 'a2'/>
12.87 + </Model:Tag.elements>
12.88 + </Model:Tag>
12.89 + <Model:Tag xmi.id = 'tag3' name = 'Indexik3'
12.90 + annotation = '' tagId = 'org.netbeans.attributeIndex' values = 'Indexik3'>
12.91 + <Model:Tag.elements>
12.92 + <Model:Class xmi.idref = 'a2'/>
12.93 + <Model:AssociationEnd xmi.idref = 'a5'/>
12.94 + </Model:Tag.elements>
12.95 + </Model:Tag>
12.96 +
12.97 <Model:Attribute xmi.id="aa2"
12.98 name="color" annotation="color's annotation" scope="instance_level"
12.99 visibility="public_vis" type="a8" isChangeable="true" isDerived="false">
12.100 @@ -129,6 +195,37 @@
12.101 </Model:Namespace.contents>
12.102 </Model:Association>
12.103
12.104 + <Model:Association xmi.id = 'assoc_word3_word' name = 'Word3Word' annotation = ''
12.105 + isRoot = 'true' isLeaf = 'true' isAbstract = 'false' visibility = 'public_vis'
12.106 + isDerived = 'false'>
12.107 + <Model:Namespace.contents>
12.108 + <Model:AssociationEnd xmi.id = 'end_word3' name = 'firstEnd' annotation = '' isNavigable = 'true'
12.109 + aggregation = 'none' isChangeable = 'true'>
12.110 + <Model:AssociationEnd.multiplicity>
12.111 + <XMI.field>0</XMI.field>
12.112 + <XMI.field>-1</XMI.field>
12.113 + <XMI.field>false</XMI.field>
12.114 + <XMI.field>false</XMI.field>
12.115 + </Model:AssociationEnd.multiplicity>
12.116 + <Model:TypedElement.type>
12.117 + <Model:Class xmi.idref = 'Word3'/>
12.118 + </Model:TypedElement.type>
12.119 + </Model:AssociationEnd>
12.120 + <Model:AssociationEnd xmi.id = 'end_word' name = 'secondEnd' annotation = '' isNavigable = 'true'
12.121 + aggregation = 'none' isChangeable = 'true'>
12.122 + <Model:AssociationEnd.multiplicity>
12.123 + <XMI.field>0</XMI.field>
12.124 + <XMI.field>-1</XMI.field>
12.125 + <XMI.field>false</XMI.field>
12.126 + <XMI.field>false</XMI.field>
12.127 + </Model:AssociationEnd.multiplicity>
12.128 + <Model:TypedElement.type>
12.129 + <Model:Class xmi.idref = 'a2'/>
12.130 + </Model:TypedElement.type>
12.131 + </Model:AssociationEnd>
12.132 + </Model:Namespace.contents>
12.133 + </Model:Association>
12.134 +
12.135 <Model:Import xmi.id = 'a19' name = 'PrimitiveTypes' annotation = '' visibility = 'public_vis'
12.136 isClustered = 'false'>
12.137 <Model:Import.importedNamespace>