Doug Orleans has implemented edge visitors and other nice features. The new version has been installed and is available through j-gen-make and make. More information on edge visitors is in: http://www.ccs.neu.edu/research/demeter/course/f96/APbookWithDemJava.html search for "Edge visitors". A simple example of an edge visitor: before -> *,*,* (@ System.out.println(" going through edge from " + source.getClass().getName() + " to " + dest.getClass().getName() + " labeled " + edge); @) Edge visitors are a very important improvement to adaptive programming with Demeter/Java. -- Karl Lieberherr =================== Date: Tue, 4 Feb 1997 13:12:53 -0500 (EST) From: Doug Orleans To: lieber@ccs.neu.edu cc: ghulten@ccs.neu.edu, lth@ccs.neu.edu, johan@ccs.neu.edu, kedar@ccs.neu.edu, binoy@ccs.neu.edu, dougo@ccs.neu.edu Subject: new version of demjava I have uploaded the newest version of demjava into /proj/demsys/demjava/src-0.4.1 and classes/demeter-0.4.1. There are four changes (I think): + Edge wrappers! You should now be able to attach a before or after method to an edge glob, e.g. before -> *,foo,* (@ /* ... */ @) will be called whenever a construction edge named "foo" is about to be traversed. You can also attach to alternation and inheritance edges. Inside such a method, the variables "source" and "dest" will contain the source and dest objects of the edge (similar to "host" in class-attached methods); also, in the case of construction edges, the variable "edge", of type String, will contain the name of the edge being traversed. (Look at the generated source code if you're confused as to what's going on.) You can also attach before and after methods to a set of classes and/or edges with the { , } construction. + Behavior can be attached to multiple classes at once, e.g. { Foo, Bar } { traversal allBaz() { to Baz; } } will generate two traversals, one attached to Foo and one attached to Bar. This applies to before and after methods as well as verbatim methods. + Class defs are now kept in a hash table, which speeds up the program quite a bit (especially for large input files). There are no other external effects of this change. + The generated grammar file sets the option JAVA_UNICODE_ESCAPE, which causes Jack to generate a lexer that can recognize Unicode escapes (e.g. \u0123). This is a very minor change, but it means that you'll have to change your Makefile to replace ASCII_CharStream.java with ASCII_UCodeESC_CharStream.java. The new Makefile.template (which is copied by j-gen-make) will do the right thing. I'm reasonably confident that the new version is fully backward-compatible with 0.4 (except for the ASCII_UCodeESC_CharStream thing)-- mainly because it compiles itself. However, Karl, please test it out before switching the symbolic links. Also, edge wrappers have not been tested very thoroughly, so please try them out and let me know how it works. This is only a first cut at a design, so if you have a better idea as to how they should work, please let me know. --Doug