| [news.eclipse.tools.emf] Re: TraversalStrategy's double visits |
|
John, Comments below. John J. Franey wrote: Yes.On Thu, 17 Sep 2009 09:33:10 -0400, Christian W. Damus wrote: Yep.When a call to getChildren returns an iterator with stuff to iterate, ATI puts the iterator on the stack and subsequent calls to next will pull from that iterator. When that iterator is spent, it is popped from the stack and ATI will run a next on the earlier iterator. Do I have that right? Not sure what input you provided.So, with the input I provided, the first call to ATI.next ought to return a 'component' eobject. The direct contained children...On entrance to this first call, the only element on the 'data' stack is ITraversalStrategy$Recursive object. During this call, getChildren on the 'component' eobject returns a EContentsEList $FeatureIterator object and ATI pushes that on the 'data' stack. Later calls to ATI pulls from that new iterator and that returns four eObjects in this sequence: 'implementation', 'service', 'implementation', 'service'. Those should yield the direct contained children in order...I single step through hasNext and next methods of EContentsElist $FeatureIterator. I don't think it's possible for an object to be contained by more than one containment feature. But shouldn't all these other references be marked as derived given they are derived from the mixed feature map (I assume).Here is the iterator's value of eStructuralFeatures array whose length is 4: org.eclipse.emf.ecore.impl.EAttributeImpl@61328229 (name: mixed) (ordered: true, unique: false, lowerBound: 0, upperBound: -1) (changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (iD: false) org.eclipse.emf.ecore.impl.EReferenceImpl@26b056fd (name: implementation) (ordered: true, unique: true, lowerBound: 1, upperBound: 1) (changeable: true, volatile: true, transient: true, defaultValueLiteral: null, unsettable: false, derived: false) (containment: true, resolveProxies: false) org.eclipse.emf.ecore.impl.EReferenceImpl@2a8e32b7 (name: service) (ordered: true, unique: true, lowerBound: 0, upperBound: 1) (changeable: true, volatile: true, transient: true, defaultValueLiteral: null, unsettable: false, derived: false) (containment: true, resolveProxies: false) org.eclipse.emf.ecore.impl.EReferenceImpl@3aff8399 (name: reference) (ordered: true, unique: true, lowerBound: 0, upperBound: -1) (changeable: true, volatile: true, transient: true, defaultValueLiteral: null, unsettable: false, derived: false) (containment: true, resolveProxies: false) It looks like the iterator retrieves the first 'implementation' and 'service' eObjects as result of interpreting the first element in eStructuralFeatures. The second 'implementation' comes from interpreting the second element of eStructuralFeatures. The second 'service' comes from interpreting the third element of eStructuralFeatures. I can give details of this debugging session. Its painstaking. I hope I don't have to do it. I think they fact they aren't derived is a problem. How did this model arise?So the question: is the iterator being initialized incorrectly (incorrect content of eStructuralFeatures), or does it interpret eStructuralFeatures incorrectly?
|