Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cme-dev] Visiting Concerns

Hi Peri,

> you're looking for something called the unloader infrastructure,

aha!

> which--you guessed it--hasn't been implemented yet :-)

ah well...

> Thanks for your message--you're the first person to turn up the need for
> it outside of our group, so I appreciate the extra motivation to get
> this capability in.  We'll keep you posted on it.

Do keep me posted. In an earlier mail I described a bit about our project and our motivations. If it would help I could tell you more and act as something of a "customer". In any event, I look forward to learning more about CME and will be in touch with further questions!


Thanks,

phil


Peri Tarr wrote:

Hi Philip,

Yes, you're looking for something called the unloader infrastructure, which--you guessed it--hasn't been implemented yet :-). I've been contemplating it as a project over Christmas, though no promises there (catching up on sleep is also sounding kind of appealing as a project :-)).

In the meantime, you're stuck with a structure fairly similar to what you have. Do note, however, that you can do the instanceof tests on the interfaces, rather than the implementation classes, which at least makes this less horrible.

Thanks for your message--you're the first person to turn up the need for it outside of our group, so I appreciate the extra motivation to get this capability in. We'll keep you posted on it.

     Peri


*Philip Quitslund <pq@xxxxxxxxxx>*
Sent by: cme-dev-admin@xxxxxxxxxxx

12/13/2004 05:48 PM
Please respond to
cme-dev


	
To
	cme-dev@xxxxxxxxxxx
cc
	
Subject
	[cme-dev] Visiting Concerns


	





Hi all.

Forgive me if this is obvious (and it probably is!) but I'm puzzling over how to best traverse the structure of Concerns. What I'm driving at is a way to take a Concern and build my own abstract representation. I was expecting some kind
of visitor scheme but haven't found anything...

As a simple example, suppose I wanted to collect all the AdviceArtifacts in a
Concern.  I'd like to avoid code that looks like this:

                /* final */ Collection adviceCollector = new ArrayList();

                ConcernModelElement cme =
/* ProxyConcernModelElement */ pcme.getConcernModelElement();
                if (cme instanceof ConcernImpl) {
                                 ConcernImpl concern = (ConcernImpl)cme;
QueryableRead elems = concern.getElements(); for (Iterator iter = elems.iterator(); iter.hasNext();) {
                                                  Object o = iter.next();
if (o instanceof AdviceUnit) { adviceCollector.add(((AdviceArtifact)o). getAdviceArtifacts());
                                                  }
                                                  ...
                                 }
                                 ...
                }

preferring something more like this:

cme.accept(new ConcernVisitor() {
                                 void visit(AdviceUnit advice) {
adviceCollector.add(advice.getAdviceArtifact());
                                 };
                );

(Admittedly this is an overly simple example, but you get the idea.)

What's the best way to programmatically explore the structure of Concerns?

Any help would be greatly appreciated.  Thanks!



-phil





_______________________________________________
cme-dev mailing list
cme-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cme-dev



Back to the top