Hi Josh: Sorry to hear you are sick. My entire family was (I was lucky and had only a mild reaction). I don't come in today. Work to be done: (please take Doug's note into account at end of message) Implement: static Object longGet(Object o, TraversalGraph t); (using reflection) You have to do also Atusa's work, i.e. reusing: http://www.ccs.neu.edu/home/telliott/proposal.html Coordinate with Doug how to best use the AP Library. I hope longGet will work on simple examples when I am back. -- Karl ====================== Hi Atusa: Here is a more detailed description of the first phase of your project. First phase is at very end. Josh will help you as described below. A prerequisite of the project is to have read (for Josh in detail algorithm 2): http://www.ccs.neu.edu/research/demeter/biblio/strategies.html For Demeter/J (Java with traversal support) we will use a general solution using the AP library. In Demeter/J we have Strategy-objects, TraversalGraph-objects and static methods long_get, long_collect and traverse of class Traversal. The current class dictionary is kept in a static variable. The methods long_get, long_collect and traverse take either a Strategy-object or a TraversalGraph-object as input. TraversalGraph-objects are useful to have around to deal with evolution of the class graph. To do the run-time traversals Demeter/J uses reflection. http://java.sun.com/docs/books/tutorial/reflect/object/invoke.html From the TraversalGraph-object we know which parts to traverse. We assume that a traversable part x has a public get_x(). Using reflection, we retrieve the right Method-object and invoke it using invoke. -- Karl Summary of classes for package TraversalSupport: class Traversal static Object longGet(Object o, Strategy s); static Object longGet(Object o, TraversalGraph t); static Iteration longCollect(Object o, Strategy s); static Iteration longCollect(Object o, TraversalGraph t); static Object traverse(Object o, Strategy s, Visitor v[]); static Object traverse(Object o, TraversalGraph t, Visitor v[]); static Method getAccessor(ClassName cn, PartName pn); //Josh // returns method object for accessor method of class // cn and part pn class ClassGraph ClassGraph(File f[]); class PartName See: http://www.ccs.neu.edu/home/telliott/proposal.html class Strategy class StrategyEdge class StrategyEdge_List class Source class Target etc. ======== cd Strategy = List(StrategyEdge) [Source] [Target]. StrategyEdge = Source Target [Bypass]. Bypass = ClassName. Source = ClassName. Target = ClassName. ClassName = Ident. LabelName = Ident. class TraversalGraph TraversalGraph(ClassGraph cd, Strategy s); void traverse (Object o, Visitor v[]); //Josh TraversalGraph Intersection(traversalGraph t1, TraversalGraph t2); class Visitor // superclass of all visitors, generated Visitor() void start(); void finish(); void before(X host); void before_p(P source, Q dest); void after(X host); void after_p(P source, Q dest); class SampleVisitor extends Visitor Object get_return_val(); Phase 1: ======== class Traversal static Object longGet(Object o, Strategy s); static Method getAccessor(ClassName cn, PartName pn); //Josh // returns method object for accessor method of class // cn and part pn class ClassGraph ClassGraph(File f[]); See: http://www.ccs.neu.edu/home/telliott/proposal.html class Strategy class StrategyEdge class StrategyEdge_List class Source class Target etc. ======== cd Strategy = List(StrategyEdge). StrategyEdge = Source Target. Source = ClassName. Target = ClassName. ClassName = Ident. ======== class TraversalGraph TraversalGraph(ClassGraph cd, Strategy s); void traverse (Object o, Visitor v[]); //Josh class Visitor // superclass of all visitors, generated Visitor() void before(X host); =========================================== Collaboration between Josh and Atusa: Josh provides the traversal graph code using the AP Library. Atusa does not use the AP library directly, only through the methods Josh provides (getAccessor,traverse,etc.). Atusa does the construction of cd from Java code. Josh and Attusa need to agree on the class dictionary for class dictionaries. ============== Hi Doug: thank you for your feedback. I agree with you. Josh: please can you update the interfaces/design document based on Doug's feedback and send it to us. >From dougo@ccs.neu.edu Thu Jan 14 17:07:06 1999 >From: Doug Orleans >Date: Thu, 14 Jan 1999 17:07:03 -0500 (EST) >To: Karl Lieberherr >Cc: atoosa@ccs.neu.edu, jayantha@ccs.neu.edu, johan@ccs.neu.edu >Subject: Re: your project > >Karl Lieberherr writes: > > The methods long_get, long_collect and traverse take either a > > Strategy-object or a TraversalGraph-object as input. > >Maybe TraversalGraph could be a concrete subclass of the abstract >class Strategy? In some sense, it is a strategy, just a very detailed >one. (Other subclasses of Strategy would be PathDirective and >StrategyGraph.) That is a very good idea. > > > We assume that a traversable part x has a public get_x(). > >Maybe we should use the Bean convention and call this getX()? I agree. > > > static Object longGet(Object o, Strategy s); > > static Iteration longCollect(Object o, Strategy s); > >I'm not really happy with these "long" names. How about something >like "retrieve" and "retrieveAll"? Or "find/All"? (As long as we >don't conflict with the Java 2 collection hierarchy methods.) I like find/All but is it already used? long* has the advantage that a conflict is less likely. > > > static Method getAccessor(ClassName cn, PartName pn); //Josh > > // returns method object for accessor method of class > > // cn and part pn > >These arguments should probably just be Strings, if this is something >the Java programmer will be expected to call. You are right. Use primitive types in DI interface: A personality recomendation. > > > class ClassGraph > > ClassGraph(File f[]); > >Is this an array of Java source files? That is what I had in mind. > >--Doug > -- Karl