KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > emn > info > eaop > aspect > Root


1 /* ----------------------------------------------------------------------------
2  * EAOP 1.0, 2002-12-19
3  * (c) 2002 Remi Douence, Mario Sudholt; OBASCO group; EMN/INRIA; France
4  * THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY
5   -------------------------------------------------------------------------- */

6
7 package fr.emn.info.eaop.aspect;
8
9 import fr.emn.info.eaop.Monitor;
10
11 import java.util.*;
12 import java.lang.reflect.*;
13 import java.io.*;
14
15 /**
16  * This class implements an indirection in the tree of aspects. It is
17  * required by <code>insert()</code>.
18  *
19  * @author RD
20  * @version 1.0
21  */

22
23 public class Root extends AspectS {
24
25     public AspectS a;
26
27     public Root(AspectS a) {
28     this(a, null);
29     }
30
31     public Root(AspectS a, AspectS up) {
32     super(up);
33     this.a = a;
34     this.a.up = this;
35     }
36
37     /**
38      * Visit the tree of aspects. Propagate isCrosscutting.
39      */

40     public void go() {
41     Monitor.monitor.path.push(this);
42     this.a.go();
43     this.isCrosscutting = this.a.isCrosscutting;
44     Monitor.monitor.path.pop();
45     }
46
47     /**
48      * default insertion of an aspect in the tree: current node and
49      * any order
50      */

51     public void insert(AspectS child, AspectS newAspect) {
52     this.a = new Any(child, newAspect);
53     this.a.up = this;
54     }
55 }
56
Popular Tags