aboutsummaryrefslogtreecommitdiffstats
path: root/docs/modules/ROOT
diff options
context:
space:
mode:
Diffstat (limited to 'docs/modules/ROOT')
-rw-r--r--docs/modules/ROOT/pages/LICENSE-AspectJ.adoc84
-rw-r--r--docs/modules/ROOT/pages/README-AspectJ.adoc149
-rw-r--r--docs/modules/ROOT/pages/developer/BUILD.md204
-rw-r--r--docs/modules/ROOT/pages/developer/IDE.md134
-rw-r--r--docs/modules/ROOT/pages/developer/RELEASE.md206
-rw-r--r--docs/modules/ROOT/pages/developer/SecretAPIs.txt52
-rw-r--r--docs/modules/ROOT/pages/developer/ajdt/ajdt.core.workitems.adoc248
-rw-r--r--docs/modules/ROOT/pages/developer/amcDesignNotes.adoc390
-rw-r--r--docs/modules/ROOT/pages/developer/asm.docbin0 -> 87040 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/compiler-weaver.adoc1192
-rw-r--r--docs/modules/ROOT/pages/developer/design-XReweavable.docbin0 -> 41472 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/design-overview.adoc30
-rw-r--r--docs/modules/ROOT/pages/developer/images/EclipseSoftwareSitesAJDT.pngbin0 -> 11627 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/advice-dec.pngbin0 -> 37908 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/ajdt-uml.pngbin0 -> 53803 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/ajdt-uml.vsdbin0 -> 264192 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/overview.pngbin0 -> 17691 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/overview.vsdbin0 -> 208896 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/pointcut-dec.pngbin0 -> 32986 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/images/top-tree.pngbin0 -> 33285 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/index.adoc26
-rw-r--r--docs/modules/ROOT/pages/developer/language.adoc81
-rw-r--r--docs/modules/ROOT/pages/developer/modules.adoc77
-rw-r--r--docs/modules/ROOT/pages/developer/ram-disk/maven.config1
-rw-r--r--docs/modules/ROOT/pages/developer/ram-disk/settings-ramdisk.xml68
-rw-r--r--docs/modules/ROOT/pages/developer/ram-disk/windows-recycle-bin-remove-immediately.pngbin0 -> 20141 bytes
-rw-r--r--docs/modules/ROOT/pages/developer/traces/ajc_batchBuild_annotated.htm2188
-rw-r--r--docs/modules/ROOT/pages/developer/traces/ajc_hello_annotated.htm951
-rw-r--r--docs/modules/ROOT/pages/examples/bean/BoundPoint.java90
-rw-r--r--docs/modules/ROOT/pages/examples/bean/Demo.java80
-rw-r--r--docs/modules/ROOT/pages/examples/bean/Point.java69
-rw-r--r--docs/modules/ROOT/pages/examples/bean/files.lst3
-rw-r--r--docs/modules/ROOT/pages/examples/build.xml458
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/Condition.java37
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/CoordinationAction.java37
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/Coordinator.java449
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/Exclusion.java33
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/MethodState.java45
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/Mutex.java86
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/Selfex.java55
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/TimeoutException.java27
-rw-r--r--docs/modules/ROOT/pages/examples/coordination/lib.lst8
-rw-r--r--docs/modules/ROOT/pages/examples/introduction/CloneablePoint.java42
-rw-r--r--docs/modules/ROOT/pages/examples/introduction/ComparablePoint.java46
-rw-r--r--docs/modules/ROOT/pages/examples/introduction/HashablePoint.java47
-rw-r--r--docs/modules/ROOT/pages/examples/introduction/Point.java98
-rw-r--r--docs/modules/ROOT/pages/examples/introduction/files.lst4
-rw-r--r--docs/modules/ROOT/pages/examples/ltw/HelloWorld.java16
-rw-r--r--docs/modules/ROOT/pages/examples/ltw/README42
-rw-r--r--docs/modules/ROOT/pages/examples/ltw/Tracing.aj23
-rw-r--r--docs/modules/ROOT/pages/examples/observer/Button.java40
-rw-r--r--docs/modules/ROOT/pages/examples/observer/ColorLabel.java34
-rw-r--r--docs/modules/ROOT/pages/examples/observer/Demo.java29
-rw-r--r--docs/modules/ROOT/pages/examples/observer/Display.java46
-rw-r--r--docs/modules/ROOT/pages/examples/observer/Observer.java18
-rw-r--r--docs/modules/ROOT/pages/examples/observer/Subject.java21
-rw-r--r--docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocol.java41
-rw-r--r--docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocolImpl.java31
-rw-r--r--docs/modules/ROOT/pages/examples/observer/files.lst8
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Bullet.java48
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Debug.java219
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Display.java165
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Display1.java201
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Display2.java136
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/EnergyPacket.java44
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/EnergyPacketProducer.java63
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/EnsureShipIsAlive.java35
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Game.java215
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/GameSynchronization.java54
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Makefile12
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Pilot.java44
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Player.java121
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/README.adoc56
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Registry.java126
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/RegistrySynchronization.java58
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Robot.java201
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/SWFrame.java92
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Ship.java296
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/SpaceObject.java106
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/Timer.java53
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/debug.lst2
-rw-r--r--docs/modules/ROOT/pages/examples/spacewar/demo.lst19
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/AbstractSimulation.java80
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/BasicSimulation.java34
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Billing.java73
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/BillingSimulation.java44
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Call.java97
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Connection.java87
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Customer.java112
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Local.java26
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/LongDistance.java26
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Timer.java50
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/TimerLog.java23
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/Timing.java57
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/TimingSimulation.java40
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/basic.lst7
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/billing.lst10
-rw-r--r--docs/modules/ROOT/pages/examples/telecom/timing.lst10
-rw-r--r--docs/modules/ROOT/pages/examples/tjp/Demo.java37
-rw-r--r--docs/modules/ROOT/pages/examples/tjp/GetInfo.java49
-rw-r--r--docs/modules/ROOT/pages/examples/tjp/files.lst2
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/Circle.java71
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/ExampleMain.java44
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/README32
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/Square.java71
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/TwoDShape.java69
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/lib/AbstractTrace.java185
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/lib/TraceMyClasses.java67
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/notrace.lst4
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/tracelib.lst6
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/tracev1.lst6
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/tracev2.lst6
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/tracev3.lst6
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version1/Trace.java77
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version1/TraceMyClasses.java69
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version2/Trace.java117
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version2/TraceMyClasses.java37
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version3/Trace.java123
-rw-r--r--docs/modules/ROOT/pages/examples/tracing/version3/TraceMyClasses.java46
-rw-r--r--docs/modules/ROOT/pages/index.adoc221
-rw-r--r--docs/modules/ROOT/pages/quickref/quick.docbin0 -> 55808 bytes
-rw-r--r--docs/modules/ROOT/pages/quickref/quick.pdfbin0 -> 47246 bytes
-rw-r--r--docs/modules/ROOT/pages/quickref/quick5.docbin0 -> 83968 bytes
-rw-r--r--docs/modules/ROOT/pages/quickref/quick5.pdfbin0 -> 56648 bytes
-rw-r--r--docs/modules/ROOT/pages/quickref/quick5A4.pdfbin0 -> 56400 bytes
-rw-r--r--docs/modules/ROOT/pages/quickref/quickA4.pdfbin0 -> 49611 bytes
-rw-r--r--docs/modules/ROOT/pages/readme-docs-module.adoc19
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/aopalliance.jarbin0 -> 4467 bytes
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/lib/aj-aopalliance.jarbin0 -> 6402 bytes
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/readme.txt21
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj72
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java32
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java54
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java50
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java33
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java19
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java19
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java39
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java24
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj28
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java21
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java20
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java27
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java16
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java53
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java18
-rw-r--r--docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java51
-rw-r--r--docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java67
-rw-r--r--docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapExtensionTest.java91
-rw-r--r--docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java81
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/caching/Caching.java0
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/caching/WatchSetters.java191
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/com/company/app/AppException.java11
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/com/company/app/Main.java40
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/com/company/lib/Factory.java14
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/company.lst2
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/declares/Declares.java142
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/language/Context.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/language/ControlFlow.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/language/DoubleDispatch.java81
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/language/Initialization.java133
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/libraries/PointcutLibraryTest.java95
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/org/aspectj/langlib/Pointcuts.java195
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/tracing/Logging.java28
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPoints.java132
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPointsBase.java53
-rw-r--r--docs/modules/ROOT/pages/sandbox/common/tracing/TraceMyJoinPoints.java17
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/buildRun.sh20
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/readme.internal.txt54
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/readme.txt36
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/BufferTest.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/Injection.java123
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/MainFailure.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/RunTime.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/RuntimeWrites.java145
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/StubReplace.java64
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/buildRun.sh20
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/CompileTime.java69
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RecordingInput.java44
-rw-r--r--docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RoundTrip.java77
-rw-r--r--docs/modules/ROOT/pages/sandbox/readme-sandbox.adoc169
-rw-r--r--docs/modules/ROOT/pages/sandbox/sandbox-api-test.xml36
-rw-r--r--docs/modules/ROOT/pages/sandbox/sandbox-test.xml250
-rw-r--r--docs/modules/ROOT/pages/sandbox/scripts/precompile-jsp.build.xml137
-rw-r--r--docs/modules/ROOT/pages/sandbox/scripts/snippets.sh21
-rw-r--r--docs/modules/ROOT/pages/sandbox/testsrc/org/aspectj/langlib/PointcutsCW.java232
-rw-r--r--docs/modules/ROOT/pages/sandbox/trails/debugging.adoc40
-rw-r--r--docs/modules/ROOT/pages/sandbox/trails/j2ee.adoc59
-rw-r--r--docs/modules/ROOT/pages/sandbox/trails/links.adoc39
-rw-r--r--docs/modules/ROOT/pages/sandbox/trails/myeclipseide.adoc57
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/buildAllPatterns.bat7
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/default.lst253
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/docs/readme.adoc59
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-readme.adoc23
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-test.xml252
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/allPatterns.lst51
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java64
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java103
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java84
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java158
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java58
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java102
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java155
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java89
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java62
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java58
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java92
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java73
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java49
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java96
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java64
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java57
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java110
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java58
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java62
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java64
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java57
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java62
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java110
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java103
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java62
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java97
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java66
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java103
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java99
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java66
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java90
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java102
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java108
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java37
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java86
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java38
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java102
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java81
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java52
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java40
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java104
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java38
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java87
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java46
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java47
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java40
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java98
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java80
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java180
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java141
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java120
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java120
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java81
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java119
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java47
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java78
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java73
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java59
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java44
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java52
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java44
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java52
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java56
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java62
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java77
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java66
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java60
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java102
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java60
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java64
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java89
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java114
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java44
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java66
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java122
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java46
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java66
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java185
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java131
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java71
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java73
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java84
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java115
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java85
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java92
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java69
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java99
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java98
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java88
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java130
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java97
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java95
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java94
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java57
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java46
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java89
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java71
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java44
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java45
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java58
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java92
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java85
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java78
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java75
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java112
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java124
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java63
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java77
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java57
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java136
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java165
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java123
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java105
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java73
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/tut-source-compile-error.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java108
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java82
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java47
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java99
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java78
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java105
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java67
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java60
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java94
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java104
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java158
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java75
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java46
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java60
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java157
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java100
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java138
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java85
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java85
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java94
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java114
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java147
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java85
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java105
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java129
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java70
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java67
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java96
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java39
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java106
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java72
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java75
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java69
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java36
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java69
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java51
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java75
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java76
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java68
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java61
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java79
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java103
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java80
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java34
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java55
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/build.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/visitor.lst2
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java71
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java89
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java59
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java104
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java74
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java77
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java43
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java47
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java176
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java52
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java38
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java255
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java39
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java209
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java83
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java143
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java51
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java46
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java65
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java168
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java91
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java115
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java93
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java87
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java130
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/build-lib.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-all.lst253
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-source.lst5
-rw-r--r--docs/modules/ROOT/pages/sandbox/ubc-design-patterns/testPattern.bat4
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/aosd2004.pptbin0 -> 1146880 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/build.xml15
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/readme.html299
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/scratch/HistoryUpdating.java27
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Box.java55
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Canvas.java15
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ColorControl.java20
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/FigureElement.java21
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Group.java88
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Line.java70
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Point.java59
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ShapeFigureElement.java38
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/SlothfulPoint.java42
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/FigurePanel.java172
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/LogAdapter.java16
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/Main.java25
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/support/Log.java36
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Box.java55
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Canvas.java15
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ColorControl.java16
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/FigureElement.java21
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Group.java88
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Line.java70
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Point.java59
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ShapeFigureElement.java38
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/SlothfulPoint.java42
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/FigurePanel.java172
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/LogAdapter.java16
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/Main.java25
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/HistoryUpdating.aj27
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/Log.java36
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/oopsla2001-script.html310
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/oopsla2002-script.html671
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/oopsla2002.pptbin0 -> 1157632 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/oopsla2003.pptbin0 -> 1669632 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/oopsla2004.pptbin0 -> 1568256 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/readme.txt6
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/debug.lst27
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/readme.html157
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/release.lst26
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Condition.java37
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/CoordinationAction.java37
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Coordinator.java449
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Exclusion.java33
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/MethodState.java45
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Mutex.java86
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Selfex.java55
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/TimeoutException.java27
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Bullet.java48
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Debug.java198
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display.java166
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display1.java203
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display2.java138
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacket.java44
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacketProducer.java63
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnsureShipIsAlive.java35
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Game.java215
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/GameSynchronization.java54
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Pilot.java44
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Player.java122
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Registry.java126
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/RegistrySynchronization.java58
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Robot.java201
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SWFrame.java92
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Ship.java298
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SpaceObject.java106
-rw-r--r--docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Timer.java53
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/README.txt124
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer.java7
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer1a.java22
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer1b.java21
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer1c.java21
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2a.java24
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2b.java26
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2c.java31
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2d.java24
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2e.java34
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer2f.java32
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer3a.java21
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer3b.java31
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer3c.java25
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer3d.java32
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer3e.java33
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer4a.java23
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer4b.java30
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer4c.java36
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer4d.java47
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/answers/Answer4e.java49
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/base.lst29
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/build.xml120
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures.zargobin0 -> 21599 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/Box.java64
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/FigureElement.java30
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/Group.java97
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/Line.java64
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/Point.java58
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/ShapeFigureElement.java47
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/SlothfulPoint.java50
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/gui/FigurePanel.java181
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/gui/LogAdapter.java25
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures/gui/Main.java31
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures_classes.pngbin0 -> 15036 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/figures_classes.svg298
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/guibase.lst5
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/index.html689
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/install.txt63
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/junit.jarbin0 -> 121070 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/index.adoc19
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/index.html31
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zipbin0 -> 80474 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zipbin0 -> 241708 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zipbin0 -> 241780 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zipbin0 -> 82816 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/pre-letter.txt130
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser3
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser.bat9
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/ajc3
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/ajc.bat9
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.bat15
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.csh11
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.sh18
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/setpaths14
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/setpaths.bat15
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/support/Log.java33
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/CoreTest.java79
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2a.java47
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2b.java44
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2c.java43
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2d.java44
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2e.java37
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test2f.java40
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test3a.java59
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test3b.java59
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test3c.java52
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test3d.java38
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test3e.java39
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test4a.java29
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test4b.java61
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test4c.java78
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test4d.java75
-rw-r--r--docs/modules/ROOT/pages/teaching/exercises/tests/Test4e.java62
-rw-r--r--docs/modules/ROOT/pages/teaching/oneHour.pptbin0 -> 1232896 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/readme.txt11
-rw-r--r--docs/modules/ROOT/pages/teaching/tutorial.pptbin0 -> 1327616 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/tutorials/aosd2006_GettingToGripsWithAspectJ5.pptbin0 -> 488448 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/tutorials/aspectj-tutorial-cascon2005.pptbin0 -> 1422848 bytes
-rw-r--r--docs/modules/ROOT/pages/teaching/tutorials/eclipseForumEurope2006_AspectJIntroduction.pptbin0 -> 1877504 bytes
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/build.xml142
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/build/binary-input/ignore.txt1
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/build/ignore.txt1
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/ec/inpathDirSrc/InpathFile.java2
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/ec/int/src/org/smart/persist/Persist.java11
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/ec/module/src/org/smart/app/Util.java10
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/ec/project/src/org/smart/app/Main.java12
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/ec/project/testsrc/org/smart/app/MainTest.java8
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/output/ignore.txt1
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/readme.txt3
-rw-r--r--docs/modules/ROOT/pages/test/antScriptTest/tools/aspectj/lib/ignore.txt1
642 files changed, 48340 insertions, 0 deletions
diff --git a/docs/modules/ROOT/pages/LICENSE-AspectJ.adoc b/docs/modules/ROOT/pages/LICENSE-AspectJ.adoc
new file mode 100644
index 000000000..ca18dbede
--- /dev/null
+++ b/docs/modules/ROOT/pages/LICENSE-AspectJ.adoc
@@ -0,0 +1,84 @@
+== *AspectJ^TM^ Compiler and Core Tools License*
+
+This is a binary-only release. Source code is available from
+https://eclipse.org/aspectj
+
+The Eclipse Foundation makes available all content in this distribution
+("Content"). Unless otherwise indicated below, the Content is provided
+to you under the terms and conditions of the Eclipse Public License
+Version v 2.0 ("EPL"). A copy of the EPL is available at
+xref:../../org/documents/epl-2.0/EPL-2.0.txt[https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt].
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse
+Foundation, the Content is being redistributed by another party
+("Redistributor") and different terms and conditions may apply to your
+use of any object code in the Content. Check the Redistributor's license
+that was provided with the Content. If no such license exists, contact
+the Redistributor. Unless otherwise indicated below, the terms and
+conditions of the EPL still apply to any source code in the Content and
+such source code may be obtained at link:/[https://www.eclipse.org].
+
+=== Third Party Content
+
+The Content includes items that have been sourced from third parties as
+set out below. If you did not receive this Content directly from the
+Eclipse Foundation, the following is provided for informational purposes
+only, and you should look to the Redistributor's license for terms and
+conditions of use.
+
+__
+
+==== BCEL v5.1
+
+This product contains software developed by the Apache Software
+Foundation (http://www.apache.org/[http://www.apache.org]).
+
+AspectJ includes a modified version of the Apache Jakarta Byte Code
+Engineering Library (BCEL) v5.1. BCEL is available at
+https://commons.apache.org/bcel/. Source code for the modified version
+of BCEL is available at Eclipse.org in the AspectJ source tree. This
+code is made available under the Apache Software License v1.1
+
+==== ASM v2.2.1
+
+AspectJ includes a binary version of ASM v2.2.1
+(http://asm.objectweb.org/index.html[http://asm.objectweb.org/]) The
+source code for ASM is available from the ObjectWeb download site at
+http://asm.objectweb.org/download/.
+
+The ASM license is available at http://asm.objectweb.org/license.html.
+The license is also reproduced here:
+
+[source, text]
+....
+Copyright (c) 2000-2005 INRIA, France Telecom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+....
diff --git a/docs/modules/ROOT/pages/README-AspectJ.adoc b/docs/modules/ROOT/pages/README-AspectJ.adoc
new file mode 100644
index 000000000..c754f3a44
--- /dev/null
+++ b/docs/modules/ROOT/pages/README-AspectJ.adoc
@@ -0,0 +1,149 @@
+== AspectJ^TM^
+
+_Version @build.version.long@ released on @build.date@._
+
+=== 1 Contents of this Package
+
+* the link:bin[`<aspectj install dir>/bin`] directory has scripts for
+** `ajc`: the compiler for the AspectJ language
+* the directory link:lib[`<aspectj install dir>/lib`] has the AspectJ
+binaries,
+** `aspectjtools.jar`: libraries for `ajc` and the Ant tasks
+** `aspectjrt.jar`: runtime library for AspectJ programs
+* the directory link:doc[`<aspectj install dir>/doc`] has examples,
+programming and development environment guides, instructions for the Ant
+tasks, a README for 1.1 changes, and a quick reference, all linked from
+the link:doc/index.html[index] page.
+* this README-AspectJ.adoc, and
+* the LICENSE-AspectJ.adoc applying to this distribution.
+
+'''''
+
+=== 2 Install Procedure
+
+The AspectJ tool `ajc` is a Java program that can be
+run indirectly from the scripts or directly from `aspectjtools.jar`. The
+`aspectjrt.jar` needs to be on the classpath when compiling or running
+programs compiled by `ajc`. This procedure shows ways to do that.
+
+After finishing automatic installation, we recommend that the following
+steps to complete your installation:
+
+*2.1 Add `<aspectj install dir>/lib/aspectjrt.jar` to your class path*
+
+____
+This small .jar file contains classes required to compile programs with
+the ajc compiler, and to run programs compiled with the ajc compiler.
+You must have these classes somewhere on your class path when running
+programs compiled with ajc. For detailed instructions please see the
+xref:#configInstructions[Configuration Instructions] at the bottom of
+this document.
+____
+
+*2.2 Put the AspectJ `bin` directory on your PATH*
+
+____
+Modify your PATH to include `<aspectj install dir>/bin`. This will
+make it easier to run ajc. For detailed instructions please see the
+xref:#configInstructions[Configuration Instructions] at the bottom of
+this document.
+____
+
+*2.3 Review the documentation and examples*
+
+____
+Development and programming guides are available in
+link:doc/index.html[docs], and example programs and an Ant script are
+available in link:doc/examples/[examples].
+____
+
+If you did not use the automatic installation process, you may wish to
+create short launch scripts to start ajc easily (section 3).
+
+'''''
+
+=== 3. Running the Tools
+
+If you did not use the automatic installation process or the default
+launch scripts do not work on your system, you may wish to create short
+launch scripts to start ajc easily.
+
+You can also run the `aspectjtools.jar` directly using java's -jar
+option:
+
+____
+`C:\jdk1.3\bin\java.exe -jar D:\aspectj\lib\aspectjtools.jar %*`
+____
+
+This will run `ajc`, the AspectJ compiler.
+
+You can also create scripts like those created by the installer. These
+scripts use full paths that are system dependent so you will likely have
+to change these.
+
+Here's a sample launch script for WinNT and Win2K (note that this is
+single line in the .bat file):
+
+____
+`C:\jdk1.3\bin\java.exe -classpath D:\aspectj\lib\aspectjtools.jar -Xmx64M org.aspectj.tools.ajc.Main %*`
+____
+
+Here's a sample launch script for a Unix shell (on Linux using Sun's
+JDK1.3):
+
+____
+`/usr/java/jdk1.3/jre/bin/java -classpath /home/aspectj/lib/aspectjtools.jar -Xmx64M org.aspectj.tools.ajc.Main "$@"`
+____
+
+'''''
+
+[[configInstructions]]
+=== 4. Configuration Instructions
+
+==== 4.1 Adding `<aspectj install dir>/lib/aspectjrt.jar` to your classpath
+
+There are several ways to add this jar file to your classpath:
+
+* copy `aspectjrt.jar` to the `jdk/jre/lib/ext` directory
+* add `aspectjrt.jar` to your CLASSPATH environment variable (see the
+next section for details)
+* always use the "`-classpath aspectjrt.jar`" option when running
+programs compiled with ajc
+
+==== 4.2 [#6.1]#Setting the Environment Variables on Windows#
+
+The following instructions use the PATH variable as an example, but this
+process is identical for the CLASSPATH variable.
+
+You can do the variables permanently for all the shells that you will
+run or temporarily only for the current shell. To change the PATH only
+in the current shell, and assuming you've installed AspectJ in
+`C:\apps\aspectj`, type:
+
+____
+`> set PATH=%PATH%;C:\apps\aspectj\bin`
+____
+
+*Changing Environment Variables Permanently on WinNT and Win2000*
+
+* open the Environment Variables dialog
+** WinNT: in "Control Panels" double-click "System" and select the
+"Environment" tab
+** Win2K: in "Control Panels" double-click "System", select the
+"Advanced" tab and click the "Environment Variables..." button
+* select the environment variable for editing, or add it using the
+"New..." button if it does not exist
+* add the new entry separated from the others by a semi-colon (;) and
+close the dialog
+* note that the change will not affect shells that were already running
+
+*Changing Environment Variables Permanently on Win9x*
+
+* open the AUTOEXEC.BAT with an editor such as NotePad
+* edit the PATH statement to include the new entry and save the file,
+e.g. +
++
+____
+`PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\;C:\DOS;C:\apps\aspectj\bin`
+____
+* note that the change will not affect shells that were already running
diff --git a/docs/modules/ROOT/pages/developer/BUILD.md b/docs/modules/ROOT/pages/developer/BUILD.md
new file mode 100644
index 000000000..75cef20e5
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/BUILD.md
@@ -0,0 +1,204 @@
+# Maven build options
+
+AspectJ is based on a multi-module Maven build with several options influencing
+
+ * what to build,
+ * whether to run tests,
+ * whether to create documentation for the AspectJ website,
+ * whether to create source and javadoc artifacts,
+ * whether to GPG-sign artifacts for a release.
+
+## Typical build scenarios
+
+As a developer, which modules or artifacts you want to build depends on your situation. For example:
+
+ * When building a stable, non-snapshot release (milestone, release candidate, final), your goal is to publish a full
+ set of artifacts on Maven Central (MC). Because MC requires you to publish javadocs and source code together with
+ the corresponding binaries and to sign all artifacts with GPG, this is the most complex and complete, but also the
+ slowest build you are about to encounter. Probably, you also want to build the AspectJ documentation to be deployed
+ to the website.
+
+ * When building a snapshot, the requirements are less strict, even if you are planning to make the release publicly
+ available in the Sonatype OSSRH snapshots repository. In this case, you can skip creating javadocs and source JARs
+ and also do not need to sign the artifacts. You might want to decide to sign anyway or at least to publish source
+ JARs (which modern IDEs can also use in order to display javadoc information). So even if you are not working with
+ an active Maven release profile, you want to have control over those options by setting properties. Probably, you do
+ not wish to generate the AspectJ documentation for the website, because presently there is not even a dedicated
+ place to deploy snapshot versions of it on the Eclipse webserver.
+
+ * When building during development without the need to publish it, you probably want to skip as many non-essential
+ parts of the build as possible. Firstly, you do not need them. Secondly, you want your build and run development
+ cycles to be as quick as possible. So in this case, definitely you are going to skip javadoc and source JARs,
+ website documentation and GPG signatures - unless you are in the process of changing and/or testing those parts of
+ the build.
+
+ * Independently of the above scenarios, you want to have control over whether to run (or even compile) any tests, and
+ if so, which one(s).
+
+## How to customise the build process
+
+You can customise the Maven build process by using build profiles and/or set corresponding system properties for
+fine-tuning.
+
+### Build profiles
+
+#### Main profiles
+
+The main profiles you are going to use are:
+
+ * By default, when not specifying any profiles or properties, the build skips a few non-essential, time-consuming
+ steps, but runs all tests: no javadocs, no source JARs, no GPG signatures, but generate documentation.
+
+ * `release` - Run tests, create javadoc and source JARs, generate documentation, activate GPG artifact signing.
+ Furthermore, each module creating one of the main build artifacts individually uses Nexus Staging Maven Plugin in
+ order to take care of deploying non-snapshot artifacts to Sonatype OSSRH staging repositories and subsequently
+ releasing them to Maven Central. See [How to release AspectJ](RELEASE.md) for more information. Snapshot artifacts
+ are being deployed normally, using Maven Deploy Plugin. See description of
+ [property `maven.deploy.skip`](#build-properties) below for more information.
+
+ * `fast-build` - In a way, this is the opposite of the release profile, trying to build the product as quickly as
+ possible by skipping all non-essential build steps: no tests (skipping even test compilation), no javadocs, no
+ source JARs, no GPG signatures, no documentation.
+
+ * `create-docs` - If you intend to run a build with all tests, but still wish to skip generating documentation,
+ deactivate this profile by
+ ```shell
+ mvn -P !create-docs ...
+ ```
+ On UNIX-like shells like Bash (also Git Bash under Windows), you probably need to escape the "!":
+ ```shell
+ mvn -P \!create-docs ...
+ ```
+ You can also deactivate the profile using a system property instead:
+ ```shell
+ mvn -DcreateDocs=false ...
+ ```
+
+#### Special profiles for `lib` module
+
+Defined in the `lib` module, there are two special profiles, helping to make the build more efficient:
+
+ * `provision-libs` - Downloads and installs software used during tests, such as Apache Ant and several libraries. Some
+ are downloaded from Maven Central, others directly from product download sites. Additionally, the build downloads
+ several missing source packages, so developers can use them during development in order to access source code and
+ javadoc. Because this build step is costly and should be performed only once after cloning the AspectJ repository
+ or when other circumstances require re-provisioning at least one of those libraries, it is activated automatically,
+ if marker file `lib/provisioned.marker` does not exist. After successful provisioning, the marker file is created,
+ helping to avoid repeating this build step henceforth.
+
+ * `clean-libs` - By default, `mvn clean` will not delete any of the libraries provisioned in profile `provision-libs`.
+ This is intentional and one of the reasons why the libraries are not provisioned into the `target` directory but
+ directly into `lib` subdirectories. If you wish to re-provision the libraries, simply run
+ ```shell
+ mvn -pl lib -P clean-libs clean
+ ```
+ Now you have a clean slate and during the next build, the libraries will be freshly downloaded and installed into
+ their respective `lib` subdirectories.
+
+Please note: An additional build step using Maven Enforcer Plugin also verifies the existence of several key files which
+ought to exist after a successful download. This heuristic check runs independently of the two build profiles mentioned
+above. It helps to detect accidental corruption of the provisioned libs, e.g., due to manual deletion or a previously
+failed provisioning build step (network problems, manually interrupted build).
+
+#### Other profiles
+
+Other existing profiles, which developers are less likely to actively use because they are applied automatically, are:
+
+ * `repeat-all-unit-tests` - Maven module `run-all-junit-tests` has the sole purpose of providing a convenient means of
+ running all tests across modules from an IDE instead of from Maven, in order to get JUnit build reporting directly
+ there instead of on the console. As a developer, you simply run test suite `RunTheseBeforeYouCommitTests`. This
+ profile is inactive by default, because in the context of a Maven build it would cause all tests to be run twice
+ (during module build and again when running the big suite), hence the profile name.
+
+ * `jdk-8-to-15` - Activated automatically on JDKs 8-15, setting properties `jvm.arg.addOpens` and
+ `jvm.arg.allowSecurityManager` to empty values, because they are only needed on JDK 16+ or 18+, respectively. See
+ next bullet point.
+
+ * `jdk-16-to-xx` - Activated automatically on JDKs 16+, setting property `jvm.arg.addOpens` to value
+ `--add-opens java.base/java.lang=ALL-UNNAMED`, which is needed in order to run LTW tests.
+
+ * `jdk-18-to-xx` - Activated automatically on JDKs 18+, setting property `jvm.arg.allowSecurityManager` to value
+ `-Djava.security.manager=allow`, which is needed by some tests in order to override `System.exit`.
+
+### Build properties
+
+The following properties and their default values in different profile are used in order to activate or skip Maven
+plugin executions:
+
+ * `maven.deploy.skip` (default `true`) - By default, do not deploy artifacts, because only the main AspectJ artifacts
+ are meant to be shared with the general public, i.e. deployed to Sonatype OSSRH Snapshots or Maven Central artifact
+ repositories. The main AspectJ artifact modules override the default, setting the value to `false`. This property is
+ used independently of build profiles, it simply has a global default and module-specific overrides.
+
+ * `maven.gpg.skip` (default: `true`) - By default, do not GPG-sign artifacts, because only the main AspectJ artifacts
+ need to be signed before publishing them on Maven Central. The main AspectJ artifact modules override the default,
+ setting the value to `false`. This property is used independently of build profiles, it simply has a global default
+ and module-specific overrides. Given the additional fact that Maven GPG Plugin is only active in the `release`
+ profile, it also means that the build globally skips signing if that profile is inactive. So if you wish to sign
+ snapshot artifacts, you need to activate the `release` profile (also activating all the other build steps that
+ profile has).
+
+ * `maven.javadoc.skip` (default: `true`) - By default, do not create javadoc. Overridden in the `release` profile.
+ When javadoc generation is skipped while producing the uber JAR assemblies for the main AspectJ artifacts, also
+ unzipping of source uber JARs is skipped, because that step is only needed in order to create uber JAR javadocs in
+ the first place. (Do not worry too much, if you do not fully understand what I just wrote.)
+
+ * `maven.source.skip` (default: `true`) - By default, do not create source JARs. Overridden in the `release` profile.
+ Actually, this property is meant to be used in order to skip execution of Maven Source Plugin, but currently the
+ AspectJ build does not even use that plugin, because the build does not create source JARs for individual modules.
+ That might change in the future, though, so we use this property to also influence Maven Assembly Plugin, which is
+ responsible for creating source uber JARs for the main AspectJ artifacts.
+
+ * `skipTests` (default: `false`) - By default, execute tests. Profile `fast-build` overrides this property.
+
+ * `maven.test.skip` (default: `false`) - By default, compile and execute tests. Profile `fast-build` overrides this
+ property. Actually, activating this property also implies `skipTests`, but `fast-build` sets both of them in order
+ to be explicit about its intentions.
+
+ * `createDocs` (default: `true`) - By default, create user documentation for the AspectJ website. Profile `fast-build`
+ overrides this property.
+
+### Examples
+
+In addition to the examples above, concerning how to skip website documentation generation in the `docs` module and how
+to clean downloaded libraries in the `lib` module, here are a few more:
+
+ * Run a clean default build including tests and generating Aspect documentation:
+ ```shell
+ mvn clean verify
+ ```
+ If you wish to install all artifacts in the local Maven repository, because subsquently maybe you want to run builds
+ for submodules you are working on and which need to find other artifacts in the repository for a successful build,
+ you rather use:
+ ```shell
+ mvn clean install
+ ```
+
+ * Run a fast build, no test compilation and execution, no AspectJ documentation, no javadoc, no source JARs
+ ```shell
+ mvn -P fast-build package
+ ```
+
+ * Run a release build incl. tests, GPG artifact signing and deployment:
+ ```shell
+ mvn -P release clean deploy
+ ```
+
+ * Run a release build incl. deployment, but without compiling and running tests because you ran all tests before
+ successfully already:
+ ```shell
+ mvn -P release,fast-build clean deploy
+ ```
+ This is effectively the same as:
+ ```shell
+ mvn -P release -Dmaven.test.skip=true clean deploy
+ ```
+ In a UNIX shell, you probably have to double-quote when using properties containing dots:
+ ```shell
+ mvn -P release "-Dmaven.test.skip=true" clean deploy
+ ```
+
+In general, you should not combine profiles setting the same properties in contradictory ways. If you need a very
+specific build configuration, you might want to use a profile matching your needs most closely and override specific
+properties. However, I am not going to share examples for this approach, because generally it is not necessary and also
+both error-prone and sensitive to even small changes in Maven POMs.
diff --git a/docs/modules/ROOT/pages/developer/IDE.md b/docs/modules/ROOT/pages/developer/IDE.md
new file mode 100644
index 000000000..d34f1c404
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/IDE.md
@@ -0,0 +1,134 @@
+# Setting up an AspectJ development environment
+
+_by Alexander Kriegisch, originally published on 2021-08-05_
+
+AspectJ, being an Eclipse project, can of course be used in the Eclipse IDE for Java developers, if you also install the
+AspectJ Development Tools (AJDT). IntelliJ IDEA also offers AspectJ and Spring AOP support. Regarding build tools, there
+are AspectJ plugins for Maven, Gradle, Mill and Ant.
+
+Of course, you can use and other IDE and build tool or simply use your trusted text editor of choice and compile using
+the AspectJ Compiler _ajc_ from the command line.
+
+Please refer to the [AspectJ Development Environment Guide](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html)
+for more details about on-board AspectJ tools, such as _ajc_ (compiler), _ajdoc_ (aspect-enriched Javadoc), _aj_
+(load-time weaving helper) as well as basic information about load-time weaving configuration and the built-in Ant task
+for AspectJ.
+
+## IDE support
+
+We are going to focus on the two IDEs the author of this document is acquainted with, Eclipse and IntelliJ IDEA. That
+does not mean that others such as NetBeans or the increasingly popular editor-on-steroids Visual Studio Code might not
+also be excellent choices, but I simply do not know them, sorry.
+
+### Eclipse
+
+If you install [AspectJ Development Tools (AJDT)](https://www.eclipse.org/ajdt/), you can use AspectJ in the Eclipse
+Java IDE. For the last few years, AJDT has rather been kept alive than actively developed, but still it works nicely for
+the usual tasks, such as writing aspects in both native and annotation-style syntax, viewing cross-references between
+aspects and Java code, applying all sorts of weaving strategies (compile-time weaving, post-compile binary weaving,
+load-time weaving) and with an additional m2e (Maven to Eclipse) connector also for importing and refreshing from
+projects using AspectJ Maven Plugin.
+
+#### AspectJ Development Tools (AJDT)
+
+Use an update site corresponding to your Eclipse version (minimal version listed):
+* Eclipse 2023-12 (4.30), AspectJ 1.9.21, Java 21: https://download.eclipse.org/tools/aspectj/ajdt/430/dev/update<br>
+ **Please note:** In Eclipse 2023-12, you should also add
+ https://download.eclipse.org/eclipse/updates/4.31-I-builds/I20231201-1800/ in addition to the regular release update
+ sites https://download.eclipse.org/eclipse/updates/4.30/ or https://download.eclipse.org/releases/latest. This is,
+ because AspectJ 1.9.21 contains support for JDK 21 string templates, which was added to the compiler after the 2023-12
+ release, but also includes a few Eclipse API changes requiring the additional update site. After adding it, please
+ make sure to call _Help_ → _Check for Updates_ and accept the updates.
+* Eclipse 2022-12 (4.26), AspectJ 1.9.19, Java 19: https://download.eclipse.org/tools/aspectj/ajdt/426/dev/update
+* Eclipse 2022-03 (4.23), AspectJ 1.9.19, Java 19: https://download.eclipse.org/tools/aspectj/ajdt/423/dev/update
+* Eclipse 2021-09 (4.21), AspectJ 1.9.8, Java 17: https://download.eclipse.org/tools/aspectj/ajdt/421/dev/update
+* Eclipse 2021-03 (4.19), AspectJ 1.9.7, Java 16: https://download.eclipse.org/tools/aspectj/ajdt/419/dev/update
+* Eclipse 2018-12 (4.10), AspectJ 1.9.6, Java 14: https://download.eclipse.org/tools/aspectj/ajdt/410/dev/update
+* For older versions, please refer to https://www.eclipse.org/ajdt/downloads (page was not updated in a long time,
+ and I have no write access).
+
+#### Maven to Eclipse (m2e) connector
+
+The connector between AspectJ Maven Plugin and AJDT has not been maintained by the AspectJ team for some years, but
+there is a fairly up-to-date [fork by Miika Vesti (joker1)](https://github.com/joker1/m2eclipse-ajdt) with the following
+update sites:
+ * Eclipse 2022-12 (4.26): https://repo.t5.fi/public/eclipse/m2eclipse-ajdt/eclipse-2022-12/
+ * Eclipse 2020-12 (4.18): https://repo.t5.fi/public/eclipse/m2eclipse-ajdt/eclipse-2020-12/
+ * Eclipse 2019-06 (4.12): https://repo.t5.fi/public/eclipse/m2eclipse-ajdt/eclipse-2019-06/
+
+Your AspectJ-related list of Eclipse update sites could look like this for Eclipse 2023-12:
+
+![Eclipse IDE filtered list of update sites](images/EclipseSoftwareSitesAJDT.png)
+
+### IntelliJ IDEA
+
+IDEA is a commercial IDE by JetBrains, which also has a free Community Edition. The author of this guide uses a
+complementary Ultimate Edition provided by JetBrains (thank you!), because he is an active open source developer (ask
+them if you are eligible, too). If you want to use the Ultimate Edition for commercial purposes, however, of course you
+need to buy it. According to [this resource](https://www.jetbrains.com/help/idea/aspectj.html), the AspectJ plugin is
+for the Ultimate Edition only, so probably the plugin is not going to work in the Community Edition. But if you are
+using AspectJ in your daytime job, probably you use the Ultimate Edition anyway.
+
+Make sure that the following plugins are active:
+ * AOP Pointcut Language (bundled): basic AspectJ and Spring AOP pointcut syntax support (annotation style)
+ * AspectJ (marketplace, author JetBrains): native AspectJ support
+
+If the Maven support bundled into IntelliJ IDEA is active as well, Maven projects using the AspectJ Maven Plugin will
+also be imported correctly. I never tested with any of the Gradle plugins or the AspectJ Ant task because I am a Maven
+user, so please try for yourself if those combinations are supported.
+
+## Build tools
+
+### Maven
+
+If you want to build your AspectJ projects with Maven, use [AspectJ Maven Plugin](https://github.com/dev-aspectj/aspectj-maven-plugin)
+by AspectJ.dev, artifact ID `dev.aspectj:aspectj-maven-plugin`. It is a fork of the original plugin by MojoHaus, which
+was inactive for several years and even now shows no activity other than AspectJ version bumps. Because the AspectJ.dev
+version has more features and is actively maintained by Alexander Kriegisch from the AspectJ core team, we recommend
+using it instead of the Mojohaus version.
+
+### Gradle
+
+In contrast to Maven, there is no de-facto standard build plugin for Gradle, but a bunch of more or less well-maintained
+plugins with a more or less complete feature set. I am not a Gradle user, but when answering related questions on
+Stack Overflow, I got the impression that [Freefair by Lars Grefer](https://docs.freefair.io/gradle-plugins/current/reference/#_aspectj_plugins)
+is the one I want to recommend because of its good documentation, active development and feature set. It could well be
+or become for the Gradle ecosystem what AspectJ Maven is for the Maven one. A few examples can be found
+[here](https://github.com/freefair/gradle-plugins/tree/main/examples/aspectj).
+
+### Mill
+
+If you want to build your AspectJ projects with the [Mill Build Tool](https://github.com/com-lihaoyi/mill), you can use
+the [mill-aspectj](https://github.com/lefou/mill-aspectj) plugin. It is actively maintained, and its author Tobias
+Roeser is also the maintainer of Mill. It supports all important settings of AspectJ and is even providing convenience
+options for polyglot projects, e.g. it features an option for out-of-the-box chained compilation with Zinc (for
+Java/Scala) and AspectJ (for weaving aspects) in the same module.
+
+### Ant
+
+As mentioned in the introduction, AspectJ features its own Ant task, which is described in
+[this chapter](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html#antTasks) of the Development Environment
+Guide.
+
+### Command line
+
+If you wish to install AspectJ in a separate directory and use it from the command line without any extra build tools,
+feel free to download the **AspectJ installer**. It is and executable JAR installer. It requires Java and possibly admin
+rights, if e.g. under Windows you want to install AspectJ to _C:/Program Files/AspectJ_. You execute it from a command
+prompt via `java -jar installer-<version>.jar` and select your installation options. Then you add `<ASPECTJ_HOME>/bin`
+to your path and are good to go. You can now call tools like the Aspectj compiler `ajc` or the AspectJ documentation
+generator `ajdoc` (similar to Javadoc) from the command line.
+
+You can find older installer versions until 1.9.6 on the [AspectJ website](https://www.eclipse.org/aspectj/downloads.php),
+more recent ones are attached to AspectJ [GitHub releases](https://github.com/eclipse/org.aspectj/releases) as
+_aspectj-*jar_.
+
+## Biased recommendation
+
+Feel free to be skeptical, because the author has both IDE and build tool biases, but I am recommending Maven as a build
+tool, AspectJ Maven as a build plugin and then either of Eclipse or IDEA as integrated development environments (IDEs).
+Why? Because Maven + (Eclipse or IDEA) probably has the most complete tooling and best end-to-end user experience for
+AspectJ developers. Because I am also by far the most active AspectJ and Spring AOP supporter on Stack Overflow, you also
+have better chances to receive spot-on answers than if e.g. you ask why your Ant or Gradle build does not work so nicely
+in NetBeans or VS Code. But by all means, please do choose whichever combination of tools is the prescribed standard in
+your work environment or simply your personal pereference. I believe, that diversity is good. 🙂
diff --git a/docs/modules/ROOT/pages/developer/RELEASE.md b/docs/modules/ROOT/pages/developer/RELEASE.md
new file mode 100644
index 000000000..afc68d4f8
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/RELEASE.md
@@ -0,0 +1,206 @@
+# How to release AspectJ
+
+AspectJ is built and released with Maven. As of writing this, there is a Maven wrapper in the project root folder,
+pointing to Maven 3.6.3, but we are going to use simple `mvn` commands instead of `./mvnw` here, assuming that there is
+a local Maven installation on your workstation. You can easily substitute one for the other command.
+
+When deploying final releases to Sonatype OSSRH, the build uses Nexus Staging Maven plugin instead of Maven Deploy
+plugin. This helps to create a staging repository for the release and later release it to Maven Central without having
+to log into the [Sonatype Nexus web UI](https://oss.sonatype.org/). Everything can be done from the command line.
+
+Snapshots do not need to be staged and released separately, Maven Deploy does the job in this case. so let us begin with
+the simple case:
+
+## Snapshot releases
+
+To publish a snapshot, set up your credentials in `~/.m2/settings.xml` something like:
+
+```xml
+<settings>
+ <servers>
+ <server>
+ <id>ossrh</id>
+ <username>USERNAME</username>
+ <password>PASSWORD</password>
+ </server>
+ </servers>
+</settings>
+```
+
+Assuming that you are currently working on version 1.9.8-SNAPSHOT, you simply call:
+
+```shell
+mvn clean deploy
+
+# OR: If you ran tests locally before, or the CI workflow on GitHub did
+mvn -DskipTests clean deploy
+
+# OR: Speed it up some more, skipping documentation generation. Depending on
+# your shell, you might not have to escape the '!' character for deactivating
+# the 'create-docs' profile. On a (Git) Bash you have to, though.
+mvn -P \!create-docs -DskipTests clean deploy
+```
+
+This only deploys the main artifacts
+ - AspectJ runtime `aspectjrt-[VERSION].jar`,
+ - AspectJ tools/compiler `aspecttools-[VERSION].jar`,
+ - AspectJ weaver `aspectjweaver-[VERSION].jar`,
+ - AspectJ matcher `aspectjmatcher-[VERSION].jar`.
+
+The AspectJ installer (`installer/target/aspectj-[VERSION].jar`) needs to be published separately, if you wish to make
+it available to the public for this snapshot.
+
+To consume an AspectJ snapshot published this way, use the OSSRH repository in the dependent project's POM:
+
+```xml
+<repository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+</repository>
+```
+
+## Public releases (milestone, release candidate, final)
+
+The artifacts released are the same as for snapshots, the procedure needs a few more steps, though. I am explaining the
+manual versioning process without using Maven Release plugin. It might work using Maven Release too, i.e.
+ - setting the release version in all POMs,
+ - building a release,
+ - running tests (can be skipped),
+ - committing the release POMs,
+ - tagging the release,
+ - deploying the release,
+ - setting the next snapshot version in all POMs,
+ - committing the snapshot POMs,
+ - pushing the previous commits and the release tag to the upstream Git repository.
+
+In order to show the details and give you more control over the process, you can do it step by step as follows:
+
+```shell
+# Make sure we are on JDK 16, because javadoc generation is JDK version sensitive
+# and might throw unexpected errors on other versions
+java -version
+# java version "16" 2021-03-16 (...)
+
+# Verify that we are working on a clean working directory.
+# There should be no staged, unstaged or untracked files.
+git status
+
+# Set release version in all POMs
+mvn versions:set -DnewVersion=1.9.8.M2
+
+# Verify if the POM changes are OK, then remove the POM backup files
+mvn versions:commit
+
+# Build and deploy the release to a Nexus staging repository.
+# The 'release' profile will activate:
+# - Maven GPG plugin for signing artifacts (stand by to enter your passpharase).
+# On Windows, a GUI password dialogue should pop up with a recent GnuPG version.
+# In case of error 'Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign',
+# try 'export GPG_TTY=$(tty)' before running the command.
+# - Maven Javadoc plugin
+# - Nexus Staging Maven plugin
+# The 'create-docs profile will make sure to generate AspectJ docs to be included in the installer.
+# Optionally, use '-DskipTests', if you ran all tests before.
+mvn -P release,create-docs clean deploy
+```
+
+If this command was successful, it means we have created a staging repository on Sonatype OSSRH, uploaded all artifacts
+and all pre-release checks on the Sonatype server passed, i.e. if the POMs contain all necessary information and if
+there are source and javadoc artifacts attached to the build. Now the only step left is to release the staging
+repository to Maven Central.
+
+Actually, Nexus Staging Maven plugin can also be configured deploy and release to Maven Central in a single command, but
+in order to give you a chance to manually download and verify the artifacts from the staging repository, the default
+plugin configuration in the parent POM is `<autoReleaseAfterClose>false</autoReleaseAfterClose>`. Switching the value to
+`true` would release straight to Maven Central, given all previous steps were successful.
+
+Before we release the staging repository though, we want to commit and tag the release, then set a new snapshot version:
+
+```shell
+# Commit the release POMs to Git (better do this from your IDE, verifying the
+# changes before staging them for Git commit)
+git commit -am "Set version to 1.9.8.M2"
+
+# Tag release
+git tag V1_9_8_M2
+
+# Set new snapshot version, increasing the version number after a final release
+mvn versions:set -DnewVersion=1.9.8-SNAPSHOT
+
+# Verify if the POM changes are OK, then remove the POM backup files
+mvn versions:commit
+
+# Commit the snapshot POMs to Git
+git commit -am "Set version to 1.9.8-SNAPSHOT"
+
+# Push the previous commits to GitHub
+git push origin
+
+# Push the release tag to GitHub
+git push origin V1_9_8_M2
+```
+
+OK, the Git house-keeping is done. Now finally, let us enjoy the fruits of our work and release the staging repository
+to Maven Central:
+
+```shell
+# Probably we forgot to write down the staging repository ID before.
+# It was written somewhere in the Maven log:
+# [INFO] * Created staging repository with ID "orgaspectj-1106".
+# [INFO] * Staging repository at https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/orgaspectj-1106
+# ...
+# [INFO] * Uploading locally staged artifacts to profile org.aspectj
+# [INFO] * Upload of locally staged artifacts finished.
+# [INFO] * Closing staging repository with ID "orgaspectj-1106".
+#
+# But it is too far to scroll up. So let us just ask Nexus, which staging
+# repositories there are.
+mvn nexus-staging:rc-list
+# [INFO] ID State Description
+# [INFO] orgaspectj-1106 CLOSED org.aspectj:aspectjrt:1.9.8.M2
+
+# Because of problems in Nexus Staging Maven Plugin with more recent JDKs,
+# we might need this first
+export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
+
+# Use the ID of the corresponding CLOSED staging repository for releasing to
+# Maven Central
+mvn nexus-staging:rc-release -DstagingRepositoryId=orgaspectj-1106
+```
+
+Tadaa! We have performed an AspectJ release. In a few minutes, the artifacts should appear on Maven Central somewhere
+under https://repo1.maven.org/maven2/org/aspectj/, e.g. AspectJ Tools 1.9.8.M2 would appear under
+https://repo1.maven.org/maven2/org/aspectj/aspectjtools/1.9.8.M2/. As soon as you see the artifacts there instead of
+"404 not found", you can announce release availability on the AspectJ mailing list and wherever else appropriate.
+
+Finally, you probably want to publish the AspectJ installer (`installer/target/aspectj-[VERSION].jar`), e.g. by creating a
+GitHub release and attaching artifacts and/or updating the Eclipse AspectJ website. You also want to update the AspectJ
+documentation, if there were any changes.
+
+## Deploying the AspectJ installer to aspectj.dev
+
+An easy way to quickly publish the installer is to simply deploy it to the Maven repository aspectj.dev. In order to do
+that, you need to mount the target directory as a WebDAV share first (ask an AspectJ maintainer for credentials). This
+can be done on all operating systems, for this example let us assume we are working on Windows and already have mounted
+the share to drive letter M: (M like Maven). Command `net use` would show something like this (sorry, in German):
+
+```text
+C:\Users\me>net use
+...
+Status Lokal Remote Netzwerk
+-------------------------------------------------------------------------------
+OK M: \\s000b153.kasserver.com\s000b153
+ Microsoft Windows Network
+...
+```
+
+Next, we need to tell Maven to
+ - actually deploy the installer (remember, by default only the artifacts listed above are deployed),
+ - override the default deployment repository (Sonatype OSSRH) by our WebDAV share.
+
+Before issuing the following command, make sure that you successfully built AspectJ before. Otherwise, Maven cannot find
+the artifacts it needs to create the installer JAR.
+
+```shell
+mvn --projects installer -Dmaven.deploy.skip=false -DaltDeploymentRepository=aspectj-dev::default::file:///M: deploy
+```
diff --git a/docs/modules/ROOT/pages/developer/SecretAPIs.txt b/docs/modules/ROOT/pages/developer/SecretAPIs.txt
new file mode 100644
index 000000000..da7fa01cb
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/SecretAPIs.txt
@@ -0,0 +1,52 @@
+FACT: The compiler is a complex beast.
+
+Sometimes its hard to test that widget you've stuck five levels deep down in the
+compiler infrastructure, sometimes you want to ship some experimental function
+that is only enabled in certain environments.
+
+The solution is that we design the code for testability and configurability.
+
+Q. What does this mean?
+
+It means that throughout the complex are public fields or methods that are
+exposed to enable some components to have their behaviour changed, from a
+testcase or hosting environment (AJDT). Andy has put a few of these in
+over the last few months, and Adrian has just put one in - I don't think
+we can get around the need for these things.
+
+Q. How do I identify them?
+
+I keep forgetting where I've put them, so from now on they are all marked
+with a task tag of SECRETAPI. When we have a little time to rest and
+reflect on what we've been doing we should look at whether they can be
+consolidated into an uber-control API module that centralises control of
+all these secret buttons and widgets.
+
+Q. Give me an example?
+
+1. The structure model produced post build is a complex series of data
+structures. Incremental compilation is complex too. Incremental
+repairs to the structure model to ensure it stays up to date when
+incrementally compiling are particularly complex so there is a flag
+to turn on incremental repairs.
+
+2. Testing what happens when processing incremental state is difficult
+as there is no nice API to the state object that you can call at the
+appropriate point in your test. The StateListener instance that
+can be set on the State object enables you to get callbacks when
+certain things happen - for example if a change is detected on a
+classpath entry the compiler is looking at. Doing it via an optional
+listener means we don't have to record endless amounts of
+information whilst state processing that would only be consumed
+by the test infrastructure.
+
+Q. Can I add them wherever I like?
+
+NO! They are a last resort if you can't test something cleanly
+*or* its so experimental you don't want to destabilise existing consumers
+of the compiler. For example the state management for incremental
+compilation is currently configurable (defaults to off) as it has an
+impact on memory usage and probably on other IDEs - when we've resolved
+these issues we can look to making ON the default. For any non-test
+related secret APIs you should think about when they ought to be made
+default !
diff --git a/docs/modules/ROOT/pages/developer/ajdt/ajdt.core.workitems.adoc b/docs/modules/ROOT/pages/developer/ajdt/ajdt.core.workitems.adoc
new file mode 100644
index 000000000..8d08e23f1
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/ajdt/ajdt.core.workitems.adoc
@@ -0,0 +1,248 @@
+= AJDT Core work items
+
+_Last updated: 2004-05-17 by acolyer_
+
+This document details what needs to be done in ajdt.core and
+shadows/org.eclipse.jdt.core to provide full integration with the eclipse
+JDT model and to support AJDT.
+
+== Unit testing
+
+Determine how we can write efficient and comprehensive unit tests for all
+that follows given the difficult swizzling etc. involved in creating a working
+plugin.
+
+== Builder integration
+
+This work package enables the building of AspectJ projects in batch and
+incremental mode, with problems found during compilation reported back to the
+tasks view. It also supports management of the Aspectjrt.jar classpath variable
+for AspectJ projects.
+
+A new subclass of JavaBuilder, AspectJBuilder has been introduced. This
+delegates to AjIncrementalImageBuilder and AjBatchImageBuilder to perform
+builds.
+
+. Basic builder support: Builds from source only, outputs to project
+ specified output directories, problem reporting integration.
+
+. Add support for inpath, outjar, aspectpath in building.
+ This task depends on IAspectJProject and implementation being able to
+ manage and persist AspectJ specific path elements (see xref:java-model-extension[]).
+** batch mode
+** incremental mode (requires delta processing)
+
+. Aspectjrt classpath variable
+
+== Reconciling & structure building
+
+This work package enables updating of structure based views as the contents of
+an editor buffer is edited, and reporting of warnings and errors (early error
+annotations) in the editor buffer.
+
+When a CompilationUnit is asked to build its structure, it creates a
+CompilationUnitStructureRequestor which is fed structure information by a
+SourceElementParser (see 4). It also creates a new CompilationUnitProblemFinder
+(Compiler subclass) and compiles the unit with it to detect any problems.
+
+. Determine how to build AjCompilerAdapter for CompilationUnitProblemFinders
+ (which are created outside of AspectJBuilder). This involves where and how
+ BcelWorld etc. are managed for the project.
+
+. As changes are made in an editor buffer, a CompilationUnitResolver continually
+ compiles the source and reports problems. This is another compiler subclass, and
+ we also need to determine how to build an AjCompilerAdapter for it.
+
+[[java-model-extension]]
+== Java Model Extension
+
+This work package is a needed foundation for almost any UI function that works
+with program structure or elements (e.g. to display AspectJ content in an
+outline view).
+
+This requires the creation of AspectJ element interfaces in the IJavaElement
+hierarchy, and then corresponding classes that implement them.
+
+. In the package org.aspectj.ajdt.core :
+
+** IAspectJModelExtension (extends org.eclipse.jdt.core.IModelExtension)
+** IAspectJElement (root interface for aspectj elements)
+** IAjType (extends IType, adds isAspect() )
+** IAspect (extends IAjType)
+** IAdvice
+** IPointcut
+** IDeclareErrorOrWarning
+** IDeclareParents
+** IDeclareSoft
+** IInterTypeField
+** IInterTypeMethod
+** IAspectJProject
+
+. In the package org.aspectj.ajdt.internal.core, for each interface above,
+ add SourceXXX and SourceXXXElementInfo classes.
+
+. In the package org.aspectj.ajdt.core.jdom, add classes IDOMxxx for each
+ interface in (1), plus implementation classes and SimpleDOMBuilder extension.
+
+. In the package org.aspectj.ajdt.internal.compiler.env, add an
+ IGenericXXX and ISourceXXX interface for each element in (1), which are
+ implemented by the classes in (2).
+
+== Source Element Parsing (Java Model creation)
+
+This work package populates the structure model on which the outline views
+etc. depend.
+
+. Extend ISourceElementRequestor with AspectJ AST nodes
+
+. Extend SourceElementParser to implement appropriate requestor callbacks
+
+. The 5 implementors of ISourceElementRequestor need updating to do the
+ appropriate thing with AspectJ elements:
+
+** CompilationUnitStructureRequestor (for outline view etc.)
+** SimpleDOMBuilder (used by portions of UI that generate code - refactoring? what else?)
+** SourceElementRequestorAdapter
+** SourceIndexRequestor (used by indexer, for searching and type hierarchy)
+** SourceMapper (used when attaching source to a jar file)
+
+. This seems to be the point at which we need to implement the
+ IExtensionFactory so that we can cleanly create Aj versions of the above
+ without polluting the JDT (see UI design of the same).
+
+== DOM extensions
+
+This work package enables the source code of an aspectJ program to be
+modelled as a structured document. Which user-interface actions will be
+broken without this? (Refactoring?)
+
+. In the package org.aspectj.jdt.core.dom, add counterparts to the AspectJ nodes
+ already defined in org.aspectj.internal.compiler.ast (not needed first time round?)
+. Extend IDocumentElementRequestor interface
+. Extend DocumentElementParser
+. Extend DOMBuilder
+. Extend DOMFactory
+. Add CreateAspectJXxxOperation classes
+
+== Code completion / code assist
+
+This work package enables Ctrl+Space in an editor to offer completions on
+pointcut names, aspect names, and inter-type declared methods and fields.
+
+. Extend ICompletionRequestor interface
+. Extend ICompletionRequestor implementors (there are 9, 7 of which are anonymous inner classes)
+. Extend CompletionEngine with pointcut
+. Extend ISelectionRequestor with pointcut
+. Investigate changes to SelectionEngine
+. Extend CompletionKeyword family
+. Add CompletionOnPointcut
+. Investigate changes to CompletionParser and CompletionScanner classes
+. Investigate changes in AssistParser
+. Extend keywords in 'impl' package
+. Add SelectionOnxxx classes for AspectJ in 'select' package
+. Investigate changes to SelectionParser and SelectionScanner
+
+== Type Hierarchy
+
+This work package enables the type hierarchy view to correctly display the
+hierarchy for aspects.
+
+. Override hierarchy methods in IAjType
+. Extend ChangeCollector
+. Extend TypeHierarchy
+. Extend HierarchyBinaryType
+
+== ".aj" File extension
+
+This work package ensures that AJDT treats .java and .aj files as equivalent.
+
+. update SuffixConstants class
+. update Util class
+
+== Java Model inclusion
+
+This work package ensures that all types in pure Java projects are visible
+inside the AspectJ model.
+
+Extend model generation logic to look at project that have either the
+AspectJ nature, OR the Java nature.
+
+== Class formatting and dissassembling
+
+This work package enables 'editing' of a .class file to present a view that
+is aware of AspectJ elements (rather than seeing the generated aj-synthetic
+stuff etc.).
+
+(can be deferred for now)
+
+. Make jdt.internal.compiler.classfmt aware of aj-synthetic
+. Make "" understand aj-attributes for pointcut, advice etc.
+. Extend Field and MethodInfo with isAjSynthetic()
+. Extend jdt.internal.core.util.Dissassembler for aspectj
+
+== Quick-fix support
+
+This work package enables quick fix suggestions to be made for AspectJ elements.
+
+. Extend ICorrectionRequestor interface
+. Update implementors (in UI)
+
+== Code formatting
+
+This work package ensures that formatting AspectJ source doesn't mess up
+pointcut declarations etc.
+
+. Update implementation of DefaultCodeFormatter for AspectJ
+. Extend CodeFormatterVisitor
+
+== Searching
+
+This work package enables searching for AspectJ elements in the search dialog and APIs.
+
+. Expand IJavaSearch constants for Aj
+. Expand SearchPattern for Aj
+. Changes to search algorithm required??
+. Extend ReferenceInfoAdapter
+. Extend IIndexSearchRequestor with aj types
+. Extend IndexSearchAdapter with aj types
+. Extend AbstractIndexer with aj types
+. Extend BinaryIndexer with aj types
+. Extend IIndexConstants
+. Extend SourceIndexRequestor (see also 4.3)
+. Add xxxLocator and Pattern classes for aj elements?
+
+== Sorting
+
+This work package enables the correct sorting of AspectJ program elements
+when an outline view is set to 'sorted' mode rather than showing elements in
+their declared order (I think!).
+
+. Extend SortElementBuilder
+. Extend SortJavaElement
+
+== Cross-references
+
+This work package enables the cross-reference view and visualiser to
+correctly display the cross-cutting structure of an aspectj program.
+
+. Create cross-reference map on batch build (1 map for whole workspace)
+. Maintain cross-reference map on incremental build
+. Add interfaces to retrieve cross-references for AspectJ elements
+. Implement IXReferenceProvider
+
+== Name lookups
+
+I'm not sure what user interface features need this...
+
+. Extend IJavaElementRequestor
+. Extend SelectionRequestor, SingleTypeRequestor
+. Investigate other implementors
+
+== Version upgrade
+
+. port to Eclipse 3.0 M9
+. port to Eclipse 3.0 final
+
+== JDT Debug
+
+. Extend jdt.internal.debug.core.hcr.JavaParseTreeBuilder ?
diff --git a/docs/modules/ROOT/pages/developer/amcDesignNotes.adoc b/docs/modules/ROOT/pages/developer/amcDesignNotes.adoc
new file mode 100644
index 000000000..77b0dd2d9
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/amcDesignNotes.adoc
@@ -0,0 +1,390 @@
+= AspectJ compilation
+
+_Last updated: 2004-03-15 by acolyer_
+
+== How Compilation Progresses in the JDT
+
+[source, text]
+....
+Compiler.compile(ICompilationUnit[] sourceUnits) {
+
+ foreach sourceUnit
+ create a new CompilationUnitResult
+ CompilationUnitDeclaration = parser.parse(sourceUnit, result)
+ remember CompilationUnitDeclaration (holds ref to result) in
+ "unitsToProcess"
+ end
+
+ foreach unitToProcess
+ resolve
+ analyse
+ generateCode
+ puts class files (plural) into CompilationUnitResult
+
+ unit.cleanup (discards AST info etc.)
+ requestor.acceptResult(result) -- each requestor does there own thing
+ discard CompilationUnitDeclaration
+ end
+}
+....
+
+Some portions of the JDT call the resolve method instead of compile,
+this works the same way except that there is only a single sourceUnit
+passed to the compiler, and the code generation phase is optional
+(controlled by flag passed by caller).
+
+
+== How (batch) Compilation Progresses in AspectJ 1.1.x
+
+[source, text]
+....
+AjBuildManager.doBuild() {
+
+ init phase
+ ----------
+ new AjState().prepareForNextBuild()
+ builds empty lists to hold classes etc.
+
+ setUpModel() // this stage should be omitted unless s.one wants it
+
+ new BcelWorld(classpath)
+ new BcelWeaver(world)
+
+ add all aspectpath entries to weaver
+ add all injars to weaver
+ add all inpath entries to weaver
+ add all source path *resources* to weaver
+
+ compile phase
+ -------------
+ build name environment, lookup environment, problem reporter and
+ compiler
+
+ compiler.compile()
+ proceeds as above, we pass in a requestor that adds the
+ resulting class files in the result into a list of addedClassFiles
+ in AjState
+
+ weave phase
+ -----------
+ add the addedClassFiles to the weaver
+
+ pass over all class files known to weaver, building xcut set
+ pass over all types, adding interTypeMungers to them
+ pass over all aspects, weave them
+ pass over all classes, weave them
+
+ write out any resources added to weaver
+}
+....
+
+== How we want (batch) compilation to proceed in AspectJ 1.2
+
+The key design goal is to do all the work inside the compile method of
+the compiler (this makes life much easier for integration with the
+rest of the JDT that, quite reasonably, expects the class files to be
+ready for action once a compile has completed). The second design goal
+is that it should be up to the requestor passed into the compiler
+whether or not the class files actually get written out to disk
+(different parts of the JDT pass in many different kinds of requestors
+that do different things).
+
+This simple model ignores aspectpath, inpath, injars, outjar,
+sourceDirs for now.
+
+[source, text]
+....
+Compiler.compile(ICompilationUnit[] sourceUnits) {
+
+ initial parse phase
+ -------------------
+ foreach sourceUnit
+ create a new CompilationUnitResult
+ CompilationUnitDeclaration = parser.parse(sourceUnit, result)
+ remember CompilationUnitDeclaration (holds ref to result) in
+ "unitsToProcess"
+ end
+
+ generate phase
+ --------------
+ foreach unitToProcess
+ resolve
+ analyse
+ generateCode
+ puts class files (plural) into CompilationUnitResult
+
+ unit.cleanup (discards AST info etc.)
+
+ // up to this point we are identical to JDT current behaviour,
+ // from now on we deviate
+ resultsPendingWeave.add(result)
+ discard CompilationUnitDeclaration
+ end
+
+ weave phase
+ -----------
+ //createWorldAndWeaver(classpath)
+ //the world and weaver have to be passed into the compiler, to
+ //support incremental use cases.
+
+ buildXCutSet(resultsPendingWeave)
+ addTypeMungers(resultsPendingWeave)
+ weaveAspects(resultsPendingWeave)
+ weaveClasses(resultsPendingWeave)
+
+ completion phase
+ ----------------
+ foreach resultPendingWeave
+ requestor.acceptResult(result) -- each requestor does their own
+ thing
+ end
+
+ // note : movement of any resouces is moved to outside of compile
+ // altogether. In eclipse, the xxxImageBuilders handle this.
+}
+
+buildXCutSet(resultsPendingWeave) {
+ foreach resultPendingWeave
+ foreach classfile
+ resolve
+ if aspect, add to xcut set.
+ end
+ end
+}
+
+addTypeMungers(resultsPendingWeave) {
+ foreach resultPendingWeave
+ foreach classfile
+ resolve
+ addTypeMungers
+ end
+ end
+}
+
+weaveAspect(resultsPendingWeave) {
+ foreach resultPendingWeave
+ foreach classfile
+ get corresponding BcelObjectType
+ weave
+ update classfile held in result
+ end
+ end
+}
+
+weaveClass(resultsPendingWeave) {
+ foreach resultPendingWeave
+ foreach classfile
+ get corresponding BcelObjectType
+ weave
+ update classfile held in result
+ end
+ end
+}
+....
+
+*Note on createWorldAndWeaver(classpath):*
+ We can probably avoid having to turn the Eclipse nameEnvironment
+ into an externalized classpath by extending
+ weaver.bcel.ClasspathManager to cope with "third party" managed
+ classpath entries. On the eclipse side we can implement some
+ interface and map it back into a call to INameEnvironment.findType -
+ will need to cast returned IBinaryType into ClassFileReader, this is
+ the only nasty. Much better than doing classpath nonsense though.
+
+*Note on handling the outjar option:*
+ This will be addressed by the requestor, if they want the results
+ to go into an outjar, they can do so when accepting results. It will
+ also have to be known by the piece of logic that moves resources (but
+ that is outside of compile anyway).
+
+*Note on handling sourceDirs:*
+ This is a command-line option only, and is handled by adding all
+ the source files in the directories to the list of sourceUnits passed
+ into compile.
+
+*Note on handling aspectpath:*
+ This is a list of directories and jar files containing class files
+ to be added to the list of aspects. These class files will be added
+ to the weaver's list of added aspects at the start of the weave phase
+
+*Note on handling injars, inpath:*
+ These contain a set of class files that were not generated via
+ parsing source, but instead are read directly from disk. We build a
+ dummy CompilationResult in which getClassFiles() returns ClassFile
+ objects for each of the class files. (Note, may need to define a
+ ClassFile subclass with that just takes byte[] - this is a horrid
+ hack but contained, and keeps the rest of the design clean).
+
+*Note on handling -XnoWeave:*
+ Just skip the weave phase!
+
+
+== Handling Batch Compiles From Eclipse Using the New Model
+
+Eclipse is responsible for building the name enviroment and list of
+ICompilationUnits to be compiled (does this already today). Eclipse is
+also responsible for creating and passing in the desired requestor
+(does this already today too).
+
+We will add a new BcelWorld constructor that takes an
+org.aspectj.weaver.IManagedClasspath or similar in place of a
+List of String classpath entries. ClasspathManager will be extended to
+do the right thing with this, and on the Eclipse side we will
+implement the interface backed by an INameEnvironment as discussed in
+the notes above.
+
+The AspectJ specific options (aspectpath etc) are stored in an
+extension of IJavaProject, IAspectJProject, and persisted in .ajpath
+(analagous to .classpath) in the AspectJ project.
+
+The AbstractImageBuilder handles resource copying, and we don't need
+to change this logic in any way.
+
+That's all folks!
+
+== Handling Batch Compiles From ajc Using the New Model
+
+AjBuildManager creates the list of ICompilationUnits to be compiled in
+the same way that it does today.
+
+It could obtain a classpath to give to the weaver from AjBuildConfig
+in the same way that it does today - but it might be simpler and more
+consistent to pass across an IManagedClasspath built from the
+FileSystem (INameEnvironment) built from the classpath - this will
+give consistency across inside and outside Eclipse compiles.
+
+The compiler is constructed with a requestor that writes class files
+in CompilationUnitResults out to disk at the output location (or jar
+file) in the AjBuildConfig.
+
+The AspectJ specific options (aspectpath etc) are obtained from
+AjBuildConfig as today.
+
+Resource copying will ideally be handled outside of the weaver (from
+source dirs and inpath dirs only) inside AjBuildManager.
+
+== How Incremental Compilation Works in the JDT
+
+Incremental compilation begins in the JavaBuilder with a request to
+perform an incremental build. If the classpath of the project has
+changed, or a binary project member (jar or .class file) has changed,
+it reverts to a full build.
+
+An IncrementalImageBuilder is then created and asked to build the
+deltas since the last build. If this succeeds the new build state is
+recorded for the next compile, otherwise we revert to a full build.
+
+The IncrementalImageBuilder algorithm proceeds as follows:
+
+* initialize builder
+* walk this project's deltas, find changed source files
+* walk prereq projects' deltas, find changed class files & add
+* affected source files
+** use the build state # to skip the deltas for certain prereq projects
+** ignore changed zip/jar files since they caused a full build
+* compile the source files & acceptResult()
+* compare the produced class files against the existing ones on disk
+* recompile all dependent source files of any type with structural
+* changes or new/removed secondary type
+* keep a loop counter to abort & perform a full build (after 5 attempts)
+
+
+
+== How Incremental Compilation Works in AspectJ 1.1.x
+
+As per batch building, except that:
+
+* if previous built state (AjState) exists, we do not create a new
+ bcelWorld (will use existing one).
+* create list of source files to compile by looking at all source
+ files modified since last build date
+* delete any class files that resulted from now deleted files, tell
+ the weaver about them
+* extend list of source files to compile with files containing types
+ that reference types defined in modified source files
+* ask the compiler to compile the source files
+* find the list of source files that refer to things we changed, if
+ its non-empty, defer to a batch build (this is like the eclipse
+ algorithm, but with a loop count of 1).
+
+Now hand-off to weaver...
+
+* tell the weaver about every class file we wrote
+* weaver determines whether or not it needs to reweave everything by
+ looking at added and deleted classes and searching for aspects
+ (slight simplification)
+* weave proceeds as before, weaving either only the added classes, or
+ everything, as required.
+
+== How we want Incremental Compilation to proceed in AspectJ 1.2
+
+This is harder to get right than batch (surprise). We still want the
+same two statements to hold at the end of the compilation of an
+individual source file:
+
+. all the class files have been written out and are ready to be used
+. all errors in any type defined in the file have been reported
+
+In both cases, the real 'incremental' logic is outside of the Compiler
+itself (in IncrementalImageBuilder and in AjBuildManager). In the
+current ajc case though, all compilation iterations have completed
+before entering a single back-end weave phase. Pushing weaving inside
+compile (as outlined in the proposal for batch building) makes this
+design harder to accomplish in the new world. We are saved by the fact
+that the current AspectJ incremental implementation currently only
+supports one go round the loop before bailing out to a full build, and
+we can mimic that behaviour easily.
+
+The logic in AjState that currently updates the weaver with
+addedClassFiles as compilation results are produced will have to be
+moved into the compiler (adaptor), to occur between the intermediate
+class file generation and the weaving phase.
+
+== Incremental AspectJ Compilation in Eclipse
+
+The JavaBuilder (one per project) will be responsible for managing the
+bcelWorld and bcelWeaver. These will be passed to the Compiler
+(Adaptor) prior to calling compile. The incremental build manager
+which processes deltas will be responsible for informing the weaver of
+deleted class files. Added class files are determined as compilation
+progresses. Weaving will happen inside the compile method, as
+described for batch, with the twist that the whole world may be
+rewoven if the weaver feels this is necessary. To keep things
+initially as close to the current AspectJ implementation as possible,
+we will set the maximum loop limit to 1 in the IncrementalImageBuilder
+so that we bail out to a full build if we don't compile everything we
+need in the first go. With a suitable test suite in place, there's no
+conceptual reason why we couldn't put that back up to 5 (the JDT
+default) as far as I can see right now.
+
+When performing a whole world weave, the compiler may end up asking
+requestors to acceptResult()s that they didn't request to be compiled,
+but this is no different to the dependency analysis done on
+referencing types that may then get added into subsequent incremental
+loops in the JDT today.
+
+== Incremental AspectJ Compilation in ajc
+
+AjBuildManager manages the bcelWorld and weaver as it does today, and
+passes them to the compiler adaptor for it to call the weave method
+rather than AjBuildManager calling weave directly as it does
+today.
+
+*Note on handling aspectpath:*
+If the JavaBuilder detects that the aspectpath itself has changed in
+any way, it will request a full build. If delta analysis during the
+first phase of incremental compilation detects that a jar or class
+file in an aspectpath has changed, it will bail out to a full build.
+
+*Note on handling injars, inpath:*
+We must make sure that the delta analysis allows a project with only
+an inpath change to proceed to building (rather than thinking that
+there is nothing to do). Any changed jars or class files will have
+their classes added to the weaver, and the weaver will be notified of
+deletions too. We need to ensure that we still continue on to
+compilation even when there are no "source files" in the work queue -
+will need some design.
+
+*For tomorrow:* start looking at refactoring AspectJ codebase itself to
+fit the new shape, ahead of trying to do ImageBuilder integration at
+the same time (in AspectJ, I have the test harness to guide me).
diff --git a/docs/modules/ROOT/pages/developer/asm.doc b/docs/modules/ROOT/pages/developer/asm.doc
new file mode 100644
index 000000000..4dec49bb7
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/asm.doc
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/compiler-weaver.adoc b/docs/modules/ROOT/pages/developer/compiler-weaver.adoc
new file mode 100644
index 000000000..ba1b28260
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/compiler-weaver.adoc
@@ -0,0 +1,1192 @@
+== Guide for Developers of the AspectJ Compiler and Weaver
+
+_Latest (non-license) content update: 2004-02-20 by jhugunin_
+
+This document is written for developers who want to understand the
+implementation of AspectJ. It provides a top-down picture of the
+compiler and weaver implementations. This high-level picture should make
+it easier to read and understand the source code for AspectJ.
+
+The AspectJ compiler/weaver (ajc) is composed of three primary modules.
+
+* *org.aspectj.ajdt.core* - this is the compiler front-end and extends
+the eclipse Java compiler from *org.eclipse.jdt.core*. Because of the
+dependencies on parts of eclipse this generates a large ~6MB jar.
+* *weaver* - this provides the bytecode weaving functionality. It has
+very few external dependencies to minimize the size required for
+deployment of load-time weavers. Currently the build process doesn't
+produce a separate jar for just the weaver, but that will have to change
+for AspectJ-1.2.
+* *runtime* - these are the classes that are used by generated code at
+runtime and must be redistributed with any system built using AspectJ.
+This module has no external dependencies and produces a tiny ~30KB jar.
+
+image:images/overview.png[image]
+
+The AspectJ compiler accepts both AspectJ bytecode and source code and
+produces pure Java bytecode as a result. Internally it has two stages.
+The front-end (org.aspectj.ajdt.core) compiles both AspectJ and pure
+Java source code into pure Java bytecode annotated with additional
+attributes representing any non-java forms such as advice and pointcut
+declarations. The back-end of the AspectJ compiler (weaver) implements
+the transformations encoded in these attributes to produce woven class
+files. The back-end can be run stand-alone to weave pre-compiled aspects
+into pre-compiled .jar files. In addition, the back-end exposes a
+weaving API which can be used to implement ClassLoaders that will weave
+advice into classes dynamically as they are loaded by the virtual
+machine.
+
+=== Compiler front-end (org.aspectj.ajdt.core)
+
+The front-end of the AspectJ compiler is implemented as an extension of
+the Java compiler from eclipse.org. The source-file portion of the
+AspectJ compiler is made complicated by inter-type declarations, declare
+parents, declare soft, and privileged aspects. All of these constructs
+require changes to the underlying compiler to modify Java’s name-binding
+and static checking behavior.
+
+As the compiler extends the jdt.core compiler, the package structure of
+this module mimics that of the jdt.core module. The design works hard to
+minimize the set of changes required to org.eclipse.jdt.core because a
+fun 3-way merge is required each time we want to move to a new
+underlying version of this code. The ultimate goal is to contribute all
+of our changes to jdt.core back into the main development branch some
+day.
+
+The basic structure of a compile is very simple:
+
+. Perform a shallow parse on all source files
+. Pass these compilation units through AjLookupManager to do type
+binding and some AspectJ augmentation
+. For each source file do a deep parse, annotation/analysis, and then
+code generation
+
+==== Top-level parse tree
+
+Let's trace the following example program through the compiler.
+
+[source, java]
+....
+package example.parse.tree;
+
+import org.aspectj.lang.*;
+
+public class Main {
+ public static void main(String[] args) {
+ new Main().doit();
+ }
+
+ private void doit() {
+ System.out.println("hello");
+ }
+}
+
+aspect A {
+ pointcut entries(Main o): execution(void doit()) && this(o);
+ before(Main o): entries(o) {
+ o.counter++;
+ System.out.println("entering: " + thisJoinPoint);
+ }
+
+ private int Main.counter = 0;
+}
+....
+
+When parsed, this program will produce the following tree.
+
+image:images/top-tree.png[image]
+
+==== PointcutDeclaration processing
+
+Let's look more closely at the pointcut declaration:
+
+[source, java]
+....
+pointcut entries(Main o): execution(void doit()) && this(o);
+....
+
+image:images/pointcut-dec.png[image]
+
+The pointcut declaration is implemented as a subtype of a method
+declaration. The actual pointcut is parsed by the weaver module. This
+parsing happens as part of the shallow parse phase. This is because this
+information might be needed to implement a declare soft.
+
+==== AdviceDeclaration processing
+
+Next we look at the processing for an advice declaration:
+
+[source, java]
+....
+before(Main o): entries(o) {
+ o.counter++;
+ System.out.println("entering: " + thisJoinPoint);
+}
+....
+
+After parsing, the AdviceDeclaration.postParse method will be called to
+make this a valid MethodDeclaration so that the standard eclipse code
+for analyzing a method body can be applied to the advice. After
+postParse, the selector is filled in and several additional arguments
+are added for the special thisJoinPoint forms that could be used in the
+body.
+
+image:images/advice-dec.png[image]
+
+At this point the statements field which will hold the body of the
+advice is still null. This field is not filled in until the second stage
+of the compiler when full parsing is done on each source file as a
+prelude to generating the classfile.
+
+==== Overview of the main classes in org.aspectj.ajdt.core
+
+The main classes in this module are shown in the following diagram:
+
+image:images/ajdt-uml.png[image]
+
+=== Weaving back-end (weaver)
+
+This provides all of the weaving functionality. It has very few
+dependencies to keep the code as small as possible for deployment in
+load-time weavers - only asm, bridge and util which are each very small
+modules with no further dependencies. This also depends on a patched
+version of the bcel library from apache.org. The patches are only to fix
+bcel bugs that can't be worked around in any other way.
+
+There are only four packages in this system.
+
+* org.aspectj.weaver - general classes that can be used by any weaver
+implementation
+* org.aspectj.weaver.patterns - patterns to represent pointcut
+designators and related matching constructs
+* org.aspectj.weaver.ast - a very small library to represent simple
+expressions without any bcel dependencies
+* org.aspectj.weaver.bcel - the concrete implementation of shadows and
+the weaver using the bcel library from apache.org
+
+The back-end of the AspectJ compiler instruments the code of the system
+by inserting calls to the precompiled advice methods. It does this by
+considering that certain principled places in bytecode represent
+possible join points; these are the “static shadow†of those join
+points. For each such static shadow, it checks each piece of advice in
+the system and determines if the advice's pointcut could match that
+static shadow. If it could match, it inserts a call to the advice’s
+implementation method guarded by any dynamic testing needed to ensure
+the match.
+
+=== Runtime support library (runtime)
+
+This library provides classes that are used by the generated code at
+runtime. These are the only classes that must be redistributed with a
+system built using AspectJ. Because these classes are redistributed
+this library must always be kept as small as possible. It is also
+important to worry about binary compatibility when making changes to
+this library. There are two packages that are considered public and may
+be used by AspectJ programs.
+
+* org.aspectj.lang
+* org.apectj.lang.reflect
+
+There are also several packages all under the header org.aspectj.runtime
+that are considered private to the implementation and may only be used
+by code generated by the AspectJ compiler.
+
+=== Mappings from AspectJ language to implementation
+
+[cols=",,",]
+|===
+| |org.aspectj.ajdt.internal.compiler |weaver - org.aspectj.weaver.
+
+|aspect |ast.AspectDeclaration |CrosscuttingMembers
+
+|advice |ast.AdviceDeclaration |Advice + bcel.BcelShadowMunger
+
+|pointcut declaration |ast.PointcutDeclaration
+|ResolvedPointcutDefinition
+
+|declare error/warning |ast.DeclareDeclaration |Checker +
+patterns.DeclareErrorOrWarning
+
+|declare soft |ast.DeclareDeclaration + problem.AjProblemReporter
+|Advice (w/ kind = Softener) + patterns.DeclareSoft
+
+|declare parents |ast.DeclareDeclaration + lookup.AjLookupEnvironment
+|patterns.DeclareParents + NewParentTypeMunger
+
+|inter-type decls |ast.InterType*Declaration + lookup.InterType*Binding
++ lookup.AjLookupEnvironment |New*TypeMunger + bcel.BcelTypeMunger
+
+|if pcd |ast.IfPseudoToken + ast.IfMethodDeclaration
+|patterns.IfPointcut
+
+|pcd |ast.PointcutDesignator |patterns.Pointcut hierarchy
+|===
+
+== Tutorial: implementing a throw join point
+
+This tutorial will walk step-by-step through the process of adding a new
+join point to AspectJ for the moment when an exception is thrown. In
+Java source code, the shadow of this point is a throw statement. In Java
+bytecode, the shadow is the athrow instruction.
+
+This tutorial is recommended to anyone who wants to get a better feel
+for how the implementation of AspectJ really works. Even if you're just
+working on a bug fix or minor enhancement, the process of working with
+the AspectJ implementation will be similar to that described below. The
+size of your actual code changes will likely be smaller, but you are
+likely to need to be familiar with all of the pieces of the
+implementation described below.
+
+=== Part 1: Adding the join point and corresponding pcd
+
+The first part of this tutorial will implement the main features of the
+throw join point. We will create a new join point shadow corresponding
+to the athrow instruction and also create a new pointcut designator
+(pcd) for matching it.
+
+==== Step 1. Synchronize with repository and run the existing test suite
+
+Do a Team->Synchronize With Repository and make sure that your tree is
+completely in sync with the existing repository. Make sure to address
+any differences before moving on.
+
+Run the existing test suite. I currently do this in four steps:
+
+* weaver/testsrc/BcWeaverModuleTests.java
+* org.aspectj.ajdt.core/testsrc/EajcModuleTests.java
+* ajde/testsrc/AjdeModuleTests.java
+* Harness on ajctests.xml -- at least under 1.4, preferably under both
+1.3 and 1.4.
+
+There should be no failures when you run these tests. If there are
+failures, resolve them with the AspectJ developers before moving on.
+
+==== Step 2. Write a proto test case
+
+{empty}a. Create a new file in tests/design/pcds/Throw.java
+
+[source, java]
+....
+import org.aspectj.testing.Tester;
+
+public class Throws {
+ public static void main(String[] args) {
+ try {
+ willThrow();
+ Tester.checkFailed("should have thrown exception");
+ } catch (RuntimeException re) {
+ Tester.checkEqual("expected exception", re.getMessage());
+ }
+ }
+
+ static void willThrow() {
+ throw new RuntimeException("expected exception");
+ }
+}
+
+aspect A {
+ before(): withincode(void willThrow()) {
+ System.out.println("about to execute: " + thisJoinPoint);
+ }
+}
+....
+
+{empty}b. Create a temporary test harness file to run just this test in
+myTests.xml
+
+[source, xml]
+....
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
+<suite>
+ <ajc-test dir="design/pcds"
+ title="simple throw join point">
+ <compile files="Throws.java" />
+ <run class="Throws"/>
+ </ajc-test>
+</suite>
+....
+
+{empty}c. Run this test using the harness. You should see:
+
+[source, text]
+....
+about to execute: execution(void Throws.willThrow())
+about to execute: call(java.lang.RuntimeException(String))
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 2 seconds
+....
+
+==== Step 3. Implement the new join point shadow kind
+
+Modify runtime/org.aspectj.lang/JoinPoint.java to add a name for the
+Throw shadow kind.
+
+[source, java]
+....
+static String THROW = "throw";
+....
+
+Modify weaver/org.aspectj.weaver/Shadow.java to add the Throw shadow
+kind. This adds a static typesafe enum for the Throw Kind. The
+constructor uses the name from the runtime API to ensure that these
+names will always match. The '12' is used for serialization of this kind
+to classfiles and is part of the binary API for aspectj. The final
+'true' indicates that this joinpoint has its arguments on the stack.
+This is because the throw bytecode in Java operates on a single argument
+that is a Throwable which must be the top element on the stack. This
+argument is removed from the stack by the bytecode.
+
+[source, java]
+....
+public static final Kind Throw = new Kind(JoinPoint.THROW, 12, true);
+....
+
+We also modify the neverHasTarget method to include the Throw kind
+because in Java there is no target for the throwing of an exception.
+
+[source, java]
+....
+public boolean neverHasTarget() {
+ return this == ConstructorCall
+ || this == ExceptionHandler
+ || this == PreInitialization
+ || this == StaticInitialization
+ || this == Throw;
+}
+....
+
+In the read method on Shadow.Kind, add another case to read in our new
+Shadow.Kind.
+
+[source, java]
+....
+case 12: return Throw;
+....
+
+==== Step 4. Create this new kind of joinpoint for the throw bytecode
+
+Modify weaver/org.aspectj.weaver.bcel/BcelClassWeaver.java to recognize
+this new joinpoint kind. In the method
+
+[source, java]
+....
+private void match(
+ LazyMethodGen mg,
+ InstructionHandle ih,
+ BcelShadow enclosingShadow,
+ List shadowAccumulator)
+{
+....
+
+Add a test for this instruction, i.e.
+
+[source, java]
+....
+} else if (i == InstructionConstants.ATHROW) {
+ match(BcelShadow.makeThrow(world, mg, ih, enclosingShadow),
+ shadowAccumulator);
+}
+....
+
+Then, modify BcelShadow.java to create this new kind of join point
+shadow:
+
+[source, java]
+....
+public static BcelShadow makeThrow(
+ BcelWorld world,
+ LazyMethodGen enclosingMethod,
+ InstructionHandle throwHandle,
+ BcelShadow enclosingShadow)
+{
+ final InstructionList body = enclosingMethod.getBody();
+ TypeX throwType = TypeX.THROWABLE; //!!! not as precise as we'd like
+ TypeX inType = enclosingMethod.getEnclosingClass().getType();
+ BcelShadow s =
+ new BcelShadow(
+ world,
+ Throw,
+ Member.makeThrowSignature(inType, throwType),
+ enclosingMethod,
+ enclosingShadow);
+ ShadowRange r = new ShadowRange(body);
+ r.associateWithShadow(s);
+ r.associateWithTargets(
+ Range.genStart(body, throwHandle),
+ Range.genEnd(body, throwHandle));
+ retargetAllBranches(throwHandle, r.getStart());
+ return s;
+}
+....
+
+Finally modify weaver/org.aspectj.weaver/Member.java to generate the
+needed signature
+
+[source, java]
+....
+public static Member makeThrowSignature(TypeX inType, TypeX throwType) {
+ return new Member(
+ HANDLER,
+ inType,
+ Modifier.STATIC,
+ "throw",
+ "(" + throwType.getSignature() + ")V");
+}
+....
+
+Run the proto test again and you should see:
+
+[source, text]
+....
+about to execute: execution(void Throws.willThrow())
+about to execute: call(java.lang.RuntimeException(String))
+about to execute: throw(catch(Throwable))
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 3 seconds
+....
+
+That last line shows the 'throw(catch(Throwable))' join point. This is a
+slightly confusing string form, but it is the first sign of our brand
+new join point. The reason for the weird 'catch(Throwable)' part is that
+we used Member.HANDLER for the kind of the signature of this join point.
+That's clearly not correct. We'll fix that at the end of the lesson as
+part of the clean-up. For now, let's go on with the interesting parts.
+
+==== Step 5. Extend our proto-test to use a pointcut designator for matching
+
+Add a second piece of before advice to the test aspect A:
+
+[source, java]
+....
+before(): throw(Throwable) {
+ System.out.println("about to throw: " + thisJoinPoint);
+}
+....
+
+When we run the test again we'll get a long error message from the
+harness. The interesting part of the message is the following:
+
+[source, text]
+....
+[ 0] [error 0]: error can't find referenced pointcut at C:\aspectj\eclipse\tests\design\pcds\Throws.java:23:0
+....
+
+This error is not quite what you might have expected. You might have
+hoped for a syntax error saying that there is not 'throw' pointcut
+designator defined. Unfortunately, this is a weakness in the syntax of
+AspectJ where primitive PCDs and named PCDs have the same syntax, so the
+compiler can't tell the difference between a misspelled or non-existent
+primitive PCD and a named PCD reference that is missing. This also has
+some impact on extending the primitive PCDs because it will break
+existing programs. In this case, when we add the throw PCD we will break
+any existing programs that use throw as the name for a user-defined PCD.
+Fortunately because throw is a Java keyword this particular change is
+very safe.
+
+==== Step 6. Extend the PCD parser to handle this new primitive PCD
+
+Modify the parseSinglePointcut method in
+weaver/org.aspectj.weaver.patterns/PatternParser.java to add one more
+else if clause for the throw pcd:
+
+[source, java]
+....
+} else if (kind.equals("throw")) {
+ parseIdentifier(); eat("(");
+ TypePattern typePat = parseTypePattern();
+ eat(")");
+ return new KindedPointcut(Shadow.Throw,
+ new SignaturePattern(Member.HANDLER, ModifiersPattern.ANY,
+ TypePattern.ANY, TypePattern.ANY, NamePattern.ANY,
+ new TypePatternList(new TypePattern[] {typePat}),
+ ThrowsPattern.ANY));
+....
+
+Modify the matches method in
+weaver/org.aspectj.weaver.patterns/SignaturePattern.java to add:
+
+[source, java]
+....
+if (kind == Member.HANDLER) {
+ return parameterTypes.matches(world.resolve(sig.getParameterTypes()),
+ TypePattern.STATIC).alwaysTrue();
+}
+....
+
+Run the proto test again and you should see:
+
+[source, text]
+....
+about to execute: execution(void Throws.willThrow())
+about to execute: call(java.lang.RuntimeException(String))
+about to execute: throw(catch(Throwable))
+about to throw: throw(catch(Throwable))
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 1 seconds
+....
+
+Make sure that you see the 'about to throw' printed before moving on.
+This shows that the throw PCD is now successfully matching the throw
+join point shadow we added earlier.
+
+==== Step 7. Check that we're properly providing the single thrown argument (and clean-up the test)
+
+Now that we have a valid pcd for this advice, we can simplify our test
+case. Modify our test aspect A to be the following. In addition to
+removing the overly generic withincode pcd, this change also prints the
+actual object that is about to be thrown:
+
+[source, java]
+....
+aspect A {
+ before(Throwable t): throw(*) && args(t) {
+ System.out.println("about to throw: '" + t+ "' at " + thisJoinPoint);
+ }
+}
+....
+
+When we run the test again we should see the output below:
+
+[source, text]
+....
+about to throw: 'java.lang.RuntimeException: expected exception' at throw(catch(Throwable))
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 1 seconds
+....
+
+Congratulations! You've just implemented the throw join point and PCD.
+This code isn't yet ready to be checked into any repository. It still
+has some rough edges that need to be smoothed. However, you've now added
+a new join point to the AspectJ language and a corresponding PCD to
+match it. This is a good time to take a break before moving on to part
+two.
+
+=== Part 2: Getting the signature of this new join point right
+
+We know that throw(catch(Throwable)) is not the right thing to be
+printing for the signature at this join point. What is the correct
+signature? At the beginning of the tutorial, we explained that the
+preferred design for the pcd was to have
+throw(StaticTypeOfExceptionThrown). In step 4, we set the type of the
+exception thrown to be 'Throwable'. Can we set this to be more accurate?
+Looking at the source code, it seems easy to identify the static type of
+the exception that is thrown:
+
+[source, java]
+....
+throw new RuntimeException("expected exception");
+....
+
+In the source code to a Java program there is a well-defined static type
+for the exception that is thrown. This static type is used for various
+stages of flow analysis to make sure that checked exceptions are always
+correctly handled or declared. The ThrowStatement class in our own
+compiler has a special field for exceptionType that stores the static
+type of the exception thrown. Unfortunately, this static type is much
+harder to recover from the corresponding bytecode. In this case we would
+need to do flow analysis to figure out what the static type is for the
+object on the top of the stack when the athrow instruction executes.
+This analysis can certainly be done. In fact this analysis is a small
+part of what every JVM must do to verify the type safety of a loaded
+classfile.
+
+However, the current AspectJ weaver doesn't do any of this analysis.
+There are many good reasons to extend it in this direction in order to
+optimize the code produced by the weaver. If we were really implementing
+this feature, this would be the time for a long discussion on the
+aspectj-dev list to decide if this was the right time to extend the
+weaver with the code flow analysis needed to support a static type for
+the throw join point. For the purposes of this tutorial, we're going to
+assume that it isn't the right time to do this (implementing flow
+analysis for bytecodes would add another 50 pages to this tutorial).
+Instead we're going to change the definition of the throw join point to
+state that its argument always has a static type of Throwable. We still
+allow dynamic matching in args to select more specific types. In
+general, good AspectJ code should use this dynamic matching anyway to
+correspond to good OO designs.
+
+==== Step 1. Change the signature of the throw pcd
+
+Since we aren't going to recover the static type of the exception
+thrown, we need to fix the parser for the throw pcd to remove this
+information. We'll fix the PatternParser code that we added in step 1.6
+to read as follows:
+
+[source, java]
+....
+} else if (kind.equals("throw")) {
+ parseIdentifier(); eat("(");
+ eat(")");
+ return new KindedPointcut(Shadow.Throw,
+ new SignaturePattern(Member.THROW, ModifiersPattern.ANY,
+ TypePattern.ANY, TypePattern.ANY, NamePattern.ANY,
+ TypePatternList.ANY,
+ ThrowsPattern.ANY));
+....
+
+Notice that this code also starts to fix the member kind to be
+Member.THROW instead of the bogus Member.HANDLER that we were using
+before. To make this work we have a set of things to do. First, let's
+create this new kind in org.aspectj.weaver.Member. Find where the
+HANDLER kind is defined there, and add a corresponding throw kind:
+
+[source, java]
+....
+public static final Kind THROW = new Kind("THROW", 8);
+....
+
+We also need to fix the serialization kind in
+Member.Kind.read(DataInputStream) just above this constant list to add a
+case for this new kind:
+
+[source, java]
+....
+case 8: return THROW;
+....
+
+Still in this file, we also need to fix Member.makeThrowSignature to use
+this new kind:
+
+[source, java]
+....
+public static Member makeThrowSignature(TypeX inType, TypeX throwType) {
+ return new ResolvedMember(
+ THROW,
+ inType,
+ Modifier.STATIC,
+ "throw",
+ "(" + throwType.getSignature() + ")V");
+}
+....
+
+If you run the test now you'll get an error from the parser reminding us
+that the throw pcd now doesn't accept a type pattern:
+
+[source, text]
+....
+------------ FAIL: simple throw join point()
+...
+C:\aspectj\eclipse\tests\design\pcds\Throws.java:19:0 Syntax error on token "*", ")" expected
+
+FAIL Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 failed) 1 seconds
+....
+
+This is an easy fix to the test case as we modify our pcd for the new
+syntax in the aspect A in our Throws.java test code:
+
+[source, java]
+....
+before(Throwable t): throw() && args(t) {
+....
+
+Now when we run the test case it looks like everything's fixed and we're
+passing:
+
+[source, text]
+....
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 2 seconds
+....
+
+==== Part 2. Make a real test case
+
+The pass result from running our test should worry you. Unlike previous
+runs, this test run doesn't show the output from our System.out.println
+in the before advice. So, it's clear this advice is not running. The
+problem is that even though the advice is not running, the test case is
+passing. We need to make this a real test case to fix this. We'll do
+that by adding code that notes when the advice runs and then checks for
+this event. This code uses the Tester.event and Tester.checkEvent
+methods:
+
+[source, java]
+....
+import org.aspectj.testing.Tester;
+
+public class Throws {
+ public static void main(String[] args) {
+ try {
+ willThrow();
+ Tester.checkFailed("should have thrown exception");
+ } catch (RuntimeException re) {
+ Tester.checkEqual("expected exception", re.getMessage());
+ }
+ Tester.checkEvents(new String[] { "before throw" });
+ }
+
+ static void willThrow() {
+ throw new RuntimeException("expected exception");
+ }
+}
+
+aspect A {
+ before(Throwable t): throw() && args(t) {
+ Tester.event("before throw");
+ //System.out.println("about to throw: '" + t+ "' at " + thisJoinPoint);
+ }
+}
+....
+
+Now when we run our test case it will fail. This failure is good because
+we're not matching the throw join point anymore.
+
+[source, text]
+....
+------------ FAIL: simple throw join point()
+...
+[ 1] [fail 0]: fail [ expected event "before throw" not found]
+
+FAIL Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 failed) 1 seconds
+....
+
+==== Step 3. Fix signature matching again
+
+In org.aspectj.weaver.patterns.SignaturePattern.matches, we need to
+handle throw signature matching the same way we handle advice signature
+matching. Both of these pcds match solely on the kind of join point and
+use combinations with other pcds to narrow their matches. So, find the
+line for kind == Member.ADVICE and add the same line below it for
+Member.THROW.
+
+[source, java]
+....
+if (kind == Member.ADVICE) return true;
+if (kind == Member.THROW) return true;
+....
+
+This change will make our test case pass again. Run it to be sure.
+
+There's an interesting tension between a good automated test and a good
+test for development. Our new test case now correctly includes an
+automated test to let us know when we are and are not matching the new
+throw join point. However, without the println the test doesn't feel as
+satisfactory to me to run during development. I often like to turn this
+kind of printing back on the see what's happening. If you uncomment to
+System.out.println in the test aspect A and rerun the test, you won't be
+very happy with the results:
+
+[source, text]
+....
+------------ FAIL: simple throw join point()
+...
+unimplemented
+java.lang.RuntimeException: unimplemented
+ at org.aspectj.weaver.Member.getSignatureString(Member.java:596)
+...
+
+FAIL Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 failed) 1 seconds
+....
+
+It looks like there's more work to do to add the new member kind for
+Member.THROW. This problem only shows up when we try to print
+thisJoinPoint. It's showing that we haven't updated the reflection API
+to understand this new signature kind.
+
+==== Step 4. Extend org.aspectj.lang.reflect to understand throw signatures
+
+We need to add a couple of classes to the reflection API to implement
+the throw signature. Because we decided at the beginning of this section
+to not include the static type of the exception thrown in the throw
+signature, these classes are extremely simple. Nevertheless, we have to
+build them. Notice that when we add new source files to the system we
+need to include the standard eclipse EPL license header.
+
+[source, java]
+....
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Jim Hugunin initial implementation
+ * ******************************************************************/
+
+package org.aspectj.lang.reflect;
+import org.aspectj.lang.Signature;
+
+public interface ThrowSignature extends Signature { }
+....
+
+[source, java]
+....
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Jim Hugunin initial implementation
+ * ******************************************************************/
+
+package org.aspectj.runtime.reflect;
+import org.aspectj.lang.reflect.ThrowSignature;
+
+class ThrowSignatureImpl extends SignatureImpl implements ThrowSignature {
+
+ ThrowSignatureImpl(Class declaringType) {
+ super(0, "throw", declaringType);
+ }
+
+ ThrowSignatureImpl(String stringRep) {
+ super(stringRep);
+ }
+
+ String toString(StringMaker sm) {
+ return "throw";
+ }
+}
+....
+
+To finish up our work in the runtime module, we need to extend
+org.aspectj.runtime.reflect.Factory to add a factory method for this new
+signature kind:
+
+[source, java]
+....
+public ThrowSignature makeThrowSig(String stringRep) {
+ ThrowSignatureImpl ret = new ThrowSignatureImpl(stringRep);
+ ret.setLookupClassLoader(lookupClassLoader);
+ return ret;
+}
+....
+
+We're not done yet. We still need to fix up the
+org.aspectj.weaver.Member class to use these new methods and types and
+fix the unimplemented exception that started us down this road in the
+first place. First let's add a method to create a string for the throw
+signature. This is a very simple method copied from the other
+create*SignatureString methods.
+
+[source, java]
+....
+private String getThrowSignatureString(World world) {
+ StringBuffer buf = new StringBuffer();
+ buf.append('-'); // no modifiers
+ buf.append('-'); // no name
+ buf.append(makeString(getDeclaringType()));
+ buf.append('-');
+ return buf.toString();
+}
+....
+
+Now we need to modify three methods to add cases for the new
+Member.THROW kind. First, Member.getSignatureMakerName add:
+
+[source, java]
+....
+} else if (kind == THROW) {
+ return "makeThrowSig";
+....
+
+Next, to Member.getSignatureType add:
+
+[source, java]
+....
+} else if (kind == THROW) {
+ return "org.aspectj.lang.reflect.ThrowSignature";
+....
+
+Finally, to Member.getSignatureString add:
+
+[source, java]
+....
+} else if (kind == THROW) {
+ return getThrowSignatureString(world);
+....
+
+With all of these changes in place we should have working code for
+thisJoinPoint reflection using our new join point and signature kinds.
+Rerun the test to confirm:
+
+[source, text]
+....
+about to throw: 'java.lang.RuntimeException: expected exception' at throw(throw)
+PASS Suite.Spec(c:\aspectj\eclipse\tests) 1 tests (1 passed) 1 seconds
+....
+
+==== Step 5. Extend the test for automated coverage of reflection
+
+Modify the before advice to include at least minimal checks of the new
+reflective information:
+
+[source, java]
+....
+before(Throwable t): throw() && args(t) {
+ Tester.event("before throw");
+ Tester.checkEqual(thisJoinPoint.getSignature().toShortString(), "throw");
+ Tester.checkEqual(t.getMessage(), "expected exception");
+}
+....
+
+As usual, you should rerun the tests and make sure they pass.
+
+With these changes to the reflection code, it looks like we have a
+working version of the throw join point and there are no obvious pieces
+that we've skipped. Take a break before proceeding to the final phase of
+tests.
+
+=== Part 3: More serious testing
+
+Now it's time to get a decent testing story. The test work that we will
+do here is probably too little for adding a new join point to the
+aspectj language; however, it should at least give you a sense of what's
+involved.
+
+==== Step 1. Run the test suite again
+
+Rerun the tests you ran at the beginning of part 1. Any failures that
+occur should be resolved at this point. At the time of writing this
+tutorial, I found 31 failures in the BcWeaverModuleTests. These failures
+are for all of the test cases that check the exact set of shadows
+produces by a given program. These test cases need to be updated based
+on the new join point we're adding. These particular test cases will
+probably be removed from the AspectJ test suite very soon because
+they've shown themselves to be very fragile over time and they often
+break for changes that are not introducing new bugs. However, you should
+be aware of this kind of failure because you may find it in other unit
+tests.
+
+You should expect to see at least one other test case fail when you run
+ajcTests.xml. Here's the failure message:
+
+[source, text]
+....
+------------ FAIL: validate (enclosing) join point and source locations()
+...
+[ 1] [fail 0]: fail [ unexpected event "before AllTargetJoinPoints throw(throw)" found]
+....
+
+Most of this message can be ignored. To find out what went wrong you
+should look for messages that have "fail" in them. The last line tells
+you what happened. There was an unexpected event, "before
+AllTargetJoinPoints throw(catch(Throwable))". This is the signature for
+one of the new throw join points that we added in part 1. How could an
+existing test case match this new join point? The failing test case uses
+'within(TargetClass)' to collect information about ALL join points that
+are lexically within a given class. Whenever we add a new kind of join
+point to the language we will extend the set of points matched by pcds
+like within. This means that these changes need to be very prominently
+noted in the release notes for any AspectJ release. Since we're not
+writing documentation in this tutorial, we will move on an fix the test
+case.
+
+==== Step 2. Fix the failing test case
+
+Now we need to fix this failing test case. The first step is to copy the
+test specification into our local myTests.xml file. The easiest way to
+do this is to copy the title of the failing test from the output buffer,
+then open ajcTests.xml and use find to search for this title. Then copy
+the xml spec for this one test into myTests.xml. Finally, run
+myTests.xml to make sure you got the failing test. You should see the
+same failure as before in step 1, but you should see it a lot faster
+because we're only running 2 tests.
+
+To fix the test we need to find the source code. If you look at the test
+specification, you can see that the source file is the new directory
+with the name NegativeSourceLocation.java. Looking at the bottom of this
+file, we see a large list of expected events. These are the join points
+that we expect to see. If we look back up in TargetClass, we can see
+that the only occurence of throw is just before the handler for
+catch(Error) and right after the call to new Error. We should add our
+new expected event between these two:
+
+[source, text]
+....
+, "before AllTargetJoinPoints call(java.lang.Error(String))"
+, "before AllTargetJoinPoints throw(throw)" // added for new throw join point
+, "before AllTargetJoinPoints handler(catch(Error))"
+....
+
+Run the test suite again to see that this test now passes.
+
+==== Step 3. Extend test coverage to after advice
+
+There is a lot we should do now to extend test coverage for this new
+kind of join point. For the purpose of this tutorial, we're just going
+to make sure that the new join point kind is compatible with all 5 kinds
+of advice. Let's extend our current simple Throws test to check for
+before and the three kinds of after advice:
+
+[source, java]
+....
+import org.aspectj.testing.Tester;
+
+public class Throws {
+ public static void main(String[] args) {
+ try {
+ willThrow(true);
+ Tester.checkFailed("should have thrown exception");
+ } catch (RuntimeException re) {
+ Tester.checkEqual("expected exception", re.getMessage());
+ }
+ Tester.checkEvents(new String[]
+ { "before throw", "after throwing throw", "after throw" });
+ }
+
+ static void willThrow(boolean shouldThrow) {
+ int x;
+ if (shouldThrow) throw new RuntimeException("expected exception");
+ else x = 42;
+ System.out.println("x = " + x);
+ }
+}
+
+aspect A {
+ before(Throwable t): throw() && args(t) {
+ Tester.event("before throw");
+ Tester.checkEqual(thisJoinPoint.getSignature().toShortString(), "throw");
+ Tester.checkEqual(t.getMessage(), "expected exception");
+ }
+
+ after() returning: throw() {
+ Tester.checkFailed("shouldn't ever return normally from a throw");
+ }
+
+ after() throwing(RuntimeException re): throw() {
+ Tester.event("after throwing throw");
+ Tester.checkEqual(re.getMessage(), "expected exception");
+ }
+
+ after(): throw() {
+ Tester.event("after throw");
+ }
+}
+....
+
+Run this test to confirm that it still passes. This is a very nice
+property of the orthogonality of the implementation of join points and
+advice. We never had to do any implementation work to make our new join
+point kind work for before and all three kinds of after advice.
+
+==== Step 4. Look at around advice on throw join points
+
+Let's create a new test case to see how this new join point interacts
+with around advice.
+
+[source, java]
+....
+import org.aspectj.testing.Tester;
+
+public class AroundThrows {
+ public static void main(String[] args) {
+ try {
+ willThrow(true);
+ Tester.checkFailed("should have thrown exception");
+ } catch (RuntimeException re) {
+ Tester.checkEqual("expected exception", re.getMessage());
+ }
+ }
+
+ static void willThrow(boolean shouldThrow) {
+ int x;
+ if (!shouldThrow) x = 42;
+ else throw new RuntimeException("expected exception");
+ System.out.println("x = " + x);
+ }
+}
+
+aspect A {
+ void around(): throw() {
+ System.out.println("about to throw something");
+ proceed();
+ }
+}
+....
+
+When we run this test case we get a very unpleasant result:
+
+[source, text]
+....
+------------ FAIL: simple throw join point with around()
+...
+[ 1] --- thrown
+java.lang.VerifyError: (class: AroundThrows, method: willThrow signature: (Z)V) Accessing value from uninitialized register 1
+...
+FAIL Suite.Spec(c:\aspectj\eclipse\tests) 3 tests (1 failed, 2 passed) 3 seconds
+....
+
+A VerifyError at runtime is the second worst kind of bug the AspectJ
+compiler can produce. The worst is silently behaving incorrectly.
+
+Unfortunately, this VerifyError is either impossible or very hard to
+fix. Think about what would happen if the around advice body didn't call
+proceed. In this case the local variable x would in fact be
+uninitialized. There is another serious language design question here,
+and for a real implementation this would once again be the time to start
+a discussion on the aspectj-dev mailing list to reach consensus on the
+best design. For the purpose of this tutorial we're once again going to
+make the language design choice that is easiest to implement and press
+on.
+
+==== Step 5. Prohibit around advice on this new join point kind
+
+The easiest solution to implement is to prohibit around advice on throw
+join points. There are already a number of these kinds of rules
+implemented in the org.aspectj.weaver.Shadow.match(Shadow, World)
+method. We can add our new rule at the beginning of the if(kind ==
+AdviceKind.Around) block:
+
+[source, java]
+....
+} else if (kind == AdviceKind.Around) {
+ if (shadow.getKind() == Shadow.Throw) {
+ world.showMessage(IMessage.ERROR,
+ "around on throw not supported (possibly compiler limitation)",
+ getSourceLocation(), shadow.getSourceLocation());
+ return false;
+ }
+....
+
+Now if we rerun our test we'll see errors telling us that around is
+prohibited on throw join points:
+
+[source, text]
+....
+------------ FAIL: simple throw join point with around()
+...
+[ 0] [error 0]: error at C:\aspectj\eclipse\tests\design\pcds\AroundThrows.java:22 around on throw not supported (possibly compiler limitation)
+[ 0] [error 1]: error at C:\aspectj\eclipse\tests\design\pcds\AroundThrows.java:16 around on throw not supported (possibly compiler limitation)
+...
+FAIL Suite.Spec(c:\aspectj\eclipse\tests) 3 tests (1 failed, 2 passed) 3 seconds
+....
+
+To finish this test case up we need to modify the specification to be
+looking for these errors as the correct behavior. This will produce the
+following specification:
+
+[source, xml]
+....
+<ajc-test dir="design/pcds"
+ title="simple throw join point with around">
+ <compile files="AroundThrows.java">
+ <message kind="error" line="16"/>
+ <message kind="error" line="22"/>
+ </compile>
+</ajc-test>
+....
+
+Run myTests.xml one last time to see both tests passing.
+
+==== Step 6. Final preparations for a commit or patch
+
+You probably want to stop here for the purposes of this tutorial. We've
+pointed out several language design decisions that would need to be
+resolved before actually adding a throw join point to AspectJ. Some of
+those might involve a large amount of additional implementation work. If
+this was actually going into the tree, it would also be important to add
+several more test cases exploring the space of what can be done with
+throw.
+
+Assuming those issues were resolved and you are ready to commit this new
+feature to the tree there are three steps left to follow:
+
+. Move our new test specifications from myTests.xml to the end of
+ajcTests.xml
+. Rerun ajcTests.xml and the unit tests to ensure everything's okay.
+. Update from the repository to get any changes from other committers
+since you started work on this new feature.
+. Rerun ajcTests.xml and the unit tests to make sure nothing broke as a
+result of the update.
+. Finally you can commit these changes to the AspectJ tree.
diff --git a/docs/modules/ROOT/pages/developer/design-XReweavable.doc b/docs/modules/ROOT/pages/developer/design-XReweavable.doc
new file mode 100644
index 000000000..6767e0da7
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/design-XReweavable.doc
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/design-overview.adoc b/docs/modules/ROOT/pages/developer/design-overview.adoc
new file mode 100644
index 000000000..06d00d83a
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/design-overview.adoc
@@ -0,0 +1,30 @@
+= AspectJ Design Overview
+:doctype: book
+
+Here are some sobering words:
+
+"Although it is essential to upgrade software to prevent aging, changing software can cause a different form of
+aging. The designer of a piece of software usually had a simple concept in mind when writing the program. If the
+program is large, understanding the concept allows one to find those sections of the program that must be altered
+when an update or correction is needed. Understanding that concept also implies understanding the interfaces used
+within the system and between the system and its environment. Changes made by people who do not understand the
+original design concept almost always cause the structure of the program to degrade. Under those circumstances,
+changes will be inconsistent with the original concept; in fact, they will invalidate the original concept. Sometimes
+the damage is small, but often it is quite severe. After those changes, one must know both the original design rules
+and the newly introduced exceptions to the rules, to understand the product. After many such changes, the original
+designers no longer understand the product. Those who made the changes, never did. In other words, *nobody*
+understands the modified product." +
+ +
+Software that has been repeatedly modified (maintained) in this way becomes very expensive to update. Changes take
+longer and are more likely to introduce new 'bugs'."
+-- David Parnas on "Ignorant Surgery" in his paper on Software Aging
+
+////
+ATTENTION: Please do not remove blank lines in between 'include::' statements. Otherwise, section numbers in the
+table of contents (TOC) can be wrong and the first section of each document missing completely.
+////
+include::compiler-weaver.adoc[Guide for Developers of the AspectJ Compiler and Weaver]
+
+include::modules.adoc[Module Structure]
+
+include::language.adoc[Language Design]
diff --git a/docs/modules/ROOT/pages/developer/images/EclipseSoftwareSitesAJDT.png b/docs/modules/ROOT/pages/developer/images/EclipseSoftwareSitesAJDT.png
new file mode 100644
index 000000000..9ab1e13b3
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/EclipseSoftwareSitesAJDT.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/advice-dec.png b/docs/modules/ROOT/pages/developer/images/advice-dec.png
new file mode 100644
index 000000000..4261f8b10
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/advice-dec.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/ajdt-uml.png b/docs/modules/ROOT/pages/developer/images/ajdt-uml.png
new file mode 100644
index 000000000..a8ac5b410
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/ajdt-uml.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/ajdt-uml.vsd b/docs/modules/ROOT/pages/developer/images/ajdt-uml.vsd
new file mode 100644
index 000000000..d3fa03dea
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/ajdt-uml.vsd
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/overview.png b/docs/modules/ROOT/pages/developer/images/overview.png
new file mode 100644
index 000000000..f03e01c9f
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/overview.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/overview.vsd b/docs/modules/ROOT/pages/developer/images/overview.vsd
new file mode 100644
index 000000000..5636872df
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/overview.vsd
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/pointcut-dec.png b/docs/modules/ROOT/pages/developer/images/pointcut-dec.png
new file mode 100644
index 000000000..a59676d66
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/pointcut-dec.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/images/top-tree.png b/docs/modules/ROOT/pages/developer/images/top-tree.png
new file mode 100644
index 000000000..51632c435
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/images/top-tree.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/index.adoc b/docs/modules/ROOT/pages/developer/index.adoc
new file mode 100644
index 000000000..a358948b3
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/index.adoc
@@ -0,0 +1,26 @@
+= AspectJ Design Overview
+:doctype: book
+
+Here are some sobering words:
+
+"Although it is essential to upgrade software to prevent aging, changing software can cause a different form of
+aging. The designer of a piece of software usually had a simple concept in mind when writing the program. If the
+program is large, understanding the concept allows one to find those sections of the program that must be altered
+when an update or correction is needed. Understanding that concept also implies understanding the interfaces used
+within the system and between the system and its environment. Changes made by people who do not understand the
+original design concept almost always cause the structure of the program to degrade. Under those circumstances,
+changes will be inconsistent with the original concept; in fact, they will invalidate the original concept. Sometimes
+the damage is small, but often it is quite severe. After those changes, one must know both the original design rules
+and the newly introduced exceptions to the rules, to understand the product. After many such changes, the original
+designers no longer understand the product. Those who made the changes, never did. In other words, *nobody*
+understands the modified product." +
+ +
+Software that has been repeatedly modified (maintained) in this way becomes very expensive to update. Changes take
+longer and are more likely to introduce new 'bugs'."
+-- David Parnas on "Ignorant Surgery" in his paper on Software Aging
+
+**Table of Contents**
+
+* xref:compiler-weaver/index.adoc[Guide for Developers of the AspectJ Compiler and Weaver]
+* xref:modules.adoc[Module Structure]
+* xref:language.adoc[Language Design]
diff --git a/docs/modules/ROOT/pages/developer/language.adoc b/docs/modules/ROOT/pages/developer/language.adoc
new file mode 100644
index 000000000..28a3f7548
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/language.adoc
@@ -0,0 +1,81 @@
+== AspectJ Language Design
+
+=== User-suggested New Language Features
+
+* `-` wildcard
+** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00717.html
+** https://bugs.eclipse.org/bugs/show_bug.cgi?id=34054#c2
+
+* Class cast pointcut
+** https://dev.eclipse.org/mhonarc/lists/aspectj-users/msg01479.html
+
+* Extensible pointcuts, abstract pointcuts, and interfaces
+** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00458.html
+** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00467.html +
+
+=== Key Language Design Properties
+
+==== Orthogonal join point model
+
+The different kinds of join
+points, the different primitive pointcuts, and the different kinds of
+advice can be used in any combination.
+
+This was one of the hardest parts of the design to get right, because of
+the "constructor must call super" rule in Java. But we finally got this
+in 1.0.
+
+==== Pointcuts support composition and abstraction
+
+Abelson and Sussman
+say that composition and abstraction are the key elements of a real
+language. Clearly the pointcut mechanism is the new thing in AspectJ,
+and so it was critical that it support composition and abstraction. The
+fact that someone can write:
+
+[source, java]
+----
+/* define an abstraction called stateChange */
+pointcut stateChange(): call(void FigureElement+.set*(*));
+
+/* compose pointcuts to get other pointcuts */
+pointcut topLevelStateChange(): stateChange() && !cflowbelow(stateChange());
+----
+
+is what makes it possible for people to really work with crosscutting
+structure and make their code more clear.
+
+==== Statically type checked
+
+The efficiency, code quality and programmer
+productivity arguments for this have been made elsewhere, so I won't
+repeat them.
+
+==== Efficient
+
+AspectJ code is as fast as the equivalent functionality,
+written by hand, in a scattered and tangled way.
+
+==== Simple kernel
+
+I've heard some people say that AspectJ is too big
+and too complex. In the most important sense of simple AspectJ is
+simple. I can reason about any AspectJ program with a simple model. The
+kernel of AspectJ is simple, and the orthogonality described above means
+that its easy to start with just the kernel and slowly add to that.
+
+Its pretty clear to pull out this kernel of AspectJ. I would argue that
+the right idea for a standard AOP API
+is this kernel, packaged in a way that allows building more
+sophisticated tools on top of it.
+
+==== Supports multiple weave times
+
+AspectJ is neutral on whether weaving
+happens at pre-process, compile, post-process, load, JIT or runtime.
+This neutrality is critical. Its why there are serious JVM experts who
+are already thinking about JVM support for AspectJ.
+
+There's more, but I think these are the most important ones. I think any
+functionality this group comes up with should also meet these
+criteria.
diff --git a/docs/modules/ROOT/pages/developer/modules.adoc b/docs/modules/ROOT/pages/developer/modules.adoc
new file mode 100644
index 000000000..74292212b
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/modules.adoc
@@ -0,0 +1,77 @@
+== AspectJ Modules
+
+There are a number of different structures [Parnas]: "the module structure, the uses structure, the runtime structure,
+..." This document overviews module structure and summarizes what is hidden by each. For detailed documentation refer to
+the individual module sources and docs available via CVS.
+
+=== Core Modules
+
+*CVS Location:* dev.eclipse.org:/cvsroot/technology/org.aspectj/modules
+
+To set up for building, one need only check out the module directories within the `modules/` directory. In Eclipse,
+check out each module into the workspace as a project. (Note: module dependencies may change at any time, so this
+documentation might be out of date. The Eclipse .classpath files specify the module dependencies, even when using Ant to
+build outside of Eclipse.)
+
+|===
+| *Module* | *Dependencies* | *Description*
+
+| ajde | asm, bridge, org.aspectj.ajdt.core, org.eclipse.jdt.core, util | Hides the details of accessing the AspectJ
+compiler and interpreting compilation results (error messages, structure model, etc.) from other applications (typically
+IDEs) that need to invoke it programmatically. Changing any public interface in ajde can break all the IDE integration
+projects and should be done with care. +
+ +
+It also contains a library of common swing user interface components that can be used by any swing based IDE. The
+non-eclipse IDE integration projects use this library (except for the emacs support).
+
+| asm | bridge | Contains the Abstract Structure Model, which represents the result of an aspectj compilation. Clients
+of ajde are returned an instance of the structure model which allows them to navigate and interpret the static structure
+of an aspectj program.
+
+| bridge | util | Contains an interface and implementation of classes realted to compiler messages including: source
+locations, handling, and formatting. Intended to minimize dependencies between testing, the compiler, and
+ajde.
+
+| org.aspectj.ajdt.core | asm, bridge, org.eclipse.jdt.core, runtime, testing-util, util, weaver | Front-end of the
+AspectJ compiler and extension of Eclipse's JDT compiler. Extends the JDT compiler's parsing and name resolution to
+understand AspectJ declarations. Also extends incremental behavior with understanding of AspectJ dependencies.
+
+| org.eclipse.jdt.core | | The Eclipse JDT compiler, slightly patched for AspectJ and stored in binary form to avoid
+accidental changes. Sources are available in CVS at dev.eclipse.org:/cvsroot/technology/org.aspectj/shadows.
+
+| runtime | | Small runtime library required for building and running AspectJ programs
+
+| taskdefs | bridge, org.aspectj.ajdt.core, util | Ant taskdef for the AspectJ compiler/weaver, ajc.
+
+| util | | Common utility classes including data type, file, and stream manipulation
+
+| weaver | asm, bridge, runtime, testing-util, util | Back-end of the AspectJ compiler, built on top of the BCEL
+bytecode toolkit. All advice planning and weaving is done here. Takes an aspect bytecode format and other Java
+classfiles as input.
+|===
+
+=== Supporting Modules
+
+*CVS Location:* dev.eclipse.org:/cvsroot/technology/org.aspectj/modules
+
+|===
+| *Module* | *Description*
+| build | Ant files, scripts, taskdefs required for building the AspectJ distribution. Also contains the GUI installer.
+| docs | Programmer and developer documentation
+| lib | Libraries required for building AspectJ
+| testing | Test support classes
+| testing-client | Client used for running the harness and reporting results
+| testing-drivers | Testing harness drivers and support classes
+| testing-util | Common testing utility classes used by the unit test suites in the core modules
+| tests | AspectJ test suite, including all language tests, regression tests, and test system sources
+|===
+
+=== Eclipse AspectJ Development Tools (AJDT)
+
+*CVS Location:* dev.eclipse.org:/cvsroot/technology/org.eclipse.ajdt/plugins/org.eclipse.ajdt
+
+|===
+| *Plug-in* | *Dependencies* | *Description*
+| org.eclipse.ajdt.ui | org.aspectj.ajde | AspectJ IDE support for Eclipse
+| org.aspectj.ajde | ajde, asm, bridge | AspectJ libraries plug-in
+|===
diff --git a/docs/modules/ROOT/pages/developer/ram-disk/maven.config b/docs/modules/ROOT/pages/developer/ram-disk/maven.config
new file mode 100644
index 000000000..25f3d294d
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/ram-disk/maven.config
@@ -0,0 +1 @@
+--settings R:/AspectJ/.mvn/settings-ramdisk.xml
diff --git a/docs/modules/ROOT/pages/developer/ram-disk/settings-ramdisk.xml b/docs/modules/ROOT/pages/developer/ram-disk/settings-ramdisk.xml
new file mode 100644
index 000000000..6957ca464
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/ram-disk/settings-ramdisk.xml
@@ -0,0 +1,68 @@
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <!--
+ RAM disk (RD) how-to:
+
+ 1. Make sure the cloned project moves its local Git repository to a place outside the working directory on a
+ physical drive:
+ # Remove the "_" in between the two dashes in "-_-", two dashes are forbidden inside XML tags
+ git init -_-separate-git-dir=../MyProject.git
+ This ensures that your local Git commits are not lost if the computer reboots unexpectedly, even if you did not
+ push those commits to a remote yet. Ideally, make the Git repository directory a sibling right beside the
+ actual working directory and give it the same name as the workdir + ".git", as shown above.
+
+ 2. Set up a RD, bind it to a drive letter (Windows) or mount it into an empty local folder (Linux, can also be
+ done on Windows). The RD should be big enough to house
+ - the project's working directory,
+ - all plugins, dependencies and artifacts needed and created by your Maven build,
+ - plus all the space needed during the build of your project for target folders, temporary files used while
+ creating assemblies or fat JARs, files created during tests etc.
+ On Windows, you might want to deactivate the Recycle Bin for the RAM disk drive. Screenshot
+ docs/developer/ram-disk/windows-recycle-bin-remove-immediately.png explains how to do that in English and
+ German.
+
+ 3. Make sure to commit all your changes before shutting down the RD and/or the computer. You can skip that step
+ (at your own risk), if you make sure to save the RD contents to a shapshot file before unmounting.
+ - On Windows, products like Dataram RAMDisk (free up to 1 GB, needs licence otherwise, limited to a single
+ mounted RD) can do that for you. With RAMMap, you can mount any number of drives and have no size limit
+ (other than physical RAM), but have to save snapshots manually.
+ - On Linux, setting up a RD should be easy with on-board means. Mounting, unmounting and saving snapshots can
+ be done via start/stop scripts, which optionally can also be integrated into the Linux start-up and
+ shutdown processes. You could even regularly save snapshots using a cron job.
+
+ 4. Copy the working directory to the root folder (e.g. R:/MyProject) of the RD and also create the base folder
+ specified here under "<localRepository>" for the local Maven repository.
+
+ 5. Copy this file to <workdir>/.mvn/settings-ramdisk.xml.
+
+ 6. Create a file <workdir>/.mvn/maven.config which will be found automatically by Maven - see
+ https://maven.apache.org/configure.html. Add this line, pointing Maven to this settings file with the
+ corresponding absolute path on your RD:
+ # Remove the "_" in between the two dashes in "-_-", two dashes are forbidden inside XML tags
+ -_-settings R:/MyProject/.mvn/settings-ramdisk.xml
+ Using relative paths will not work reliably, this Maven option will be added to each "mvn" call. So depending
+ on the current directory (e.g. submodule folder), you will get into trouble.
+
+ 7. Download all plugins Maven needs and do a full build, checking if your RD is big enough:
+ mvn dependency:go-offline
+ mvn clean install
+
+ 8. Enjoy, if the previous step was successful. Otherwise, start over with an increased RD size.
+
+ You may want to put .mvn/settings-ramdisk.xml and .mvn/maven.config on your project's .gitignore so as not to
+ commit them accidentally, if you or other project members do not permanently work with the RD or their
+ configuration differs. You may commit this file to another safe place in your project and put some information
+ into a development environment setup guide.
+ -->
+
+ <!-- Default - use if you want to switch to the default local Maven repo temporarily for some reason -->
+ <!--<localRepository>${user.home}/.m2/repository</localRepository>-->
+
+ <!-- RAM disk Windows -->
+ <localRepository>r:/.m2/repository</localRepository>
+
+ <!-- RAM disk Linux (Ubuntu via Windows Subsystem for Linux 2) -->
+ <!--<localRepository>/mnt/r/.m2/repository</localRepository>-->
+
+</settings>
diff --git a/docs/modules/ROOT/pages/developer/ram-disk/windows-recycle-bin-remove-immediately.png b/docs/modules/ROOT/pages/developer/ram-disk/windows-recycle-bin-remove-immediately.png
new file mode 100644
index 000000000..484bb7e25
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/ram-disk/windows-recycle-bin-remove-immediately.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/developer/traces/ajc_batchBuild_annotated.htm b/docs/modules/ROOT/pages/developer/traces/ajc_batchBuild_annotated.htm
new file mode 100644
index 000000000..50f1062c8
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/traces/ajc_batchBuild_annotated.htm
@@ -0,0 +1,2188 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="ajc_batchBuild_annotated_files/filelist.xml">
+<title>//Annotated trace of AjBuildManager</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Author> </o:Author>
+ <o:Template>Normal</o:Template>
+ <o:LastAuthor> </o:LastAuthor>
+ <o:Revision>6</o:Revision>
+ <o:TotalTime>1003</o:TotalTime>
+ <o:Created>2003-07-19T20:34:00Z</o:Created>
+ <o:LastSaved>2003-07-20T13:18:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>5956</o:Words>
+ <o:Characters>33953</o:Characters>
+ <o:Company>IBM</o:Company>
+ <o:Lines>282</o:Lines>
+ <o:Paragraphs>79</o:Paragraphs>
+ <o:CharactersWithSpaces>39830</o:CharactersWithSpaces>
+ <o:Version>10.4219</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:SpellingState>Clean</w:SpellingState>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:Compatibility>
+ <w:BreakWrappedTables/>
+ <w:SnapToGridInCell/>
+ <w:WrapTextWithPunct/>
+ <w:UseAsianBreakRules/>
+ </w:Compatibility>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Courier New";
+ mso-fareast-font-family:"Times New Roman";}
+span.SpellE
+ {mso-style-name:"";
+ mso-spl-e:yes;}
+span.GramE
+ {mso-style-name:"";
+ mso-gram-e:yes;}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 65.95pt 72.0pt 65.95pt;
+ mso-header-margin:35.4pt;
+ mso-footer-margin:35.4pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoPlainText><b style='mso-bidi-font-weight:normal'><span
+style='color:#339966'>//Annotated trace of <span class=SpellE>AjBuildManager.batchBuild</span>...
+for &quot;<span class=SpellE>ajc</span> <span class=SpellE>Hello.java</span>&quot;<o:p></o:p></span></b></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(<span class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild</span>(<o:p></o:p></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span><span
+class=SpellE>AjBuildConfig</span>, <span class=SpellE>IMessageHandler</span>)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>         </span><span
+style='mso-spacerun:yes'>          </span><span class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3,MessageHandler: no
+messages)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span><span
+class=SpellE>AjBuildConfig</span>, <span class=SpellE>IMessageHandler</span>, <span
+class=SpellE><span class=GramE>boolean</span></span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3,MessageHandler: no
+<span class=SpellE>messages,true</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// create an <span class=SpellE>AjState</span>
+instance to hold state associated with the build<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjState</span>(<span
+class=SpellE>AjBuildManager</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (<span class=SpellE>AjBuildManager</span>())<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjState</span>(<span
+class=SpellE>AjBuildManager</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// could we do an incremental build if we
+wanted to...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>boolean</span> org.aspectj.ajdt.internal.core.builder.AjState.prepareForNextBuild(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(<span
+class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjState.prepareForNextBuild(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=SpellE>AjBuildConfig</span>)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: false<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>     </span>// check that <span class=SpellE>aspectjrt.jar</span>
+is present on the <span class=SpellE>classpath</span> and has the right version<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(String <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.checkRtJar</span>(<span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(String
+<span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.checkRtJar</span>(<span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>     </span>// remember the build configuration<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.setBuildConfig(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                            </span><span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.setBuildConfig(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                            </span><span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// set up a new, empty structure model
+ready to receive the results of the compilation<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.setupModel</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Entering</span></span> execution(<span
+class=SpellE>StructureModel</span> <span class=SpellE>org.aspectj.asm.StructureModelManager.getStructureModel</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Exiting</span></span> execution(<span
+class=SpellE>StructureModel</span> <span class=SpellE>org.aspectj.asm.StructureModelManager.getStructureModel</span>())
+<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   </span><span
+class=GramE>return</span>: org.aspectj.asm.StructureModel@122cdb6<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// if there is a .<span class=SpellE>lst</span>
+file specified, make that the root (there isn't in this case)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(File
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getConfigFile()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// create a new <span class=SpellE>ProgramElementNode</span>
+for the root of the structure model<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.asm.ProgramElementNode</span>(String, <span
+class=SpellE>ProgramElementNode.Kind</span>, List)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=GramE>arguments</span> (&lt;root&gt;,java source file,[])<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.asm.ProgramElementNode</span>(String, <span
+class=SpellE>ProgramElementNode.Kind</span>, List))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.asm.StructureModel.setRoot</span>(<span class=SpellE>StructureNode</span>))
+arguments (&lt;root&gt;)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.asm.StructureModel.setRoot</span>(<span class=SpellE>StructureNode</span>))
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// give it an empty file map<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.asm.StructureModel.setFileMap</span>(<span
+class=SpellE>HashMap</span>)) arguments ({})<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>asm::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.asm.StructureModel.setFileMap</span>(<span
+class=SpellE>HashMap</span>)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// remember the model we just created<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.setStructureModel(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                         </span><span
+class=SpellE>StructureModel</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> (org.aspectj.asm.StructureModel@122cdb6)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.setStructureModel(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                         </span><span
+class=SpellE>StructureModel</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.setupModel</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// create a new BCEL World to use for the
+batch compile<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(</p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                                       </span>IMessageHandler))
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                       </span>arguments (MessageHandler:
+no messages)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='color:#339966;mso-ansi-language:
+DA'><span style='mso-spacerun:yes'>      </span></span><span style='color:#339966'>//
+get the <span class=SpellE>classpath</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(List
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getClasspath()) arguments
+()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(List
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getClasspath()) return: <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>[C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar<span class=GramE>, ...,</span>
+<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                         </span>C:\ColyerRoot\Programs\aspectj1.1b4\lib\aspectjrt.jar]<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// create the <span class=SpellE>BcelWorld</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelWorld</span>(List, <span class=SpellE>IMessageHandler</span>))
+<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span>
+([C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar, ... </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span>C:\ColyerRoot\Programs\aspectj1.1b4\lib\aspectjrt.jar]<span
+class=GramE>,<span class=SpellE>MessageHandler</span></span>: no messages)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// <span class=SpellE>superclass</span>
+constructor creates a new <span class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet</span>
+- this is a key data structure<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// <span class=SpellE>initialise</span>
+a <span class=SpellE>ClassPathManager</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.ClassPathManager</span>(List, <span
+class=SpellE>IMessageHandler</span>)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+class=GramE>arguments</span> <span style='color:blue'>([C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar,
+<span style='mso-spacerun:yes'>   </span><o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\i18n.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\sunrsasign.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\jsse.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\jce.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\charsets.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\classes,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\aspectjrt.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\dnsns.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\ldapsec.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\localedata.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\sunjce_provider.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>c:\ColyerRoot\Programs\aspectj1.1\lib\aspectjtools_g.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>c:\ColyerRoot\Programs\aspectj1.1\lib\aspectjtools.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>c:\ColyerRoot\Programs\aspectj1.1\lib\log4j-1.2.7.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>c:\ColyerRoot\Programs\aspectj1.1\lib<span
+class=GramE>, .,</span> <o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:144.0pt'><span style='color:blue'><span
+style='mso-spacerun:yes'>    </span>C:\ColyerRoot\Programs\aspectj1.1b4\lib\aspectjrt.jar]</span><span
+class=GramE>,<span class=SpellE>MessageHandler</span></span>: no messages)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span>// for each entry... validate and add<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.ClassPathManager.addPath</span>(String, <span
+class=SpellE>IMessageHandler</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span><span class=GramE>arguments</span>
+(C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar,MessageHandler: no messages)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.ClassPathManager.addPath</span>(String, <span
+class=SpellE>IMessageHandler</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                         
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.ClassPathManager</span>(List, <span
+class=SpellE>IMessageHandler</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelWorld</span>(List, <span class=SpellE>IMessageHandler</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// set the <span class=SpellE>XnoInline</span>
+option<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isXnoInline</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isXnoInline</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>return</span>: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.World.setXnoInline</span>(<span class=SpellE>boolean</span>))
+arguments (false)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.World.setXnoInline</span>(<span class=SpellE>boolean</span>))
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// create a new <span class=SpellE>BcelWeaver</span>
+for the world<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver</span>(<span class=SpellE>BcelWorld</span>))
+arguments (<span class=SpellE>BcelWorld</span>())<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>CrosscuttingMembersSet</span> <span class=SpellE>org.aspectj.weaver.World.getCrosscuttingMembersSet</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>CrosscuttingMembersSet</span> <span class=SpellE>org.aspectj.weaver.World.getCrosscuttingMembersSet</span>())
+<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>:
+org.aspectj.weaver.CrosscuttingMembersSet@1f3aa07<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver</span>(<span class=SpellE>BcelWorld</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// add each library in the <span
+class=SpellE>aspectpath</span> to the weaver (none in this case) using <span
+class=SpellE>BcelWeaver.addLibraryJarFile</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(List
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getAspectpath()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(List
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getAspectpath()) return:
+[]<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// configure the lint options<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(String <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintMode</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(String
+<span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintMode</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>: default<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(String <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintMode</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(String
+<span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintMode</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>: default<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(Lint <span
+class=SpellE>org.aspectj.weaver.World.getLint</span>()) arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(Lint <span
+class=SpellE>org.aspectj.weaver.World.getLint</span>()) return:
+org.aspectj.weaver.Lint@c832d2<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.Lint.loadDefaultProperties</span>()) arguments
+()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.Lint.loadDefaultProperties</span>()) return:
+null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(File
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintSpecFile()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(File
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getLintSpecFile()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// add each library in the <span
+class=SpellE>injars</span> to the weaver (none in this case) using <span
+class=SpellE>BcelWeaver.addJarFile</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getInJars</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(List <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getInJars</span>())
+return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// attempt to resolve &quot;<span
+class=SpellE>org.aspectj.lang.JoinPoint</span>&quot; to verify that all is well
+in the world<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>TypeX</span> <span class=SpellE>org.aspectj.weaver.TypeX.forName</span>(String))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span>// convert to signature string<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     </span><span
+style='mso-spacerun:yes'>     </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(String <span class=SpellE>org.aspectj.weaver.TypeX.nameToSignature</span>(String))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span><span class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.TypeX.nameToSignature</span>(String)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+style='mso-spacerun:yes'>         </span><span class=GramE>return</span>: <span
+class=SpellE>Lorg/aspectj/lang/JoinPoint</span>;<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span>// get the type for this signature,
+it's either a primitive, array, or an object<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>TypeX</span> <span class=SpellE>org.aspectj.weaver.TypeX.forSignature</span>(String))
+</p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                           </span>arguments
+(Lorg/aspectj/lang/JoinPoint;)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='color:#339966'><span
+style='mso-spacerun:yes'> </span></span><span style='color:#339966'><span
+style='mso-tab-count:1'>     </span><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>  </span>// <span class=GramE>its</span> an object
+signature, create a new <span class=SpellE>TypeX</span> to hold it<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.TypeX</span>(String)) arguments (<span
+class=SpellE>Lorg/aspectj/lang/JoinPoint</span>;)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.TypeX</span>(String))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>TypeX</span> <span class=SpellE>org.aspectj.weaver.TypeX.forSignature</span>(String))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                         
+</span><span class=GramE>return</span>: <span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>TypeX</span> <span class=SpellE>org.aspectj.weaver.TypeX.forName</span>(String))
+return: <span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// now we have a <span class=SpellE>TypeX</span>,
+resolve it<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(<span
+class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(<span
+class=SpellE>TypeX</span>, <span class=SpellE>boolean</span>)) </p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                           </span>arguments
+(org.aspectj.lang.JoinPoint,false)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='color:#339966;mso-ansi-language:
+FR'><span style='mso-spacerun:yes'>            </span></span><span
+style='color:#339966'>// get the signature<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.TypeX.getSignature</span>()) arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.TypeX.getSignature</span>()) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                            </span><span class=GramE>return</span>:
+<span class=SpellE>Lorg/aspectj/lang/JoinPoint</span>;<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>            </span>// <span class=GramE>its</span> not
+in our <span class=SpellE>typeMap</span>, so better look for it<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolveObjectType</span>(<span
+class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                             </span><span class=GramE>arguments</span>
+(<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>       </span><span
+style='mso-spacerun:yes'>       </span>// create a resolved type name<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name</span>(String, World)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span><span
+class=GramE>arguments</span> (<span class=SpellE>Lorg/aspectj/lang/JoinPoint;,BcelWorld</span>())<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name</span>(String, World))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>              </span>// and resolve it<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX.ConcreteName</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.resolveObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE>ResolvedTypeX.Name</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span><span
+class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>               </span><span
+style='mso-spacerun:yes'> </span>// look up the class in the <span
+class=SpellE>classpath</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>JavaClass</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE>ClassPathManager</span>, String)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span><span
+class=GramE>arguments</span> (C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar;...</p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                  </span>// find the file that defines
+the type<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ClassPathManager.ClassFile</span> <span class=SpellE>org.aspectj.weaver.bcel.ClassPathManager.find</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               
+</span><span class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                    </span>// look in the jars on the <span
+class=SpellE>classpath</span>...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(<span class=SpellE>ClassPathManager.ClassFile</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE><span class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipFileEntry.find</span></span><span
+class=GramE>(</span>String))</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>arguments</span> (<span
+class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(<span class=SpellE>ClassPathManager.ClassFile</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                              </span><span
+class=SpellE><span class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipFileEntry.find</span></span><span
+class=GramE>(</span>String)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                    </span>...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(<span class=SpellE>ClassPathManager.ClassFile</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE><span class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipFileEntry.find</span></span><span
+class=GramE>(</span>String)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                     </span><span
+class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(<span class=SpellE>ClassPathManager.ClassFile</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+style='mso-spacerun:yes'>          </span><span class=SpellE><span class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipFileEntry.find</span></span><span
+class=GramE>(</span>String)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+class=GramE>return</span>:
+org.aspectj.weaver.bcel.ClassPathManager$ZipEntryClassFile@139eeda<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ClassPathManager.ClassFile</span> <span
+style='mso-spacerun:yes'> </span></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                            </span><span
+class=SpellE><span class=GramE>org.aspectj.weaver.bcel.ClassPathManager.find</span></span><span
+class=GramE>(</span><span class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span><span
+class=GramE>return</span>:
+org.aspectj.weaver.bcel.ClassPathManager$ZipEntryClassFile@139eeda<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                  </span>// get the input stream and
+file path<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>InputStream</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                             </span><span
+class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipEntryClassFile.getInputStream(</span>))</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>InputStream</span> </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                            </span><span
+class=GramE>org.aspectj.weaver.bcel.ClassPathManager.ZipEntryClassFile.getInputStream(</span>))
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span><span
+class=GramE>return</span>: java.util.zip.ZipFile$1@1b4fad5<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String
+org.aspectj.weaver.bcel.ClassPathManager.ZipEntryClassFile.getPath()) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String
+org.aspectj.weaver.bcel.ClassPathManager.ZipEntryClassFile.getPath())</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>return</span>: org/<span
+class=SpellE>aspectj/lang/JoinPoint.class</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                  </span>// use <span class=SpellE>bcel.classfile.ClassParser</span>
+to parse the file and return a BCEL <span class=SpellE>JavaClass</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>JavaClass</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               
+</span><span class=SpellE>ClassPathManager</span>, String)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                              </span><span
+class=GramE>return</span>: <span style='color:blue'>public abstract interface <span
+class=SpellE>org.aspectj.lang.JoinPoint</span> extends <span class=SpellE>java.lang.Object</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'> </span><span
+style='mso-spacerun:yes'>                                     </span><span
+class=GramE>filename</span><span style='mso-tab-count:2'>        </span>org/<span
+class=SpellE>aspectj/lang/JoinPoint.class</span><span
+style='mso-spacerun:yes'>   </span><span
+style='mso-spacerun:yes'>                                  </span><br>
+<span style='mso-spacerun:yes'>  </span><span class=GramE>compiled</span> from<span
+style='mso-tab-count:2'>         </span><span class=SpellE>JoinPoint.java</span><br>
+<span style='mso-spacerun:yes'>  </span><span class=GramE>compiler</span>
+version<span style='mso-tab-count:1'>      </span>46.0<br>
+<span style='mso-spacerun:yes'>  </span><span class=GramE>access</span> flags<span
+style='mso-tab-count:2'>          </span>1537<br>
+<span style='mso-spacerun:yes'>  </span><span class=GramE>constant</span> pool<span
+style='mso-tab-count:2'>         </span>62 entries<br>
+<span style='mso-spacerun:yes'>  </span>ACC_SUPER flag<span style='mso-tab-count:
+2'>        </span>false<br>
+<br>
+<span style='mso-spacerun:yes'>  </span>Attribute(s):<br>
+<span style='mso-tab-count:1'>      </span><span style='mso-tab-count:6'>                                    </span><span
+class=SpellE><span class=GramE>SourceFile</span></span><span class=GramE>(</span><span
+class=SpellE>JoinPoint.java</span>)<br>
+<span style='mso-tab-count:1'>      </span><span style='mso-tab-count:6'>                                    </span><span
+class=SpellE>InnerClass<span class=GramE>:public</span></span> static abstract <o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:252.0pt;text-indent:36.0pt'><span
+class=SpellE><span style='color:blue'>org.aspectj.lang.JoinPoint$<span
+class=GramE>StaticPart</span></span></span><span class=GramE><span
+style='color:blue'>(</span></span><span style='color:blue'>&quot;<span
+class=SpellE>org.aspectj.lang.JoinPoint</span>&quot;, <span
+style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
+
+<p class=MsoPlainText style='margin-left:252.0pt;text-indent:36.0pt'><span
+style='color:blue'><span
+style='mso-spacerun:yes'>                                       </span>&quot;<span
+class=SpellE>StaticPart</span>&quot;)<br>
+<br>
+11 fields:<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String METHOD_EXECUTION = &quot;method-execution&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String METHOD_CALL = &quot;method-call&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String CONSTRUCTOR_EXECUTION = &quot;constructor-execution&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String CONSTRUCTOR_CALL = &quot;constructor-call&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String FIELD_GET = &quot;field-get&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String FIELD_SET = &quot;field-set&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String STATICINITIALIZATION = &quot;<span class=SpellE>staticinitialization</span>&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String PREINTIALIZATION = &quot;<span class=SpellE>preinitialization</span>&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String INITIALIZATION = &quot;initialization&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String EXCEPTION_HANDLER = &quot;exception-handler&quot;<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+static final String ADVICE_EXECUTION = &quot;advice-execution&quot;<br>
+<br>
+10 methods:<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract String <span class=SpellE>toString</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract String <span class=SpellE>toShortString</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract String <span class=SpellE>toLongString</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract Object <span class=SpellE>getThis</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract Object <span class=SpellE>getTarget</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract Object[] <span class=SpellE>getArgs</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract <span class=SpellE>org.aspectj.lang.Signature</span> <span
+class=SpellE>getSignature</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract <span class=SpellE>org.aspectj.lang.reflect.SourceLocation</span> <span
+class=SpellE>getSourceLocation</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract String <span class=SpellE>getKind</span>()<br>
+<span style='mso-tab-count:1'>      </span><span class=GramE>public</span>
+abstract <span class=SpellE>org.aspectj.lang.JoinPoint$StaticPart</span> <span
+class=SpellE>getStaticPart</span>()<br>
+</span><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                </span>// make the <span class=SpellE>JavaClass</span>
+into a <span class=SpellE>ResolvedTypeX.ConcreteName</span>...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.makeBcelObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>JavaClass</span>, <span
+class=SpellE><span class=GramE>boolean</span></span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span><span
+class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint,public</span>
+abstract interface ... <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.ConcreteName</span>(<span
+class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>boolean</span>)) </p>
+
+<p class=MsoPlainText style='margin-left:180.0pt'><span lang=FR
+style='mso-ansi-language:FR'><span style='mso-spacerun:yes'>     </span>arguments
+(org.aspectj.lang.JoinPoint,false)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.ConcreteName</span>(<span
+class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>boolean</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                                  
+</span><span class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>JavaClass</span>,
+<span class=SpellE><span class=GramE>boolean</span></span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>arguments</span> (<span class=SpellE>org.aspectj.lang.JoinPoint,public</span>
+abstract interface … <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                    </span>// remember the source
+context (file name, enclosing type, package name)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(<span class=SpellE>org.aspectj.weaver.bcel.BcelSourceContext</span>(<span
+class=SpellE>BcelObjectType</span>))</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>arguments</span>
+(org.aspectj.weaver.bcel.BcelObjectType@12a0f6c)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(<span class=SpellE>org.aspectj.weaver.bcel.BcelSourceContext</span>(<span
+class=SpellE>BcelObjectType</span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.setSourceContext</span>(</p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                               </span>ISourceContext))
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                     </span>arguments
+(org.aspectj.weaver.bcel.BcelSourceContext@5a9de6)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                    </span></span><span class=SpellE><span
+class=GramE>weaver::Exiting</span></span> execution(void <span class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.setSourceContext</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               </span><span
+class=SpellE>ISourceContext</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                     </span><span
+class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                    </span>// decode <span
+class=SpellE>pointcuts</span>, type <span class=SpellE>mungers</span>, <span
+class=GramE>declares, ...</span> stored as attributes in the class file<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.unpackAspectAttributes</span>())
+</p>
+
+<p class=MsoPlainText style='margin-left:180.0pt;text-indent:36.0pt'><span
+style='mso-spacerun:yes'> </span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(List <span class=SpellE>org.aspectj.weaver.bcel.BcelAttributes.readAjAttributes</span>(</p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                                   
+</span>Attribute[], ISourceContext)) <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                      </span>arguments
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                      </span>([Lorg.apache.bcel.classfile.Attribute;@1c9a690,<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                                      </span>org.aspectj.weaver.bcel.BcelSourceContext@5a9de6)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=FR style='mso-ansi-language:FR'><span
+style='mso-spacerun:yes'>                      </span></span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.bcel.BcelAttributes.readAjAttributes</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                            </span><span
+class=GramE>Attribute[</span>], <span class=SpellE>ISourceContext</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                      </span><span
+class=GramE>return</span>: []<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                   
+</span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.unpackAspectAttributes</span>())</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                     </span><span
+class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>JavaClass</span>, <span
+class=SpellE><span class=GramE>boolean</span></span>))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                  </span>// point the name to its
+resolved, concrete name<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.setDelegate</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                          </span><span
+class=SpellE>ResolvedTypeX.ConcreteName</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>arguments</span> (org.aspectj.weaver.bcel.BcelObjectType@12a0f6c)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.setDelegate</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                                
+</span><span class=SpellE>ResolvedTypeX.ConcreteName</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.makeBcelObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                              </span><span
+class=SpellE>ResolvedTypeX.Name</span>, <span class=SpellE>JavaClass</span>, <span
+class=SpellE><span class=GramE>boolean</span></span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span><span
+class=GramE>return</span>: org.aspectj.weaver.bcel.BcelObjectType@12a0f6c<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX.ConcreteName</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.resolveObjectType</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                                                       
+</span><span class=SpellE>ResolvedTypeX.Name</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>:
+org.aspectj.weaver.bcel.BcelObjectType@12a0f6c<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolveObjectType</span>(<span
+class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                            </span><span class=GramE>return</span>:
+<span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(<span
+class=SpellE>TypeX</span>, <span class=SpellE>boolean</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                         
+</span><span class=GramE>return</span>: <span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(<span
+class=SpellE>TypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>: <span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: <span class=SpellE>org.aspectj.lang.JoinPoint</span><o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span>// we
+now exit <span class=SpellE>initBcelWorld</span> and are going back to <span
+class=SpellE>doBuild</span>...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(void org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                        </span><span
+class=SpellE>IMessageHandler</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>                    </span><span class=GramE>return</span>:
+null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span>// do
+we need to build a structure model?<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(<span class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isEmacsSymMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(<span class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isEmacsSymMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(<span class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isGenerateModelMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(<span class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isGenerateModelMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span>//
+get the list of files to compile<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> </span><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'> </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getFiles</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(List <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildConfig.getFiles</span>())
+<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>        </span><span class=GramE>return</span>:
+[C:\Documents and Settings\<span class=SpellE>colyer\Hello.java</span>]<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span>//
+here we go! <span class=GramE>perform</span> the compilation...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> </span><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'> </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(List))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> ([C:\Documents and Settings\<span
+class=SpellE>colyer\Hello.java</span>])<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>   </span><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'> </span>//
+=======================================================================================<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>  </span>//
+details of compilation step in separate annotated trace<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>  </span>//
+=======================================================================================<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(void org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(List))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span>//
+record the fact that the compile succeeded<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> </span><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'> </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjState.successfulCompile</span>(<span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText style='margin-left:108.0pt'><span
+style='mso-spacerun:yes'>     </span><span class=GramE>arguments</span>
+(org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjState.successfulCompile</span>(<span
+class=SpellE>AjBuildConfig</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>  </span>// perform any
+weaving and output the <span class=SpellE>classfiles</span> to disk<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager</span>.</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                           </span><span
+class=SpellE><span class=GramE><b style='mso-bidi-font-weight:normal'>weaveAndGenerateClassFiles</b></span></span><span
+class=GramE>(</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                    
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>  </span>// <span
+class=GramE>add<span style='mso-spacerun:yes'>  </span>any</span> aspect class
+files in <span class=SpellE>AjState</span> to the weaver<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span></span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager</span>.</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                             </span><span
+class=SpellE><span class=GramE>addAspectClassFilesToWeaver</span></span><span
+class=GramE>(</span>List)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>arguments</span> ([<span class=SpellE>UnwovenClassFile</span>(C:\Documents
+and Settings\<span class=SpellE>colyer\Hello.class</span>, Hello)])<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.addClassFile</span>(<span
+class=SpellE>UnwovenClassFile</span>)) <o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+style='mso-spacerun:yes'>         </span><span class=GramE>arguments</span> (<span
+class=SpellE>UnwovenClassFile</span>(C:\Documents and Settings\<span
+class=SpellE>colyer\Hello.class</span>, Hello))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType</span>(<span
+class=SpellE>JavaClass</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> (public class Hello extends <span
+class=SpellE>java.lang.Object</span> …<br>
+<span style='color:#339966'><span style='mso-spacerun:yes'>          </span>//
+resolve the type (as before) and add to the type map<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span>// ...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType</span>(<span
+class=SpellE>JavaClass</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                       
+</span><span class=GramE>return</span>: org.aspectj.weaver.bcel.BcelObjectType@f1fad1<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.addClassFile</span>(<span
+class=SpellE>UnwovenClassFile</span>)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager</span>.</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                      </span><span
+class=SpellE><span class=GramE>addAspectClassFilesToWeaver</span></span><span
+class=GramE>(</span>List)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(Collection <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.prepareForWeave</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+style='color:#339966'>// get each class and resolve it<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// if this class is an aspect, we may
+need to reweave the world<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.isAspect</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+return: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.ResolvedTypeX.Name.isAspect</span>())
+return: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>     </span><span
+style='mso-spacerun:yes'>  </span>// get the list of entities to weave with<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getShadowMungers</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getShadowMungers</span>())
+return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getTypeMungers</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getTypeMungers</span>())
+return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getDeclareParents</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.CrosscuttingMembersSet.getDeclareParents</span>())
+return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.prepareForWeave</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>    </span>//
+for each file to be woven, reset its <span class=SpellE>BcelObjectType</span>
+state<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>return</span>:
+org.aspectj.weaver.bcel.BcelObjectType@f1fad1<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.resetState</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// set all member lists to null,
+then...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.unpackAspectAttributes</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.unpackAspectAttributes</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.resetState</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// first pass over all files, calling
+weave on their resolved types - generates list of applicable <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// inter-type <span class=SpellE>mungers</span></span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> </span><span
+style='mso-spacerun:yes'>     </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(<span class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>(<span
+class=SpellE>ResolvedTypeX</span>)) arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.clearInterTypeMungers</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.clearInterTypeMungers</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// process any declare parents (none in
+this case),<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// then go through list of inter-type <span
+class=SpellE>mungers</span> seeing if they match on this type<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>        </span>// add all matching inter-type <span
+class=SpellE>mungers</span> to the list for this type<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>(<span
+class=SpellE>ResolvedTypeX</span>)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// second pass, weaving into aspects...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>return</span>: org.aspectj.weaver.bcel.BcelObjectType@f1fad1<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>      </span>// not an aspect in this case so we do
+nothing<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+return: false<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// third pass, weaving into
+non-aspects...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(String <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getClassName</span>())
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+arguments (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>ResolvedTypeX</span> <span class=SpellE>org.aspectj.weaver.World.resolve</span>(String))
+return: Hello<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>BcelObjectType</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWorld.getBcelObjectType</span>(<span
+class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>:
+org.aspectj.weaver.bcel.BcelObjectType@f1fad1<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// not an aspect so weave...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isAspect</span>())
+return: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>LazyClassGen</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>(<span
+class=SpellE>UnwovenClassFile</span>, <span class=SpellE>BcelObjectType</span>))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> (<span class=SpellE>UnwovenClassFile</span>(C:\Documents
+and Settings\<span class=SpellE>colyer\Hello.class</span>, <span
+style='mso-spacerun:yes'> </span></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span>Hello)<span
+class=GramE>,org.aspectj.weaver.bcel.BcelObjectType@f1fad1</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>LazyClassGen</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                          </span><span
+class=SpellE>UnwovenClassFile</span>, <span class=SpellE>BcelObjectType</span>,
+<span class=SpellE><span class=GramE>boolean</span></span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span class=GramE>arguments</span> (<span class=SpellE>UnwovenClassFile</span>(C:\Documents
+and Settings\<span class=SpellE>colyer\Hello.class</span>, </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                        </span>Hello)<span
+class=GramE>,org.aspectj.weaver.bcel.BcelObjectType@f1fad1,true</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span>// is this an <span class=SpellE>ajc</span>
+generated type? (<span class=GramE>has</span> $<span class=SpellE>ajc</span> in
+name)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isSynthetic</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.isSynthetic</span>())
+return: false<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span>// get the <span class=SpellE>JavaClass</span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(<span class=SpellE>JavaClass</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.getJavaClass</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(<span
+class=SpellE>JavaClass</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelObjectType.getJavaClass</span>())
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                         
+</span><span class=GramE>return</span>: public class Hello extends <span
+class=SpellE>java.lang.Object</span> …<br>
+<span style='color:#339966'><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span>// get the set of shadow <span
+class=SpellE>mungers</span> that may match<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(List <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.fastMatch</span>(List,
+<span class=SpellE>ResolvedTypeX</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span><span class=GramE>arguments</span> ([],Hello)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(List <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.fastMatch</span>(List,
+<span class=SpellE>ResolvedTypeX</span>)) return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>   </span><span style='color:#339966'><span
+style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>  </span>// get
+the set of inter-type <span class=SpellE>mungers</span> defined for the type<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>  </span><span
+class=SpellE><span class=GramE>weaver::Entering</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.getInterTypeMungers</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>  </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(List <span
+class=SpellE>org.aspectj.weaver.ResolvedTypeX.getInterTypeMungers</span>())
+return: []<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>      </span>// if there were either shadow or inter-type
+<span class=SpellE>mungers</span> matching, we would call <span class=SpellE>BcelClassWeaver.weave</span>
+at this <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>   </span><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>   </span>// point, but there aren't for compiling
+hello world.<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>      </span>// dump out
+the class file<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span><span style='mso-spacerun:yes'>    </span></span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.dumpUnchanged</span>(<span
+class=SpellE>UnwovenClassFile</span>)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span><span class=GramE>arguments</span> (<span class=SpellE>UnwovenClassFile</span>(C:\Documents
+and Settings\<span class=SpellE>colyer\Hello.class</span>, Hello))<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeUnchangedBytes</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(byte[] <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getBytes</span>())
+arguments ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(byte[] <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.getBytes</span>())
+return: [B@15b55bc<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeWovenBytes</span>(byte[],
+List)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span><span
+class=GramE>arguments</span> ([B@15b55bc,[])<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeChildClasses</span>(List))
+</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>                               </span><span
+class=GramE>arguments</span> ([])<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Entering</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.deleteAllChildClasses</span>())
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.deleteAllChildClasses</span>())
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                  </span><span
+class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeChildClasses</span>(List))
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span><span
+class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>util::Entering</span></span>
+execution(<span class=SpellE>BufferedOutputStream</span> <span class=SpellE>org.aspectj.util.FileUtil.makeOutputStream</span>(File))
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span><span
+class=GramE>arguments</span> (C:\Documents and Settings\<span class=SpellE>colyer\Hello.class</span>)<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>            </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>util::Exiting</span></span>
+execution(<span class=SpellE>BufferedOutputStream</span> <span class=SpellE>org.aspectj.util.FileUtil.makeOutputStream</span>(File))
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                              </span><span
+class=GramE>return</span>: java.io.BufferedOutputStream@8c858a<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeWovenBytes</span>(byte[],
+List))</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                             </span><span
+style='mso-spacerun:yes'> </span><span class=GramE>return</span>: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>       </span><span
+style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span> execution(void <span
+class=SpellE>org.aspectj.weaver.bcel.UnwovenClassFile.writeUnchangedBytes</span>())
+return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span><span
+style='mso-spacerun:yes'>    </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(void <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.dumpUnchanged</span>(<span
+class=SpellE>UnwovenClassFile</span>)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     </span><span
+style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(<span class=SpellE>LazyClassGen</span> <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>(</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                </span><span
+style='mso-spacerun:yes'>                       </span><span class=SpellE>UnwovenClassFile</span>,
+<span class=SpellE>BcelObjectType</span>)) return: null<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+class=SpellE><span class=GramE>weaver::Exiting</span></span>
+execution(Collection <span class=SpellE>org.aspectj.weaver.bcel.BcelWeaver.weave</span>())
+return: [Hello]<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(<span class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager</span>.</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                   </span><span
+class=SpellE><span class=GramE>weaveAndGenerateClassFiles</span></span><span
+class=GramE>(</span>)) return: true<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>  </span>// should we
+generate structure model?<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'>  </span></span><span
+class=SpellE><span class=GramE>ajdtcore::Entering</span></span> execution(<span
+class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isGenerateModelMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span><span class=GramE>arguments</span> ()<o:p></o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='mso-spacerun:yes'>  </span><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(<span class=SpellE>boolean</span>
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.isGenerateModelMode()) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span><span class=GramE>return</span>: false<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+class=SpellE><span class=GramE>ajdtcore::Exiting</span></span> execution(<span
+class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span><span
+class=SpellE>AjBuildConfig</span>, <span class=SpellE>IMessageHandler</span>, <span
+class=SpellE><span class=GramE>boolean</span></span>)) return: true<o:p></o:p></p>
+
+<p class=MsoPlainText><span class=SpellE><span class=GramE>ajdtcore::Exiting</span></span>
+execution(<span class=SpellE>boolean</span> <span class=SpellE>org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild</span>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span><span
+class=SpellE>AjBuildConfig</span>, <span class=SpellE>IMessageHandler</span>))
+return: true</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/docs/modules/ROOT/pages/developer/traces/ajc_hello_annotated.htm b/docs/modules/ROOT/pages/developer/traces/ajc_hello_annotated.htm
new file mode 100644
index 000000000..d4577f302
--- /dev/null
+++ b/docs/modules/ROOT/pages/developer/traces/ajc_hello_annotated.htm
@@ -0,0 +1,951 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="ajc_hello_annotated_files/filelist.xml">
+<title>ajc command line, annotated trace</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Template>Normal</o:Template>
+ <o:LastAuthor> </o:LastAuthor>
+ <o:Revision>11</o:Revision>
+ <o:TotalTime>22</o:TotalTime>
+ <o:Created>2003-07-18T19:17:00Z</o:Created>
+ <o:LastSaved>2003-07-24T09:18:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>2539</o:Words>
+ <o:Characters>14475</o:Characters>
+ <o:Company>IBM</o:Company>
+ <o:Lines>120</o:Lines>
+ <o:Paragraphs>33</o:Paragraphs>
+ <o:CharactersWithSpaces>16981</o:CharactersWithSpaces>
+ <o:Version>10.4219</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:Compatibility>
+ <w:BreakWrappedTables/>
+ <w:SnapToGridInCell/>
+ <w:WrapTextWithPunct/>
+ <w:UseAsianBreakRules/>
+ </w:Compatibility>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+a:link, span.MsoHyperlink
+ {color:blue;
+ text-decoration:underline;
+ text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+ {color:purple;
+ text-decoration:underline;
+ text-underline:single;}
+p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Courier New";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 65.95pt 72.0pt 65.95pt;
+ mso-header-margin:35.4pt;
+ mso-footer-margin:35.4pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US link=blue vlink=purple style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoPlainText>This is an annotated trace of an ajc compilation of
+HelloWorld (no aspects involved).</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText>ajdtcore::Entering execution(void
+org.aspectj.tools.ajc.Main.main(String[])) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  
+</span>arguments ([Ljava.lang.String;@1ac1fe4)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>// ---------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>// create an ajc.Main instance...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>//
+---------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> 
+</span>ajdtcore::Entering execution(org.aspectj.tools.ajc.Main()) arguments ()</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='color:#339966'>// command controller is used for repeated compilations
+in incremental mode</span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>   
+</span>ajdtcore::Entering
+execution(org.aspectj.tools.ajc.Main.CommandController()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>   
+</span>ajdtcore::Exiting execution(org.aspectj.tools.ajc.Main.CommandController())</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// message handler is used to accumulate
+messages resulting from the compilation<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>   
+</span>bridge::Entering execution(org.aspectj.bridge.MessageHandler(boolean))
+arguments (true)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>bridge::Entering execution(void org.aspectj.bridge.MessageHandler.init(boolean))
+arguments (true)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>bridge::Exiting execution(void
+org.aspectj.bridge.MessageHandler.init(boolean)) return: null</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span>bridge::Exiting
+execution(org.aspectj.bridge.MessageHandler(boolean))\<br style='mso-special-character:
+line-break'>
+<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
+<![endif]></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span>ajdtcore::Exiting
+execution(org.aspectj.tools.ajc.Main())</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>//
+----------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>// run it!<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span>//
+----------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'> 
+</span>ajdtcore::Entering execution(void org.aspectj.tools.ajc.Main.runMain(String[],
+boolean)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                    
+</span>arguments ([Ljava.lang.String;@1ac1fe4,true)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>  </span>// set message
+verboseness according to presence of -verbose arg<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><o:p>&nbsp;</o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// run<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span>// -------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'> </span></span><span style='mso-spacerun:yes'>  
+</span>ajdtcore::Entering execution(void org.aspectj.tools.ajc.Main.run(String[],
+IMessageHolder)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span>arguments ([Ljava.lang.String;@1ac1fe4,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// initialise the command controller -
+strips out any incremental compilation options, leaving rest intact<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>ajdtcore::Entering execution(String[]
+org.aspectj.tools.ajc.Main.CommandController.init(String[],
+IMessageHandler))<span style='mso-spacerun:yes'>    </span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span>arguments ([Ljava.lang.String;@1ac1fe4,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// create a command object for
+compilation (an ICommand)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>bridge::Entering execution(ICommand
+org.aspectj.bridge.ReflectionFactory.makeCommand(String, IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span>arguments (org.aspectj.ajdt.ajc.<b style='mso-bidi-font-weight:normal'><span
+style='color:red'>AjdtCommand</span></b>,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>       </span><span
+style='mso-spacerun:yes'> </span>ajdtcore::Entering
+execution(org.aspectj.ajdt.ajc.AjdtCommand()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>       
+</span>ajdtcore::Exiting execution(org.aspectj.ajdt.ajc.AjdtCommand())</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        </span>...</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>bridge::Exiting execution(ICommand
+org.aspectj.bridge.ReflectionFactory.makeCommand(String, IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                     
+</span>return: org.aspectj.ajdt.ajc.AjdtCommand@11c8a71</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>//
+----------------------------------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>// run the command... all the
+command-line args except verbosity and incremental options are passed in<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>      </span>//
+----------------------------------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     
+</span>ajdtcore::Entering execution(boolean
+org.aspectj.ajdt.ajc.AjdtCommand.runCommand(String[], IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span>arguments ([Ljava.lang.String;@1ac1fe4,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      </span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+1'>      </span>// create a build manager that sends messages to the given
+message holder<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-tab-count:1'>      </span>ajdtcore::Entering
+execution(org.aspectj.ajdt.internal.core.builder.<b style='mso-bidi-font-weight:
+normal'><span style='color:red'>AjBuildManager</span></b>(IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span>arguments (MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><span style='mso-tab-count:1'>      </span>ajdtcore::Exiting
+execution(org.aspectj.ajdt.internal.core.builder.AjBuildManager(IMessageHandler))</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+1'>      </span>// call do-command - this handles both one-off and incremental
+(repeat) compiles<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-tab-count:1'>      </span>ajdtcore::Entering
+execution(boolean org.aspectj.ajdt.ajc.AjdtCommand.doCommand(IMessageHandler,
+boolean)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span><span lang=DA style='mso-ansi-language:DA'>arguments (MessageHandler: no
+messages,false)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><o:p>&nbsp;</o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='color:#339966;mso-ansi-language:
+DA'><span style='mso-spacerun:yes'>          </span></span><span
+style='color:#339966'>// create build configuration object for this build by
+parsing command-line arguments<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>         
+</span>ajdtcore::Entering execution(AjBuildConfig
+org.aspectj.ajdt.ajc.AjdtCommand.genBuildConfig(String[],</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                         </span>CountingMessageHandler))
+</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                             </span>arguments
+([Ljava.lang.String;@76cbf7,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+1'>      </span><span style='mso-spacerun:yes'>      </span>// create a build
+arg parser, this is actually a subclass of the eclipse batch compiler<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>            </span>// which is org.eclipse.jdt.internal.compiler.batch.Main<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>           
+</span>ajdtcore::Entering execution(org.aspectj.ajdt.ajc.<b style='mso-bidi-font-weight:
+normal'><span style='color:red'>BuildArgParser</span></b>()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>           
+</span>ajdtcore::Exiting execution(org.aspectj.ajdt.ajc.BuildArgParser())</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+1'>      </span><span style='mso-spacerun:yes'>      </span>// ask the parser
+to create the build configuration object<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>           
+</span>ajdtcore::Entering execution(<b style='mso-bidi-font-weight:normal'><span
+style='color:red'>AjBuildConfig</span></b>
+org.aspectj.ajdt.ajc.BuildArgParser.genBuildConfig(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                         
+</span>String[], IMessageHandler)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span>arguments
+([Ljava.lang.String;@76cbf7,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Entering
+execution(org.aspectj.ajdt.internal.core.builder.AjBuildConfig()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting
+execution(org.aspectj.ajdt.internal.core.builder.AjBuildConfig())</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             </span><span
+style='mso-spacerun:yes'> </span>ajdtcore::Entering
+execution(org.aspectj.ajdt.ajc.BuildArgParser.<b style='mso-bidi-font-weight:
+normal'><span style='color:red'>AjcConfigParser</span></b>(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                    </span><span
+lang=DA style='mso-ansi-language:DA'>BuildArgParser, AjBuildConfig,
+IMessageHandler)) <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                                 </span>arguments (</span><a
+href="mailto:org.aspectj.ajdt.ajc.BuildArgParser@126804e"><span lang=DA
+style='mso-ansi-language:DA'>org.aspectj.ajdt.ajc.BuildArgParser@126804e</span></a><span
+lang=DA style='mso-ansi-language:DA'>,<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                                            </span></span><a
+href="mailto:org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3"><span
+lang=DA style='mso-ansi-language:DA'>org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3</span></a><span
+lang=DA style='mso-ansi-language:DA'>,<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                                           
+</span>MessageHandler: no messages)<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>              </span>ajdtcore::Exiting
+execution(org.aspectj.ajdt.ajc.BuildArgParser.AjcConfigParser(<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                                            </span></span>BuildArgParser,
+AjBuildConfig, IMessageHandler))</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>util::Entering execution(void
+org.aspectj.util.ConfigParser.parseCommandLine(String[])) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                             </span>arguments
+([Ljava.lang.String;@76cbf7)</p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                </span>// build a linked list of
+arguments and then...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>   </span><span
+style='mso-spacerun:yes'>             </span>util::Entering execution(void
+org.aspectj.util.ConfigParser.parseArgs(LinkedList)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span>arguments
+([org.aspectj.util.ConfigParser$Arg@72ffb])</p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+2'>            </span><span style='mso-spacerun:yes'>    </span>// ajc options
+are handled by BuildArgParser.AjcConfigParser.parseOption<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>                </span>// all other args (source
+files, lst files, imported argfiles) are handled in ConfigParser superclass<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>               
+</span>util::Exiting execution(void
+org.aspectj.util.ConfigParser.parseArgs(LinkedList)) return: null</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>util::Exiting execution(void
+org.aspectj.util.ConfigParser.parseCommandLine(String[])) return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='color:#339966'><span style='mso-spacerun:yes'>          </span>// get
+the list of files to be compiled<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>    </span></span><span
+style='mso-spacerun:yes'>          </span>util::Entering execution(List
+org.aspectj.util.ConfigParser.getFiles()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span>util::Exiting execution(List
+org.aspectj.util.ConfigParser.getFiles()) return: </p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                   </span>[C:\Documents and
+Settings\colyer\Hello.java]<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>              </span>// get any remaining arguments...
+these will be passed up to the eclipse batch compiler<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>          </span>ajdtcore::Entering execution(List
+org.aspectj.ajdt.ajc.BuildArgParser.AjcConfigParser.getUnparsedArgs()) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span>arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(List
+org.aspectj.ajdt.ajc.BuildArgParser.AjcConfigParser.getUnparsedArgs()) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>return: []</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>              </span>// configure the batch compiler
+(superclass) with any as yet unparsed args<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>jdtcore::Entering execution(void
+org.eclipse.jdt.internal.compiler.batch.Main.configure(String[])) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>arguments
+([Ljava.lang.String;@1df38fd)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>jdtcore::Exiting execution(void
+org.eclipse.jdt.internal.compiler.batch.Main.configure(String[])) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                               </span>return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>    </span>// tell the AjBuildConfig what it has to
+build<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Entering execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setFiles(List)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span>arguments
+([C:\Documents and Settings\colyer\Hello.java])</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setFiles(List)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+1'>      </span><span style='mso-spacerun:yes'>        </span>// calculate the
+classpath for compilation<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Entering execution(List
+org.aspectj.ajdt.ajc.BuildArgParser.getClasspath(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                                  
+</span>BuildArgParser.AjcConfigParser)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                 </span>arguments
+(org.aspectj.ajdt.ajc.BuildArgParser$AjcConfigParser@126e85f)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>     </span><span
+style='mso-spacerun:yes'>         </span>...</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(List
+org.aspectj.ajdt.ajc.BuildArgParser.getClasspath(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                           
+</span>BuildArgParser.AjcConfigParser)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>return: </p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       </span>[C:\ColyerRoot\Programs\SunJDK141\jre\lib\rt.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\i18n.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\sunrsasign.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\jsse.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\jce.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\charsets.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\classes, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>     </span><span
+style='mso-spacerun:yes'>                   </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\aspectjrt.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\dnsns.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\ldapsec.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>            </span><span
+style='mso-spacerun:yes'>            </span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\localedata.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>C:\ColyerRoot\Programs\SunJDK141\jre\lib\ext\sunjce_provider.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>c:\ColyerRoot\Programs\aspectj1.1\lib\aspectjtools_g.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>        </span><span
+style='mso-spacerun:yes'>                </span>c:\ColyerRoot\Programs\aspectj1.1\lib\aspectjtools.jar,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>c:\ColyerRoot\Programs\aspectj1.1\lib\log4j-1.2.7.jar, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       
+</span>c:\ColyerRoot\Programs\aspectj1.1\lib, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                        </span>., <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>           </span><span
+style='mso-spacerun:yes'>             </span>C:\ColyerRoot\Programs\aspectj1.1b4\lib\aspectjrt.jar]<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>              </span>// tell the build config what we
+learnt...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-tab-count:1'>      </span><span
+style='mso-spacerun:yes'>        </span>ajdtcore::Entering execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setClasspath(List)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             </span><span
+style='mso-spacerun:yes'>                    </span>arguments (...)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setClasspath(List)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>              </span>// ensure we always generate
+debug info at this phase<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Entering execution(void
+org.aspectj.ajdt.ajc.BuildArgParser.setDebugOptions()) arguments ()</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(void
+org.aspectj.ajdt.ajc.BuildArgParser.setDebugOptions()) return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>         </span><span
+style='mso-spacerun:yes'>     </span>// give the build config the java options
+that were parsed by the eclipse batch compiler<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Entering execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setJavaOptions(Map)) </p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                       </span>arguments ( {org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.compliance=1.3, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.codegen.unusedLocal=optimize out, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.deprecation=ignore,<span
+style='mso-spacerun:yes'>                                               </span><span
+style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                              
+</span>unusedParameterWhenImplementingAbstract=disabled, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.unusedImport=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                  </span><span
+style='mso-spacerun:yes'>  </span>org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.debug.localVariable=generate, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.debug.sourceFile=generate, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>          </span><span
+style='mso-spacerun:yes'>                          </span>org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.debug.lineNumber=generate, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                 </span><span
+style='mso-spacerun:yes'>                   </span>org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.invalidImport=error, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.unreachableCode=error, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1, <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                                   
+</span>org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=ignore,
+<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:blue'><span
+style='mso-spacerun:yes'>                              </span><span
+style='mso-spacerun:yes'>      </span>org.eclipse.jdt.core.compiler.source=1.3})<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>             
+</span>ajdtcore::Exiting execution(void
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig.setJavaOptions(Map)) </p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                </span>return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>           
+</span>ajdtcore::Exiting execution(AjBuildConfig
+org.aspectj.ajdt.ajc.BuildArgParser.genBuildConfig(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                                        
+</span><span lang=DA style='mso-ansi-language:DA'>String[], IMessageHandler)) <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                              </span>return:
+org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3<o:p></o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    </span><span
+style='mso-spacerun:yes'>     </span>ajdtcore::Exiting execution(AjBuildConfig
+org.aspectj.ajdt.ajc.AjdtCommand.genBuildConfig(<o:p></o:p></p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                       </span>String[],
+CountingMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span>return: org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>  </span><span style='mso-tab-count:1'>    </span><span
+style='mso-spacerun:yes'>   </span>//
+------------------------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>         </span>// here we go... kick off a batch
+build, if we were in incremental mode this would be a call<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>         </span>// to AjBuildManager.incrementalBuild()
+instead<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>         </span>//
+------------------------------------------------------------------------------------------<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        
+</span>ajdtcore::Entering execution(boolean
+org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                         
+</span><span style='mso-spacerun:yes'>              </span><span lang=DA
+style='mso-ansi-language:DA'>AjBuildConfig, IMessageHandler)) <o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                            </span>arguments (</span><a
+href="mailto:org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3"><span
+lang=DA style='mso-ansi-language:DA'>org.aspectj.ajdt.internal.core.builder.AjBuildConfig@b1b4c3</span></a><span
+lang=DA style='mso-ansi-language:DA'>,<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span lang=DA style='mso-ansi-language:DA'><span
+style='mso-spacerun:yes'>                         </span><span
+style='mso-spacerun:yes'>              </span></span>MessageHandler: no
+messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+2'>            </span>// *********************************************<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+2'>            </span>// what happens here is captured separately!!<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>            </span>// see <a
+href="ajc_batchBuild_annotated.htm">ajc_batchBuild_annotated.htm</a><o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span style='mso-tab-count:
+2'>            </span>// *********************************************<o:p></o:p></span></p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>        
+</span>ajdtcore::Exiting execution(boolean org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(</p>
+
+<p class=MsoPlainText><span
+style='mso-spacerun:yes'>                                               
+</span>AjBuildConfig, IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                          
+</span>return: true</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>      
+</span>ajdtcore::Exiting execution(boolean
+org.aspectj.ajdt.ajc.AjdtCommand.doCommand(IMessageHandler, boolean)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                        
+</span>return: true</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    
+</span>ajdtcore::Exiting execution(boolean
+org.aspectj.ajdt.ajc.AjdtCommand.runCommand(String[], IMessageHandler)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                      
+</span>return: true</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>     </span>// and we're back in Main.run()...<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='color:#339966'><span
+style='mso-spacerun:yes'>     </span>// report the results of the compilation<o:p></o:p></span></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    
+</span>ajdtcore::Entering execution(boolean
+org.aspectj.tools.ajc.Main.report(boolean, IMessageHolder)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              
+</span>arguments (true,MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>    
+</span>ajdtcore::Exiting execution(boolean org.aspectj.tools.ajc.Main.report(boolean,
+IMessageHolder)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>              
+</span>return: true</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>  
+</span>ajdtcore::Exiting execution(void
+org.aspectj.tools.ajc.Main.run(String[], IMessageHolder)) return: null</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText>ajdtcore::Entering execution(void
+org.aspectj.tools.ajc.Main.systemExit(IMessageHolder)) </p>
+
+<p class=MsoPlainText><span style='mso-spacerun:yes'>                  
+</span>arguments (MessageHandler: no messages)</p>
+
+<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
+
+<p class=MsoPlainText><span style='color:#339966'>// its all over!<o:p></o:p></span></p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/docs/modules/ROOT/pages/examples/bean/BoundPoint.java b/docs/modules/ROOT/pages/examples/bean/BoundPoint.java
new file mode 100644
index 000000000..36c85819c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/bean/BoundPoint.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1998-2002 Xerox Corporation,
+ * 2004 Contributors. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and Xerox Corporation makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+package bean;
+
+import java.beans.*;
+import java.io.Serializable;
+
+/**
+ * Add bound properties and serialization to Point objects
+ */
+aspect BoundPoint {
+ /*
+ * privately declare a field on Point to hold the property
+ * change support object. `this' is a reference to a Point object.
+ */
+ private PropertyChangeSupport Point.support = new PropertyChangeSupport(this);
+
+ /*
+ * Declare property change registration methods on Point,
+ * and introduce implementation of the Serializable interface.
+ */
+
+ public void Point.addPropertyChangeListener(PropertyChangeListener listener){
+ support.addPropertyChangeListener(listener);
+ }
+
+ public void Point.addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener){
+ support.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void Point.removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
+ support.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public void Point.removePropertyChangeListener(PropertyChangeListener listener) {
+ support.removePropertyChangeListener(listener);
+ }
+
+ public void Point.hasListeners(String propertyName) {
+ support.hasListeners(propertyName);
+ }
+
+ declare parents: Point implements Serializable;
+
+ /**
+ * Send property change event after X setter completes normally.
+ * Use around advice to keep the old value on the stack.
+ */
+ void around(Point p): execution(void Point.setX(int)) && target(p) {
+ int oldValue = p.getX();
+ proceed(p);
+ firePropertyChange(p, "x", oldValue, p.getX());
+ }
+
+ /**
+ * Send property change event after Y setter completes normally.
+ * Use around advice to keep the old value on the stack.
+ */
+ void around(Point p): execution(void Point.setY(int)) && target(p) {
+ int oldValue = p.getY();
+ proceed(p);
+ firePropertyChange(p, "y", oldValue, p.getY());
+ }
+
+ /*
+ * Utility to fire the property change event.
+ */
+ void firePropertyChange(Point p,
+ String property,
+ double oldval,
+ double newval) {
+ p.support.firePropertyChange(property,
+ new Double(oldval),
+ new Double(newval));
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/bean/Demo.java b/docs/modules/ROOT/pages/examples/bean/Demo.java
new file mode 100644
index 000000000..e16be245e
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/bean/Demo.java
@@ -0,0 +1,80 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+*/
+
+package bean;
+
+import java.beans.*;
+import java.io.*;
+
+public class Demo implements PropertyChangeListener {
+
+ static final String fileName = "test.tmp";
+
+ /**
+ * when Demo is playing the listener role,
+ * this method reports that a propery has changed
+ */
+ public void propertyChange(PropertyChangeEvent e){
+ System.out.println("Property " + e.getPropertyName() + " changed from " +
+ e.getOldValue() + " to " + e.getNewValue() );
+ }
+
+ /**
+ * main: test the program
+ */
+ public static void main(String[] args){
+ Point p1 = new Point();
+ p1.addPropertyChangeListener(new Demo());
+ System.out.println("p1 =" + p1);
+ p1.setRectangular(5,2);
+ System.out.println("p1 =" + p1);
+ p1.setX( 6 );
+ p1.setY( 3 );
+ System.out.println("p1 =" + p1);
+ p1.offset(6,4);
+ System.out.println("p1 =" + p1);
+ save(p1, fileName);
+ Point p2 = (Point) restore(fileName);
+ System.out.println("Had: " + p1);
+ System.out.println("Got: " + p2);
+ }
+
+ /**
+ * Save a serializable object to a file
+ */
+ static void save(Serializable p, String fn){
+ try {
+ System.out.println("Writing to file: " + p);
+ FileOutputStream fo = new FileOutputStream(fn);
+ ObjectOutputStream so = new ObjectOutputStream(fo);
+ so.writeObject(p);
+ so.flush();
+ } catch (Exception e) {
+ System.out.println(e);
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Restore a serializable object from the file
+ */
+ static Object restore(String fn){
+ try {
+ Object result;
+ System.out.println("Reading from file: " + fn);
+ FileInputStream fi = new FileInputStream(fn);
+ ObjectInputStream si = new ObjectInputStream(fi);
+ return si.readObject();
+ } catch (Exception e) {
+ System.out.println(e);
+ System.exit(1);
+ }
+ return null;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/bean/Point.java b/docs/modules/ROOT/pages/examples/bean/Point.java
new file mode 100644
index 000000000..a6ea703cd
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/bean/Point.java
@@ -0,0 +1,69 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package bean;
+
+class Point {
+
+ protected int x = 0;
+ protected int y = 0;
+
+ /**
+ * Return the X coordinate
+ */
+ public int getX(){
+ return x;
+ }
+
+ /**
+ * Return the y coordinate
+ */
+ public int getY(){
+ return y;
+ }
+
+ /**
+ * Set the x and y coordinates
+ */
+ public void setRectangular(int newX, int newY){
+ setX(newX);
+ setY(newY);
+ }
+
+ /**
+ * Set the X coordinate
+ */
+ public void setX(int newX) {
+ x = newX;
+ }
+
+ /**
+ * set the y coordinate
+ */
+ public void setY(int newY) {
+ y = newY;
+ }
+
+ /**
+ * Move the point by the specified x and y offset
+ */
+ public void offset(int deltaX, int deltaY){
+ setRectangular(x + deltaX, y + deltaY);
+ }
+
+ /**
+ * Make a string of this
+ */
+ public String toString(){
+ return "(" + getX() + ", " + getY() + ")" ;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/bean/files.lst b/docs/modules/ROOT/pages/examples/bean/files.lst
new file mode 100644
index 000000000..12ac0eb39
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/bean/files.lst
@@ -0,0 +1,3 @@
+BoundPoint.java
+Point.java
+Demo.java
diff --git a/docs/modules/ROOT/pages/examples/build.xml b/docs/modules/ROOT/pages/examples/build.xml
new file mode 100644
index 000000000..958c72727
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/build.xml
@@ -0,0 +1,458 @@
+
+<!-- ========================================================================= -->
+<!-- Copyright (c) 1999-2001 Xerox Corporation, -->
+<!-- 2002 Palo Alto Research Center, Incorporated (PARC). -->
+<!-- All rights reserved. -->
+<!-- This program and the accompanying materials are made available -->
+<!-- under the terms of the Eclipse Public License v 2.0 -->
+<!-- which accompanies this distribution and is available at -->
+<!-- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt -->
+<!-- -->
+<!-- Contributors: -->
+<!-- Xerox/PARC initial implementation -->
+<!-- ========================================================================= -->
+
+<project name="aspectj-examples" default="spacewar" basedir=".">
+
+ <target name="info" >
+ <echo>
+ This script builds the AspectJ examples.
+
+ Relevant targets:
+ spacewar build and run spacewar with debugging (default)
+ all build and run each example
+ {example} build and run any {example}
+ (use -projecthelp to list {example} names)
+ tracing-bc use AspectJ 1.1 bytecode weaving to build tracing example
+
+ Setup:
+ - Run from the doc/examples directory in your AspectJ distribution.
+ The tasks in ../../lib/aspectjtools.jar are used automatically.
+
+ Variants:
+ - To avoid running (i.e., compile only), define variable "norun"
+ - To define a variable, use the Ant -D option - e.g., on Windows:
+
+ ant -f build.xml -DJAVA_HOME=c:\jdk1.3.1 -Dnorun=skip
+
+ </echo>
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- setup and cleanup targets -->
+ <!-- ============================================================= -->
+
+ <target name="clean" depends="init"
+ description="clean and create classes/jar dir, .ajesym files">
+ <delete quiet="on" dir="${classes.dir}"/>
+ <delete quiet="on" dir="${jar.dir}"/>
+ <delete quiet="on">
+ <fileset dir="${example.dir}" includes="**/*.ajesym"/>
+ </delete>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${jar.dir}"/>
+ </target>
+
+ <target name="init" depends="init.variables,init.taskdefs"/>
+
+ <target name="init.variables"
+ description="init variables">
+
+ <!-- build.compiler value to pick up our CompilerAdapter for javac -->
+ <property name="ajc.adapter"
+ value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/>
+
+ <!-- required directories - run from examples or predefine -->
+ <property name="example.dir"
+ location="${basedir}"/>
+ <property name="aspectj.lib.dir"
+ location="${basedir}/../../lib"/>
+
+ <!-- required libraries - install or predefine -->
+ <property name="aspectjrt.jar"
+ location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ <property name="aspectjtools.jar"
+ location="${aspectj.lib.dir}/aspectjtools.jar"/>
+ <property name="aspectjweaver.jar"
+ location="${aspectj.lib.dir}/aspectjweaver.jar"/>
+
+ <!-- created directories -->
+ <property name="classes.dir"
+ location="${example.dir}/classes"/>
+ <property name="jar.dir"
+ location="${example.dir}/jars"/>
+
+ <!-- checking required libraries -->
+ <available file="${aspectjtools.jar}"
+ property="aspectjtools.jar.available"/>
+ <available file="${aspectjrt.jar}"
+ property="aspectjrt.jar.available"/>
+
+ <property name="example.packages"
+ value="bean, coordination, evolution, figures, figures.gui,
+ helloworld, icount, icount.lib, introduction,
+ observer, shadow, shadow.version1, shadow.version2,
+ spacewar, telecom, telecom.version1, timeserver, tjp,
+ tracing, tracing.lib tracing.version1, tracing.version2,
+ tracing.version3"/>
+ </target>
+
+ <target name="init.taskdefs" depends="init.variables,
+ aspectjtools.jar.available,
+ aspectjrt.jar.available"
+ unless="taskdefs.init">
+ <!-- sets name of new task to iajc, old task to ajc -->
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <pathelement path="${aspectjtools.jar}"/>
+ </classpath>
+ </taskdef>
+ <property name="taskdefs.init" value="true"/>
+ </target>
+
+ <!-- targets to fail unless required libraries available -->
+
+ <target name="aspectjrt.jar.available" depends="init.variables"
+ unless="aspectjrt.jar.available" >
+ <fail message="expecting aspectjrt.jar at ${aspectjrt.jar}"/>
+ </target>
+
+ <target name="aspectjtools.jar.available" depends="init.variables"
+ unless="aspectjtools.jar.available" >
+ <fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- these targets compile and run any example -->
+ <!-- ============================================================= -->
+ <target name="Ajx" depends="init"
+ description="compile {list} and run {class} of example">
+ <echo message="##### Ajx list=${list} class=${class}" />
+ <antcall target="clean" />
+ <!-- can use ajc or iajc here -->
+ <iajc destdir="${classes.dir}" argfiles="${list}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ classpath="${aspectjrt.jar}"/>
+
+ <antcall target="Ajx-run" >
+ <param name="class" value="${class}"/>
+ </antcall>
+
+ </target>
+
+ <target name="Ajx-run"
+ description="run {class} unless {norun} is set"
+ unless="norun" >
+ <echo message="##### Ajx-run list=${list} class=${class}" />
+ <java classname="${class}" fork="yes">
+ <classpath>
+ <pathelement path="${classes.dir}"/>
+ <pathelement path="${aspectjrt.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- example targets -->
+ <!-- ============================================================= -->
+ <target name="all"
+ description="build and run all examples"
+ depends="bean,intro,intro-clone,intro-compare,intro-hash,
+ observer,spacewar,spacewar-demo,telecom,
+ telecom-timing,tracing-none,tracing-1,
+ tracing-2,tracing-3,tracing-lt,tjp"/>
+
+ <target name="nonGui"
+ description="build and run non-GUI examples"
+ depends="bean,intro,intro-clone,intro-compare,intro-hash,
+ telecom,telecom-timing,tracing-none,tracing-1,
+ tracing-2,tracing-3,tracing-lt,tjp"/>
+
+ <target name="bean"
+ description="build bean example">
+ <antcall target="Ajx">
+ <param name="list" value="bean/files.lst"/>
+ <param name="class" value="bean.Demo"/>
+ </antcall>
+ </target>
+
+ <target name="intro"
+ description="build inter-type declaration example">
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="class" value="introduction.Point"/>
+ </antcall>
+ </target>
+
+ <target name="intro-clone"
+ description="build inter-type declaration (clone) example">
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="class" value="introduction.CloneablePoint"/>
+ </antcall>
+ </target>
+
+ <target name="intro-compare"
+ description="build inter-type declaration (Comparable) example">
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="class" value="introduction.ComparablePoint"/>
+ </antcall>
+ </target>
+
+ <target name="intro-hash"
+ description="build inter-type declaration (hashcode) example">
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="class" value="introduction.HashablePoint"/>
+ </antcall>
+ </target>
+
+ <target name="observer"
+ description="build observer example">
+ <antcall target="Ajx">
+ <param name="list" value="observer/files.lst"/>
+ <param name="class" value="observer.Demo"/>
+ </antcall>
+ </target>
+
+ <target name="spacewar"
+ description="build spacewar debug example">
+ <antcall target="Ajx">
+ <param name="list" value="spacewar/debug.lst"/>
+ <param name="class" value="spacewar.Game"/>
+ </antcall>
+ </target>
+
+ <target name="spacewar-demo"
+ description="build spacewar demo (no debug) example">
+ <antcall target="Ajx">
+ <param name="list" value="spacewar/demo.lst"/>
+ <param name="class" value="spacewar.Game"/>
+ </antcall>
+ </target>
+
+ <target name="telecom"
+ description="build telecom basic example">
+ <antcall target="Ajx">
+ <param name="list" value="telecom/basic.lst"/>
+ <param name="class" value="telecom.BasicSimulation"/>
+ </antcall>
+ </target>
+
+ <target name="telecom-billing"
+ description="build telecom billing example">
+ <antcall target="Ajx">
+ <param name="list" value="telecom/billing.lst"/>
+ <param name="class" value="telecom.BillingSimulation"/>
+ </antcall>
+ </target>
+
+ <target name="telecom-timing"
+ description="build telecome timing example">
+ <antcall target="Ajx">
+ <param name="list" value="telecom/timing.lst"/>
+ <param name="class" value="telecom.TimingSimulation"/>
+ </antcall>
+ </target>
+
+ <target name="tjp"
+ description="build thisJoinPoint example">
+ <antcall target="Ajx">
+ <param name="list" value="tjp/files.lst"/>
+ <param name="class" value="tjp.Demo"/>
+ </antcall>
+ </target>
+
+ <target name="tracing-none"
+ description="build tracing (base) example">
+ <antcall target="Ajx">
+ <param name="list" value="tracing/notrace.lst"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ </antcall>
+ </target>
+
+ <target name="tracing-1"
+ description="build tracing (version 1) example">
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev1.lst"/>
+ <param name="class" value="tracing.version1.TraceMyClasses"/>
+ </antcall>
+ </target>
+
+ <target name="tracing-2"
+ description="build tracing (version 2) example">
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev2.lst"/>
+ <param name="class" value="tracing.version2.TraceMyClasses"/>
+ </antcall>
+ </target>
+
+ <target name="tracing-3"
+ description="build tracing (version 3) example">
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev3.lst"/>
+ <param name="class" value="tracing.version3.TraceMyClasses"/>
+ </antcall>
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- do tracing example using compiler adapter -->
+ <!-- ============================================================= -->
+ <target name="tracing-adapter" depends="init"
+ description="tracing example compiled via javac task">
+ <antcall target="clean" />
+ <!-- to fork, set adapter.fork=true
+ and put aspectjtools.jar on ant classpath -->
+ <javac destdir="${classes.dir}"
+ fork="${adapter.fork}">
+ <src path="${example.dir}"/>
+ <include name="tracing/*.java"/>
+
+ <!-- compilerarg's ignored unless using our compiler adapter -->
+ <compilerarg compiler="${ajc.adapter}"
+ line="-verbose -Xlint -proceedOnError"/>
+ <!-- use separate values if a path might have spaces -->
+ <compilerarg compiler="${ajc.adapter}"
+ value="-classpath"/>
+ <compilerarg compiler="${ajc.adapter}"
+ value="${aspectjrt.jar}"/>
+ <compilerarg compiler="${ajc.adapter}"
+ path="${example.dir}/tracing/version3/Trace.java"/>
+ <compilerarg compiler="${ajc.adapter}"
+ path="${example.dir}/tracing/version3/TraceMyClasses.java"/>
+ </javac>
+ </target>
+
+ <target name="tracing-adapter-ajc" depends="init"
+ description="tracing example compiled using ajc via compiler adapter">
+ <!-- aspectjtools.jar must be on system/ant classpath -->
+ <antcall target="tracing-adapter">
+ <param name="build.compiler" value="${ajc.adapter}"/>
+ </antcall>
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- do tracing example with 1.1 bytecode weaving (binary aspects) -->
+ <!-- (and use fork/forkclasspath to avoid Eclipse 2.x bug) -->
+ <!-- ============================================================= -->
+ <target name="tracing-bc" depends="init"
+ description="tracing example with bytecode weaving (binary aspects)">
+ <antcall target="clean" />
+
+ <!-- build application classes -->
+ <iajc outjar="${jar.dir}/tracingApp.jar"
+ classpath="${aspectjrt.jar}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ verbose="off">
+ <src path="${example.dir}"/>
+ <include name="tracing/*.java" />
+ </iajc>
+
+ <!-- test standalone application by running without tracing -->
+ <echo message="---------- running without tracing - START"/>
+ <java classname="tracing.ExampleMain">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${jar.dir}/tracingApp.jar"/>
+ </classpath>
+ </java>
+ <echo message="---------- running without tracing - FINISH "/>
+
+ <!-- Build a read-only tracing library -->
+ <iajc outjar="${jar.dir}/tracingLib.jar"
+ classpath="${aspectjrt.jar}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ verbose="off">
+ <src path="${example.dir}"/>
+ <include name="tracing/version3/Trace.java" />
+ </iajc>
+
+ <!-- weave them -->
+ <!-- This example uses a concrete aspect in source form, -->
+ <!-- but the aspects could be written to be binary only. -->
+ <iajc outjar="${jar.dir}/tracedApp.jar"
+ inpath="${jar.dir}/tracingApp.jar"
+ aspectpath="${jar.dir}/tracingLib.jar"
+ classpath="${aspectjrt.jar}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ verbose="off">
+ <src path="${example.dir}"/>
+ <include name="tracing/version3/TraceMyClasses.java" />
+ </iajc>
+
+ <!-- run with tracing -->
+ <echo message="---------- running with tracing - START"/>
+ <java classname="tracing.version3.TraceMyClasses">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${jar.dir}/tracingLib.jar"/>
+ <pathelement path="${jar.dir}/tracedApp.jar"/>
+ </classpath>
+ </java>
+ <echo message="---------- running with tracing - FINISH"/>
+
+ </target>
+
+ <!-- ============================================================= -->
+ <!-- do tracing example with 1.2 load-time weaving -->
+ <!-- (and use fork/forkclasspath to avoid Eclipse 2.x bug) -->
+ <!-- ============================================================= -->
+ <target name="tracing-lt" depends="init"
+ description="tracing example with load-time aspect weaving">
+ <antcall target="clean" />
+
+ <!-- build application classes -->
+ <iajc outjar="${jar.dir}/tracingApp.jar"
+ classpath="${aspectjrt.jar}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ verbose="off">
+ <src path="${example.dir}"/>
+ <include name="tracing/*.java" />
+ </iajc>
+
+ <!-- Build a read-only tracing library -->
+ <iajc outjar="${jar.dir}/tracingLib.jar"
+ classpath="${aspectjrt.jar}:${jar.dir}/tracingApp.jar"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ verbose="off">
+ <src path="${example.dir}"/>
+ <include name="tracing/version2/Trace.java" />
+ <include name="tracing/version2/TraceMyClasses.java" />
+ </iajc>
+
+ <!-- test standalone application by running without tracing -->
+ <echo message="---------- running without tracing - START"/>
+ <java classname="tracing.ExampleMain">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${jar.dir}/tracingApp.jar"/>
+ </classpath>
+ </java>
+ <echo message="---------- running without tracing - FINISH "/>
+
+ <!-- run application with LTW to add tracing -->
+ <echo message="---------- running with tracing - START"/>
+ <java classname="tracing.ExampleMain"
+ fork="true">
+ <classpath>
+ <pathelement path="${aspectjweaver.jar}"/>
+ </classpath>
+ <jvmarg line="-showversion"/>
+ <sysproperty key="java.system.class.loader" value="org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
+ <sysproperty key="aj.weaving.verbose" value="True"/>
+ <sysproperty key="org.aspectj.weaver.showWeaveInfo" value="True"/>
+ <sysproperty key="aj.class.path" path="${jar.dir}/tracingLib.jar:${jar.dir}/tracingApp.jar"/>
+ <sysproperty key="aj.aspect.path" path="${jar.dir}/tracingLib.jar"/>
+ </java>
+ <echo message="---------- running with tracing - FINISH"/>
+
+ </target>
+
+</project>
diff --git a/docs/modules/ROOT/pages/examples/coordination/Condition.java b/docs/modules/ROOT/pages/examples/coordination/Condition.java
new file mode 100644
index 000000000..18bbafee2
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/Condition.java
@@ -0,0 +1,37 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+/**
+ * Interface for pre-conditions that are passed to guardedEntry methods of
+ * Coordinator.
+ * Conditions should be passed as anonymous classes that simply implement
+ * the checkit method.
+ *
+ */
+public interface Condition {
+
+ /**
+ * This method is called automatically by Coordinator.guardedEntry(...)
+ * and it's called everytime the coordination state changes.
+ */
+
+ public boolean checkit();
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/CoordinationAction.java b/docs/modules/ROOT/pages/examples/coordination/CoordinationAction.java
new file mode 100644
index 000000000..7825b95b7
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/CoordinationAction.java
@@ -0,0 +1,37 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+/**
+ * Interface for coordination actions that are passed to guardedEntry methods of
+ * Coordinator.
+ * Coordination actions should be passed as anonymous classes that simply
+ * implement the doit method.
+ *
+ */
+public interface CoordinationAction {
+ /**
+ * This method is called by Coordinator.guardedEntry(...) and
+ * Coordinator.guardedExit(...). Use it for changing coordination state
+ * upon entering and exiting methods.
+ */
+
+ public void doit();
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/Coordinator.java b/docs/modules/ROOT/pages/examples/coordination/Coordinator.java
new file mode 100644
index 000000000..ea0522d6b
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/Coordinator.java
@@ -0,0 +1,449 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.util.*; //!!!
+
+/**
+ * The Coordinator class provides the basic functionality for synchronizing
+ * and coordinating different threads upon entering and exiting methods.
+ * It can be used in two different ways:
+ * 1) by instantiating regular coordinator objects that are used by aspects; or
+ * 2) by extending it (sub-classing) with coordinator aspects.
+ * <P>
+ * Method invocations are the smallest units for defining critical sections
+ * and pre-conditions. The use of coordinators, either regular objects or aspect
+ * instances, should always end up by invoking guardedEntry(...) in a
+ * before weave and guardedExit(...) in an after weave for all methods that
+ * need coordination. guardedEntry and guardedExit are the methods that
+ * actually manage the synchronization and coordination constraints given
+ * by their parameters and by pre-existent exclusion markers.
+ * <P>
+ * The synchronization of threads for the execution of critical section
+ * methods in an object is done by marking those methods as self- and/or
+ * mutually-exclusive (addSelfex, addMutex).
+ * Just by itself, addSelfex("M") does not enforce the self-exclusion
+ * of method M - enforcement is done by invoking guardedEntry before
+ * M is executed. Similarly, addMutex(new String[] {"M1", "M2"}) does
+ * not enforce the mutual exclusion between methods M1 and M2.
+ * <P>
+ * A guardedEntry on a method that has been marked as self-exclusive
+ * ensures that the method is executed in the invoked object by only one thread
+ * at a time. A guardedEntry on a method that has been marked has mutually-
+ * exclusive with other methods ensures that the execution of that method
+ * by a thread in the invoked object temporarily blocks the execution by
+ * other threads of the methods that are in the same mutex set.
+ * <P>
+ * The coordination of threads, i.e. their explicit suspension and
+ * resumption, is done through the use of pre-conditions and coordination
+ * actions that are passed as parameters to guardedEntry and guardedExit
+ * with the form of anonymous classes.
+ */
+public abstract aspect Coordinator {
+ private Hashtable methods = null;
+ private Vector exclusions = null;
+
+ abstract protected pointcut synchronizationPoint();
+
+ public Coordinator() {
+ methods = new Hashtable();
+ exclusions = new Vector(5);
+ }
+
+ before (): synchronizationPoint() {
+ this.guardedEntry(thisJoinPointStaticPart.getSignature().getName());
+ }
+
+ after (): synchronizationPoint() {
+ this.guardedExit(thisJoinPointStaticPart.getSignature().getName());
+ }
+
+ /**
+ * Takes a multi-part method name (eg "BoundedBuffer.put")
+ * and marks that method as self-exclusive.
+ * No checks are made with respect to the existence of the method
+ * whose name is given.
+ */
+ public synchronized void addSelfex(String methName) {
+ Selfex sex = new Selfex (methName);
+
+ // update db of all exclusions in this coordinator
+ exclusions.addElement(sex);
+
+ // update local info in method
+ Method aMeth = getOrSetMethod(methName);
+ aMeth.addExclusion(sex);
+ }
+
+ /**
+ * Takes a multi-part method name (e.g. "BoundedBuffer.put")
+ * and removes that method from the list of self-exclusive methods.
+ */
+ public synchronized void removeSelfex(String methName) {
+ for (int i = 0; i < exclusions.size(); i++) {
+ Exclusion sex = (Exclusion)exclusions.elementAt(i);
+ if ((sex instanceof Selfex) &&
+ (((Selfex)sex).methodName.equals(methName))) {
+
+ // update db of all exclusions in this coordinator
+ exclusions.removeElementAt(i);
+
+ // update local info in method
+ Method aMeth = getOrSetMethod(methName);
+ aMeth.removeExclusion(sex);
+ }
+ }
+ }
+
+ /**
+ * Takes an array of multi-part method names and marks those
+ * methods as mutually exclusive.
+ * No checks are made with respect to the existence of the methods
+ * whose names are given.
+ */
+ public synchronized void addMutex(String[] methNames) {
+ Mutex mux = new Mutex(methNames);
+
+ // update db of all exclusions in this coordinator
+ exclusions.addElement(mux);
+
+ // update local info in each method
+ for (int i = 0; i < methNames.length; i++) {
+ Method aMeth = getOrSetMethod(methNames[i]);
+ aMeth.addExclusion(mux);
+ }
+ }
+
+ /**
+ * Takes an array of multi-part method names that correspond
+ * to an existing mutex set and remove the mutual exclusion constraint.
+ * If the given mutex set does not exist, removeMutex does nothing.
+ */
+ public synchronized void removeMutex(String[] methNames) {
+ for (int i = 0; i < exclusions.size(); i++) {
+ Exclusion mux = (Exclusion)exclusions.elementAt(i);
+ if (mux instanceof Mutex) {
+ boolean same = true;
+ for (int j = 0; j < methNames.length; j++)
+ if (!methNames[j].equals(((Mutex)mux).methodNames[j]))
+ same = false;
+ if (same) {
+ // update db of all exclusions in this coordinator
+ exclusions.removeElementAt(i);
+
+ // update local info in each method involved
+ for (int j = 0; j < methNames.length; j++) {
+ Method aMeth = getOrSetMethod(methNames[j]);
+ aMeth.removeExclusion(mux);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, only the method name is given. The only constraints
+ * checked are the exclusion constraints.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ */
+ public synchronized void guardedEntry(String methName) {
+ guardedEntry(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, null);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but the given method is executed
+ * only when the given condition is true.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a condition.
+ * The constraints checked are the exclusion constraints and whether
+ * the given condition is true.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * If the condition is false, guardedEntry suspends the current thread.
+ * That thread remains suspended until the condition becomes true, in
+ * which case all constraints are rechecked before the method is executed.
+ * When all exclusion constraints are checked and the given condition is
+ * true, the given method is executed.
+ */
+ public synchronized void guardedEntry(String methName, Condition condition) {
+ guardedEntry(methName, condition, null);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but with an additional
+ * coordination action that is executed before the given method is
+ * executed.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a coordination action.
+ * The only constraints checked are the exclusion constraints.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * The given coordination action is executed just before the given method
+ * is executed.
+ */
+ public synchronized void guardedEntry(String methName,
+ CoordinationAction action) {
+ guardedEntry(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ },
+ action);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but the given method is executed
+ * only when the given condition is true; the additional
+ * coordination action that is executed before the given method is
+ * executed.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a condition and
+ * a coordination action.
+ * The constraints checked are the exclusion constraints and whether the
+ * given condition is true.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * If the condition is false, guardedEntry suspends the current thread.
+ * That thread remains suspended until the condition becomes true, in
+ * which case all constraints are rechecked before the method is executed.
+ * When all exclusion constraints are checked and the given condition is
+ * true, the given method is executed.
+ * The given coordination action is executed just before the given method
+ * is executed.
+ */
+ public synchronized void guardedEntry(String methName,
+ Condition condition,
+ CoordinationAction action) {
+ Method aMeth = getOrSetMethod(methName);
+ boolean canGo = false;
+
+ // test pre-conditions for entering the method
+ while (!canGo) {
+ canGo = true;
+ for (int i = 0; i < aMeth.exes.size() && canGo; i++)
+ if (!((Exclusion)aMeth.exes.elementAt(i)).testExclusion(aMeth.name)) {
+ canGo = false;
+ }
+ if (canGo && !condition.checkit()) {
+ canGo = false;
+ }
+ if (!canGo)
+ try {
+ wait();
+ } catch (InterruptedException e) { }
+ }
+
+ // OK.
+ enterMethod(aMeth, action);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, null, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ Condition condition,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, condition, null, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ CoordinationAction action,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, action, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ Condition condition,
+ CoordinationAction action,
+ long millis)
+ throws TimeoutException {
+
+ Method aMeth = getOrSetMethod(methName);
+ boolean canGo = false;
+ long waitTime = millis;
+ long startTime = System.currentTimeMillis();
+
+ // test pre-conditions for entering the method
+ while (!canGo) {
+ canGo = true;
+ for (int i = 0; i < aMeth.exes.size() && canGo; i++)
+ if ((!((Exclusion)aMeth.exes.elementAt(i)).testExclusion(aMeth.name)) ||
+ (!condition.checkit())) {
+ canGo = false;
+ }
+ if (!canGo) {
+ try {
+ wait(waitTime);
+ } catch (InterruptedException e) {}
+
+ long now = System.currentTimeMillis();
+ long timeSoFar = now - startTime;
+ if (timeSoFar >= millis) // timeout!
+ throw new TimeoutException(timeSoFar);
+ else // adjust time
+ waitTime = millis - timeSoFar;
+ }
+ }
+
+ // OK.
+ enterMethod(aMeth, action);
+ }
+
+ /**
+ * This method provides the means for updating all synchronization and
+ * coordination state after the execution of a given method, and it should be
+ * called after the method is executed.
+ * In this form, only the method name is given.
+ * The synchronization state for self- and mutual-exclusion is
+ * automatically upadted.
+ */
+ public synchronized void guardedExit(String methName) {
+ guardedExit(methName, null);
+ }
+
+ /**
+ * Just like guardedExit(String methName) but with an additional
+ * coordination action that is executed.
+ * guardedExit provides the means for updating all synchronization and
+ * coordination state after the execution of a given method, and it should be
+ * called after the method is executed.
+ * In this form, the method name is given along with a coordination action.
+ * The synchronization state for self- and mutual-exclusion is
+ * automatically upadted.
+ * The given coordination action is executed.
+ */
+ public synchronized void guardedExit(String methName,
+ CoordinationAction action) {
+ Method aMeth = getOrSetMethod(methName);
+
+ for (int i = 0; i < aMeth.exes.size(); i++)
+ ((Exclusion)aMeth.exes.elementAt(i)).exitExclusion(methName);
+ if (action != null) action.doit();
+ notifyAll();
+ }
+
+ private Method getOrSetMethod(String methName) {
+ Method aMeth = null;
+ if (!methods.containsKey(methName)) {
+ methods.put(methName, (aMeth = new Method(methName)));
+ }
+ else {
+ aMeth = (Method) methods.get(methName);
+ }
+ return aMeth;
+ }
+
+ private void enterMethod(Method aMeth, CoordinationAction action) {
+ for (int i = 0; i < aMeth.exes.size(); i++)
+ ((Exclusion)aMeth.exes.elementAt(i)).enterExclusion(aMeth.name);
+
+ if (action != null) action.doit();
+ }
+
+
+
+}
+
+class Method {
+ String name;
+ Vector exes = new Vector(3);
+
+ Method(String n) {
+ name = n;
+ }
+
+ void addExclusion(Exclusion ex) {
+ exes.addElement(ex);
+ }
+
+ void removeExclusion(Exclusion ex) {
+ for (int i = 0; i < exes.size(); i++) {
+ if (exes.elementAt(i) == ex)
+ exes.removeElementAt(i);
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/examples/coordination/Exclusion.java b/docs/modules/ROOT/pages/examples/coordination/Exclusion.java
new file mode 100644
index 000000000..9179cd6e0
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/Exclusion.java
@@ -0,0 +1,33 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+interface Exclusion {
+
+ boolean testExclusion(String methodName);
+
+ void enterExclusion(String methodName);
+
+ void exitExclusion(String methodName);
+
+ // for debug !!!
+ void printNames();
+}
+
diff --git a/docs/modules/ROOT/pages/examples/coordination/MethodState.java b/docs/modules/ROOT/pages/examples/coordination/MethodState.java
new file mode 100644
index 000000000..03a44378a
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/MethodState.java
@@ -0,0 +1,45 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+
+class MethodState {
+
+ Vector threads=new Vector();
+
+ void enterInThread (Thread t) {
+ threads.addElement(t);
+ }
+
+ void exitInThread(Thread t) {
+ threads.removeElement(t);
+ }
+
+ boolean hasOtherThreadThan(Thread t) {
+ Enumeration e = threads.elements();
+ while (e.hasMoreElements())
+ if (e.nextElement() != t)
+ return(true);
+ return (false);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/Mutex.java b/docs/modules/ROOT/pages/examples/coordination/Mutex.java
new file mode 100644
index 000000000..2472137c6
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/Mutex.java
@@ -0,0 +1,86 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.lang.String;
+
+
+class Mutex implements Exclusion {
+ String[] methodNames;
+ MethodState[] methodStates;
+
+ String prettyName;
+
+ Mutex (String[] _methodNames) {
+ methodNames = _methodNames;
+ methodStates = new MethodState[methodNames.length];
+ for (int i = 0; i < methodNames.length; i++) {
+ methodStates[i] = new MethodState();
+ }
+ }
+
+ private boolean isMethodIn (String _methodName) {
+ for (int i = 0; i < methodNames.length; i++) {
+ if (_methodName.equals(methodNames[i]))
+ return(true);
+ }
+ return(false);
+ }
+
+ private MethodState getMethodState (String _methodName) {
+ for (int i = 0; i < methodNames.length; i++) {
+ if (_methodName.equals(methodNames[i]))
+ return(methodStates[i]);
+ }
+ return(null);
+ }
+
+ public boolean testExclusion (String _methodName) {
+ Thread ct = Thread.currentThread();
+ //
+ // Loop through each of the other methods in this exclusion set, to be sure
+ // that no other thread is running them. Note that we have to be careful
+ // about selfex.
+ //
+ for (int i = 0; i < methodNames.length; i++) {
+ if (!_methodName.equals(methodNames[i])) {
+ if (methodStates[i].hasOtherThreadThan(ct))
+ return(false);
+ }
+ }
+ return (true);
+ }
+
+ public void enterExclusion (String _methodName) {
+ MethodState methodState = getMethodState(_methodName);
+ methodState.enterInThread(Thread.currentThread());
+ }
+
+ public void exitExclusion (String _methodName) {
+ MethodState methodState = getMethodState(_methodName);
+ methodState.exitInThread(Thread.currentThread());
+ }
+
+ public void printNames() {
+ System.out.print("Mutex names: ");
+ for (int i = 0; i < methodNames.length; i++)
+ System.out.print(methodNames[i] + " ");
+ System.out.println();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/Selfex.java b/docs/modules/ROOT/pages/examples/coordination/Selfex.java
new file mode 100644
index 000000000..ff73afd61
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/Selfex.java
@@ -0,0 +1,55 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+import java.lang.String;
+
+class Selfex implements Exclusion {
+ String methodName;
+ Thread thread;
+ int count = 0;
+
+ Selfex (String _methodName) {
+ methodName = _methodName;
+ }
+
+ public boolean testExclusion (String _methodName) {
+ if (count == 0)
+ return(true);
+ return (thread == Thread.currentThread());
+ }
+
+ public void enterExclusion (String _methodName) {
+ count++;
+ thread = Thread.currentThread(); // note that if count wasn't 0
+ // we aren't changing thread
+ }
+
+ public void exitExclusion (String _methodName) {
+ count--;
+ if (count == 0) // not stricly necessary, but...
+ thread = null;
+ }
+
+ public void printNames() {
+ System.out.println("Selfex name: " + methodName);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/TimeoutException.java b/docs/modules/ROOT/pages/examples/coordination/TimeoutException.java
new file mode 100644
index 000000000..e16aa7f09
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/TimeoutException.java
@@ -0,0 +1,27 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+public class TimeoutException extends Exception {
+ long time;
+ TimeoutException(long _time) {
+ time = _time;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/coordination/lib.lst b/docs/modules/ROOT/pages/examples/coordination/lib.lst
new file mode 100644
index 000000000..2d85cad90
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/coordination/lib.lst
@@ -0,0 +1,8 @@
+Condition.java
+CoordinationAction.java
+Coordinator.java
+Exclusion.java
+MethodState.java
+Mutex.java
+Selfex.java
+TimeoutException.java
diff --git a/docs/modules/ROOT/pages/examples/introduction/CloneablePoint.java b/docs/modules/ROOT/pages/examples/introduction/CloneablePoint.java
new file mode 100644
index 000000000..c34509850
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/introduction/CloneablePoint.java
@@ -0,0 +1,42 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package introduction;
+
+public aspect CloneablePoint {
+
+ declare parents: Point implements Cloneable;
+
+ public Object Point.clone() throws CloneNotSupportedException {
+ // we choose to bring all fields up to date before cloning.
+ makeRectangular();
+ makePolar();
+ return super.clone();
+ }
+
+ public static void main(String[] args){
+ Point p1 = new Point();
+ Point p2 = null;
+
+ p1.setPolar(Math.PI, 1.0);
+ try {
+ p2 = (Point)p1.clone();
+ } catch (CloneNotSupportedException e) {}
+ System.out.println("p1 =" + p1 );
+ System.out.println("p2 =" + p2 );
+
+ p1.rotate(Math.PI / -2);
+ System.out.println("p1 =" + p1 );
+ System.out.println("p2 =" + p2 );
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/introduction/ComparablePoint.java b/docs/modules/ROOT/pages/examples/introduction/ComparablePoint.java
new file mode 100644
index 000000000..a2893dba0
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/introduction/ComparablePoint.java
@@ -0,0 +1,46 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package introduction;
+
+public aspect ComparablePoint {
+
+ declare parents: Point implements Comparable;
+
+ public int Point.compareTo(Object o) {
+ return (int) (this.getRho() - ((Point)o).getRho());
+ }
+
+ public static void main(String[] args){
+ Point p1 = new Point();
+ Point p2 = new Point();
+
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+
+ p1.setRectangular(2,5);
+ p2.setRectangular(2,5);
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+
+ p2.setRectangular(3,6);
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+
+ p1.setPolar(Math.PI, 4);
+ p2.setPolar(Math.PI, 4);
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+
+ p1.rotate(Math.PI / 4.0);
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+
+ p1.offset(1,1);
+ System.out.println("p1 =?= p2 :" + p1.compareTo(p2));
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/introduction/HashablePoint.java b/docs/modules/ROOT/pages/examples/introduction/HashablePoint.java
new file mode 100644
index 000000000..39eb33ba4
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/introduction/HashablePoint.java
@@ -0,0 +1,47 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package introduction;
+
+import java.util.Hashtable;
+
+public aspect HashablePoint {
+
+ public int Point.hashCode() {
+ return (int) (getX() + getY() % Integer.MAX_VALUE);
+ }
+
+ public boolean Point.equals(Object o) {
+ if (o == this) { return true; }
+ if (!(o instanceof Point)) { return false; }
+ Point other = (Point)o;
+ return (getX() == other.getX()) && (getY() == other.getY());
+ }
+
+ public static void main(String[] args) {
+ Hashtable h = new Hashtable();
+ Point p1 = new Point();
+
+ p1.setRectangular(10, 10);
+ Point p2 = new Point();
+
+ p2.setRectangular(10, 10);
+
+ System.out.println("p1 = " + p1);
+ System.out.println("p2 = " + p2);
+ System.out.println("p1.hashCode() = " + p1.hashCode());
+ System.out.println("p2.hashCode() = " + p2.hashCode());
+
+ h.put(p1, "P1");
+ System.out.println("Got: " + h.get(p2));
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/introduction/Point.java b/docs/modules/ROOT/pages/examples/introduction/Point.java
new file mode 100644
index 000000000..4de01359b
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/introduction/Point.java
@@ -0,0 +1,98 @@
+/*
+ Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+ Use and copying of this software and preparation of derivative works based
+ upon this software are permitted. Any distribution of this software or
+ derivative works must comply with all applicable United States export control
+ laws.
+
+ This software is made available AS IS, and Xerox Corporation makes no warranty
+ about the software, its performance or its conformity to any specification.
+*/
+
+package introduction;
+
+public class Point {
+
+ protected double x = 0;
+ protected double y = 0;
+ protected double theta = 0;
+ protected double rho = 0;
+
+ protected boolean polar = true;
+ protected boolean rectangular = true;
+
+ public double getX(){
+ makeRectangular();
+ return x;
+ }
+
+ public double getY(){
+ makeRectangular();
+ return y;
+ }
+
+ public double getTheta(){
+ makePolar();
+ return theta;
+ }
+
+ public double getRho(){
+ makePolar();
+ return rho;
+ }
+
+ public void setRectangular(double newX, double newY){
+ x = newX;
+ y = newY;
+ rectangular = true;
+ polar = false;
+ }
+
+ public void setPolar(double newTheta, double newRho){
+ theta = newTheta;
+ rho = newRho;
+ rectangular = false;
+ polar = true;
+ }
+
+ public void rotate(double angle){
+ setPolar(theta + angle, rho);
+ }
+
+ public void offset(double deltaX, double deltaY){
+ setRectangular(x + deltaX, y + deltaY);
+ }
+
+ protected void makePolar(){
+ if (!polar){
+ theta = Math.atan2(y,x);
+ rho = y / Math.sin(theta);
+ polar = true;
+ }
+ }
+
+ protected void makeRectangular(){
+ if (!rectangular) {
+ y = rho * Math.sin(theta);
+ x = rho * Math.cos(theta);
+ rectangular = true;
+ }
+ }
+
+ public String toString(){
+ return "(" + getX() + ", " + getY() + ")["
+ + getTheta() + " : " + getRho() + "]";
+ }
+
+ public static void main(String[] args){
+ Point p1 = new Point();
+ System.out.println("p1 =" + p1);
+ p1.setRectangular(5,2);
+ System.out.println("p1 =" + p1);
+ p1.setPolar( Math.PI / 4.0 , 1.0);
+ System.out.println("p1 =" + p1);
+ p1.setPolar( 0.3805 , 5.385);
+ System.out.println("p1 =" + p1);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/introduction/files.lst b/docs/modules/ROOT/pages/examples/introduction/files.lst
new file mode 100644
index 000000000..09a031d4b
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/introduction/files.lst
@@ -0,0 +1,4 @@
+Point.java
+CloneablePoint.java
+ComparablePoint.java
+HashablePoint.java
diff --git a/docs/modules/ROOT/pages/examples/ltw/HelloWorld.java b/docs/modules/ROOT/pages/examples/ltw/HelloWorld.java
new file mode 100644
index 000000000..1d44b8b82
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/ltw/HelloWorld.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ */
+public class HelloWorld {
+
+ public static void main (String[] args) {
+ System.out.println("Hello World!");
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/ltw/README b/docs/modules/ROOT/pages/examples/ltw/README
new file mode 100644
index 000000000..43868a2e2
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/ltw/README
@@ -0,0 +1,42 @@
+
+For users of JDK 1.4 the bin directory of your AspectJ distribution
+contains a script "aj" to perform load-time weaving. Java classes on
+the CLASSPATH are loaded and woven with aspects also on the CLASSPATH
+which are declared in an aop.xml file. This file is either created by
+the user or generated by the compiler. Alternatively aspects can be
+loaded from an explicitly defined ASPECTPATH.
+
+For users of JDK 1.5 the bin directory of your AspectJ distribution
+contains a script "aj5" to perform load-time weaving using an agent.
+This uses an aop.xml as described above.
+
+--To compile the HelloWorld program--
+
+ ajc -outjar hello.jar HelloWorld.java
+
+--To compile the Tracing aspect--
+
+ ajc -outjar tracing.jar -outxml Tracing.aj
+
+--To run the example--
+
+ set CLASSPATH to include hello.jar
+
+ aj HelloWorld
+
+--To run the example with tracing--
+
+ set CLASSPATH to include "tracing.jar"
+
+ aj HelloWorld
+
+--To run the example with tracing using ASPECTPATH--
+
+ set ASPECTPATH=tracing.jar
+
+ aj HelloWorld
+
+--To run the example with tracing using an agent--
+
+ aj5 HelloWorld
+
diff --git a/docs/modules/ROOT/pages/examples/ltw/Tracing.aj b/docs/modules/ROOT/pages/examples/ltw/Tracing.aj
new file mode 100644
index 000000000..de20c5403
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/ltw/Tracing.aj
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ */
+public aspect Tracing {
+
+ private pointcut mainMethod () :
+ execution(public static void main(String[]));
+
+ before () : mainMethod() {
+ System.out.println("> " + thisJoinPoint);
+ }
+
+ after () : mainMethod() {
+ System.out.println("< " + thisJoinPoint);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/Button.java b/docs/modules/ROOT/pages/examples/observer/Button.java
new file mode 100644
index 000000000..79b33caa9
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/Button.java
@@ -0,0 +1,40 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+
+package observer;
+
+import java.awt.Color;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+class Button extends java.awt.Button {
+
+ static final Color defaultBackgroundColor = Color.gray;
+ static final Color defaultForegroundColor = Color.black;
+ static final String defaultText = "cycle color";
+
+ Button(Display display) {
+ super();
+ setLabel(defaultText);
+ setBackground(defaultBackgroundColor);
+ setForeground(defaultForegroundColor);
+ addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ Button.this.click();
+ }
+ });
+ display.addToFrame(this);
+ }
+
+ public void click() {}
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/ColorLabel.java b/docs/modules/ROOT/pages/examples/observer/ColorLabel.java
new file mode 100644
index 000000000..5709545f2
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/ColorLabel.java
@@ -0,0 +1,34 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+import java.awt.Color;
+import java.awt.Label;
+
+class ColorLabel extends Label {
+
+ ColorLabel(Display display) {
+ super();
+ display.addToFrame(this);
+ }
+
+ final static Color[] colors = {Color.red, Color.blue,
+ Color.green, Color.magenta};
+ private int colorIndex = 0;
+ private int cycleCount = 0;
+ void colorCycle() {
+ cycleCount++;
+ colorIndex = (colorIndex + 1) % colors.length;
+ setBackground(colors[colorIndex]);
+ setText("" + cycleCount);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/Demo.java b/docs/modules/ROOT/pages/examples/observer/Demo.java
new file mode 100644
index 000000000..03be6a614
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/Demo.java
@@ -0,0 +1,29 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+
+public class Demo {
+ public static void main(String[] args) {
+
+ Display display = new Display();
+ Button b1 = new Button(display);
+ Button b2 = new Button(display);
+ ColorLabel c1 = new ColorLabel(display);
+ ColorLabel c2 = new ColorLabel(display);
+ ColorLabel c3 = new ColorLabel(display);
+
+ b1.addObserver(c1);
+ b1.addObserver(c2);
+ b2.addObserver(c3);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/Display.java b/docs/modules/ROOT/pages/examples/observer/Display.java
new file mode 100644
index 000000000..67ed2cb5b
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/Display.java
@@ -0,0 +1,46 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Container;
+import java.awt.Component;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.BorderLayout;
+
+/*
+ * Display is the container class that holds all the views of the
+ * colored number.
+ * In this demo, it holds buttons.
+ */
+
+class Display extends Panel {
+
+ protected Frame frame = new Frame("Subject/Observer Demo");
+
+ Display() {
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ frame.add(this, BorderLayout.CENTER);
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ void addToFrame(Component c) {
+ add(c);
+ frame.pack();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/Observer.java b/docs/modules/ROOT/pages/examples/observer/Observer.java
new file mode 100644
index 000000000..2851ebe17
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/Observer.java
@@ -0,0 +1,18 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+package observer;
+
+interface Observer {
+ void setSubject(Subject s);
+ Subject getSubject();
+ void update();
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/Subject.java b/docs/modules/ROOT/pages/examples/observer/Subject.java
new file mode 100644
index 000000000..d6c144e38
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/Subject.java
@@ -0,0 +1,21 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+import java.util.Vector;
+
+interface Subject {
+ void addObserver(Observer obs);
+ void removeObserver(Observer obs);
+ Vector getObservers();
+ Object getData();
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocol.java b/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocol.java
new file mode 100644
index 000000000..05e54d76c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocol.java
@@ -0,0 +1,41 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+
+import java.util.Vector;
+
+abstract aspect SubjectObserverProtocol {
+
+ abstract pointcut stateChanges(Subject s);
+
+ after(Subject s): stateChanges(s) {
+ for (int i = 0; i < s.getObservers().size(); i++) {
+ ((Observer)s.getObservers().elementAt(i)).update();
+ }
+ }
+
+ private Vector Subject.observers = new Vector();
+ public void Subject.addObserver(Observer obs) {
+ observers.addElement(obs);
+ obs.setSubject(this);
+ }
+ public void Subject.removeObserver(Observer obs) {
+ observers.removeElement(obs);
+ obs.setSubject(null);
+ }
+ public Vector Subject.getObservers() { return observers; }
+
+ private Subject Observer.subject = null;
+ public void Observer.setSubject(Subject s) { subject = s; }
+ public Subject Observer.getSubject() { return subject; }
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocolImpl.java b/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocolImpl.java
new file mode 100644
index 000000000..2bc75918c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/SubjectObserverProtocolImpl.java
@@ -0,0 +1,31 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package observer;
+
+import java.util.Vector;
+
+aspect SubjectObserverProtocolImpl extends SubjectObserverProtocol {
+
+ declare parents: Button implements Subject;
+ public Object Button.getData() { return this; }
+
+ declare parents: ColorLabel implements Observer;
+ public void ColorLabel.update() {
+ colorCycle();
+ }
+
+ pointcut stateChanges(Subject s):
+ target(s) &&
+ call(void Button.click());
+
+}
diff --git a/docs/modules/ROOT/pages/examples/observer/files.lst b/docs/modules/ROOT/pages/examples/observer/files.lst
new file mode 100644
index 000000000..9b800286e
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/observer/files.lst
@@ -0,0 +1,8 @@
+ColorLabel.java
+Button.java
+Display.java
+Subject.java
+Observer.java
+SubjectObserverProtocol.java
+SubjectObserverProtocolImpl.java
+Demo.java
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Bullet.java b/docs/modules/ROOT/pages/examples/spacewar/Bullet.java
new file mode 100644
index 000000000..6581dbbf7
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Bullet.java
@@ -0,0 +1,48 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Bullet.java
+Part of the Spacewar game.
+
+*/
+
+package spacewar;
+
+class Bullet extends SpaceObject {
+
+ static private final int SIZE = 3; //Can't be changed for now!!!
+ static private int LIFETIME = 50;
+
+ private int lifeLeft;
+
+ Bullet (Game theGame, double xP, double yP, double xV, double yV) {
+ super(theGame, xP, yP, xV, yV);
+ lifeLeft = LIFETIME;
+ }
+
+ int getSize() { return SIZE; }
+
+ void handleCollision(SpaceObject obj) {
+ die();
+ }
+
+ void clockTick() {
+ if (--lifeLeft == 0)
+ die();
+ super.clockTick();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Debug.java b/docs/modules/ROOT/pages/examples/spacewar/Debug.java
new file mode 100644
index 000000000..a3afb1dda
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Debug.java
@@ -0,0 +1,219 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+Debug.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.awt.Menu;
+import java.awt.CheckboxMenuItem;
+import java.awt.Frame;
+import java.awt.TextArea;
+import java.awt.Dimension;
+
+/**
+ * This aspect specifies debugging information to be output to the
+ * information window.
+ *
+ * When the debug aspect is compiled in the Frame menu has several checkbox
+ * items that can be used to control the amount of tracing information
+ * displayed. (By default the first three are off, because they generate
+ * so much information.)
+ *
+ * There are two reasons to gather all this debugging code into an aspect
+ * like this:
+ *
+ * (1) It makes it easier to understand when it is all in one place.
+ *
+ * (2) It means that we can "plug and debug". We can enable/disable
+ * the debugging code simply by weaving or not weaving this
+ * aspect in.
+ *
+ * All in all, this is a lot better than the usual practice of writing
+ * complex debugging code and then deleting it when the bug is found,
+ * only to regret it a month later when a related bug surfaces. (Or even
+ * the same bug!)
+ *
+ * This file also defines a class InfoWin, which it uses to display all the
+ * debugging information.
+ */
+aspect Debug {
+
+ private static InfoWin infoWin = new InfoWin();
+
+ private static Menu menu = new Menu("Debug");
+
+ private static CheckboxMenuItem traceConstructors =
+ new CheckboxMenuItem("trace constructors", false);
+ private static CheckboxMenuItem traceInitializations =
+ new CheckboxMenuItem("trace initializations", false);
+ private static CheckboxMenuItem traceMethods =
+ new CheckboxMenuItem("trace methods", false);
+ private static CheckboxMenuItem traceClockTick =
+ new CheckboxMenuItem("trace clock tick", false);
+ private static CheckboxMenuItem traceRegistry =
+ new CheckboxMenuItem("trace registry", true);
+ private static CheckboxMenuItem traceFireCollideDamage =
+ new CheckboxMenuItem("trace fire, collide, damage", true);
+
+ after() returning (SWFrame frame): call(SWFrame+.new(..)) {
+ menu.add(traceConstructors);
+ menu.add(traceInitializations);
+ menu.add(traceMethods);
+ menu.add(traceClockTick);
+ menu.add(traceRegistry);
+ menu.add(traceFireCollideDamage);
+ frame.getMenuBar().add(menu);
+ }
+
+ /*
+ * all constructors
+ */
+ pointcut allConstructorsCut():
+ call((spacewar.* && !(Debug+ || InfoWin+)).new(..));
+
+ before(): allConstructorsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("begin constructing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ after() returning: allConstructorsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("done constructing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * All dynamic initializations
+ */
+ pointcut allInitializationsCut():
+ initialization((spacewar.* && !(Debug+ || InfoWin+)).new(..));
+
+ before(): allInitializationsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("begin initializing " + thisJoinPoint.getSignature());
+ }
+ }
+ after() returning : allInitializationsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("done initializing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * all methods
+ */
+ pointcut allMethodsCut():
+ execution(* (spacewar.* && !(Debug+ || InfoWin+)).*(..));
+
+ before(): allMethodsCut() {
+ if (traceMethods.getState()) {
+ infoWin.println("entering " + thisJoinPoint.getSignature());
+ }
+ }
+ after() returning : allMethodsCut() {
+ if (traceMethods.getState()) {
+ infoWin.println("exiting " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * clock ticks
+ */
+ after(Object obj) returning :
+ (target(obj) && (target(Game) ||
+ target(Registry) ||
+ target(SpaceObject)))
+ && call(void clockTick()) {
+ if (traceClockTick.getState())
+ infoWin.println("ticking " + obj);
+ }
+
+ /*
+ * registry contents
+ */
+ after(Registry registry) returning :
+ target(registry) && (call(void register(..)) ||
+ call(void unregister(..))) {
+ if (traceRegistry.getState())
+ infoWin.println(registry.getTable().size() +
+ " space objects in the registry.");
+ }
+
+ /*
+ * fire, collide, damage
+ */
+ after() returning : call(void Ship.fire()) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println("firing");
+ }
+
+ after(Ship ship, SpaceObject obj) returning :
+ call(void handleCollision(SpaceObject)) && target(ship) && args(obj) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println(ship + " collides with " + obj);
+ }
+
+ after(Ship shipA, Ship shipB) returning :
+ execution(void Ship.bounce(Ship, Ship)) && args(shipA, shipB) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println(shipA + " bounces with " + shipB);
+ }
+
+ before(Ship ship, double amount):
+ call(void Ship.inflictDamage(double)) && target(ship) && args(amount) {
+ if (traceFireCollideDamage.getState())
+ if (amount > 0)
+ infoWin.println(ship + "gets " +
+ amount + " damage (" +
+ ship.getDamage() + ")");
+ }
+
+}
+
+class InfoWin {
+ private Frame frame;
+ private TextArea info;
+
+ InfoWin() {
+ frame = new Frame("debugging info for spacewar game");
+ info = new TextArea();
+ info.setEditable(false);
+
+ Dimension screenSize = frame.getToolkit().getScreenSize();
+ frame.setSize(250, 600);
+ frame.setLocation(screenSize.width - 250, 0);
+ frame.add(info);
+ frame.show();
+ frame.toFront();
+ }
+
+ void clear() {
+ info.setText("");
+ }
+
+ void println(String line) {
+ info.append(line + "\n");
+ }
+
+ void print(String line) {
+ info.append(line);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Display.java b/docs/modules/ROOT/pages/examples/spacewar/Display.java
new file mode 100644
index 000000000..4236407ee
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Display.java
@@ -0,0 +1,165 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.awt.Graphics;
+import java.awt.Canvas;
+import java.awt.Image;
+
+/**
+ * The display aspects capture the look and feel of the Game in modular
+ * pluggable units.
+ *
+ * The model is that constructing a concrete subclass of Display attaches that
+ * kind of display to the game. It will Display the game as it goes along.
+ * A game can have any number of displays. Any of the displays will accept
+ * keyboard input.
+ *
+ */
+
+class Display extends Canvas {
+
+ private static Vector DISPLAYS = new Vector(2);
+ private static Vector PLAYERS = new Vector(2);
+ private static Pilot pilot1, pilot2;
+
+ Game game;
+ SWFrame frame;
+ Image offImage;
+ Graphics offGraphics;
+
+ Game getGame() { return game; }
+ static Pilot getPilot1() { return pilot1; }
+ static Pilot getPilot2() { return pilot2; }
+
+ Display(Game g) {
+ super();
+ game = g;
+
+ frame = new SWFrame(game, this);
+ DISPLAYS.addElement(this);
+ }
+
+
+ void noticeSizeChange() {
+ initializeOffImage();
+ }
+
+ private void initializeOffImage () {
+ int w = getSize().width;
+ int h = getSize().height;
+ if ( w > 0 & h > 0) {
+ offImage = createImage(w, h);
+ offGraphics = offImage.getGraphics();
+ }
+ }
+
+ /*
+ * In our double buffering scheme, painting just means copying the buffer
+ * to the screen. The Display aspect draws into the buffer.
+ */
+ public void paint(Graphics g) {
+ if (offImage != null)
+ g.drawImage(offImage, 0, 0, null);
+ }
+
+ public void update(Graphics g) {
+ /*
+ * There are 4 steps to this:
+ * - clear the double buffer
+ * - paint the objects into the double buffer
+ * - paint the status into the double buffer
+ * - paint the doublebuffer into the buffer
+ */
+ offGraphics.setColor(getBackground());
+ offGraphics.fillRect(0, 0, getBounds().width, getBounds().height);
+ paintObjects(offGraphics);
+ paintStatus(offGraphics);
+ g.drawImage(offImage, 0, 0, null);
+ }
+
+ void paintObjects(Graphics g) { }
+ void paintStatus(Graphics g) {}
+
+ static aspect DisplayAspect {
+
+ after (String mode) returning (Game game): call(Game+.new(String)) && args(mode) {
+ new Display1(game);
+ new Display2(game);
+
+ if ( mode.equals("1") ) {
+ pilot1 = game.newPlayer(1);
+ }
+ else if ( mode.equals("2") ) {
+ pilot1 = game.newPlayer(1);
+ pilot2 = game.newPlayer(2);
+ }
+ else if (mode. equals("demo")) {
+ pilot1 = game.newRobot(1);
+ pilot2 = game.newRobot(2);
+ } else {
+ game.error("Invalid mode: " + mode);
+ game.quit();
+ }
+ }
+
+
+ /*
+ * I'm not really sure this belongs here.
+ *
+ * Being here what it does is makes the Display aspect
+ * responsible for having the Players couple up to it. That's
+ * kind of nice, but its a bit incomplete, since Player is
+ * really part of the GUI, not part of the core Game.
+ *
+ * In a future re-factoring this will get worked out better.
+ * What will happen is that GUI will be an aspect that has the
+ * core GUI. Each of the different kinds of displays will be
+ * aspects that tie themselves in.
+ */
+ after () returning (Player player): call(Player+.new(..)) {
+ Enumeration elements = DISPLAYS.elements();
+ while ( elements.hasMoreElements() ) {
+ Display display = (Display)elements.nextElement();
+ display.addKeyListener(player);
+ }
+ }
+
+ after() returning (Display display): call(Display+.new(..)) {
+ display.noticeSizeChange();
+ }
+
+ after(Display display) returning (): call(void setSize(..)) && target(display) {
+ display.noticeSizeChange();
+ }
+
+ after() returning : call(void Game.clockTick()) {
+ Enumeration elements = DISPLAYS.elements();
+ while ( elements.hasMoreElements() ) {
+ Display display = (Display)elements.nextElement();
+ display.repaint();
+ }
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Display1.java b/docs/modules/ROOT/pages/examples/spacewar/Display1.java
new file mode 100644
index 000000000..622f7d051
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Display1.java
@@ -0,0 +1,201 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display1.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+
+import java.awt.Graphics;
+import java.awt.Color;
+import java.util.Random;
+
+/**
+ * This is the standard display aspect.
+ */
+class Display1 extends Display {
+ /*
+ * Here's the color scheme for the game. No other places in this file
+ * should say Color.xxx. Instead, that color should be given a symbolic
+ * name here.
+ */
+ private static Color backgroundColor = Color.black;
+ private static Color player1ShipColor = Color.white;
+ private static Color player2ShipColor = Color.gray;
+ private static Color robotShipColor = new Color(0xa00000);
+ private static Color flameColor = Color.red;
+ private static Color shipExplosionColor = Color.red;
+ private static Color bulletColor = Color.green;
+ private static Color energyPacketOuterColor = Color.blue;
+ private static Color energyPacketInnerColor = new Color(0x7070FF);
+ private static Color statusLabelsColor = Color.white;
+ private static Color statusMeterBorderColor = Color.white;
+ private static Color energyStatusMeterColor = Color.blue;
+ private static Color damageStatusMeterColor = Color.red;
+
+
+ Display1(Game game) {
+ super(game);
+ frame.setLocation(20, 20);
+ }
+
+ void noticeSizeChange() {
+ super.noticeSizeChange();
+ setBackground(backgroundColor);
+ }
+
+ void paintObjects(Graphics g) {
+ SpaceObject[] objects = game.getRegistry().getObjects();
+ final int len = objects.length;
+ for (int i = 0; i < len; i++) {
+ objects[i].paint(g);
+ }
+ }
+
+ static aspect SpaceObjectPainting {
+
+ abstract private void SpaceObject.paint(Graphics g);
+
+ /*
+ * Ships are by far and away the most complex of the space Objects
+ * to paint. First off, we need to set the color when the ship
+ * is made.
+ */
+ private Color Ship.color;
+
+ after(Pilot pilot) returning (Ship ship): call(Ship Game.newShip(Pilot)) && args(pilot) {
+ if (pilot.getNumber() == 1)
+ ship.color = player1ShipColor;
+ else if (pilot.getNumber() == 2)
+ ship.color = player2ShipColor;
+ else
+ ship.color = robotShipColor;
+ }
+
+ private void Ship.paint(Graphics g) {
+ final double PI = Math.PI;
+ int[] radius = {15, 12, -4, 12, -9, -15, -9};
+ double[] angle = {0, PI * 3/4, 0, -PI * 3/4, PI/8, 0, -PI/8};
+ int[] x;
+ int[] y;
+
+ Random random = new Random();
+
+ if (this.getDamage() >= this.MAX_DAMAGE) {
+ int lines = 20;
+ x = new int[lines];
+ y = new int[lines];
+ g.setColor(shipExplosionColor);
+ for (int i = 0; i < lines; i++) {
+ x[i] = (int)(this.getXPos()) + random.nextInt() % 20;
+ y[i] = (int)(this.getYPos()) + random.nextInt() % 20;
+ }
+ for (int i = 0; i < lines; i++)
+ g.drawLine(x[i], y[i], x[(i + 1) % lines], y[(i + 1) % lines]);
+ } else {
+ x = new int[7];
+ y = new int[7];
+
+ g.setColor(this.color);
+
+ radius[5] += random.nextInt() % 3;
+ // convert coordinates from polar to cartesian
+ for (int i = 0; i < 7; i++) {
+ x[i] = (int)
+ (this.getXPos() +
+ Math.cos(this.getOrientation() + angle[i]) * radius[i]);
+ y[i] = (int)
+ (this.getYPos() +
+ Math.sin(this.getOrientation() + angle[i]) * radius[i]);
+ }
+
+ // draw the body as a polygon
+ g.drawPolygon(x, y, 4);
+
+ // if the ship is accelerating, draw in a flame
+ if (this.getRAcc() != 0) {
+ g.setColor(flameColor);
+ g.drawLine(x[4], y[4], x[5], y[5]);
+ g.drawLine(x[5], y[5], x[6], y[6]);
+ }
+ }
+ }
+
+ /*
+ * Bullets
+ */
+ private void Bullet.paint(Graphics g) {
+ g.setColor(bulletColor);
+ g.fillOval((int)this.getXPos() - 1,
+ (int)this.getYPos() - 1,
+ 3,
+ 3);
+ }
+
+ /*
+ * energy packets
+ */
+ private void EnergyPacket.paint(Graphics g) {
+ g.setColor(energyPacketOuterColor);
+ g.fillOval((int)this.getXPos() - 5,
+ (int)this.getYPos() - 5,
+ 10, 10);
+ g.setColor(energyPacketInnerColor);
+ g.fillOval((int)this.getXPos() - 2,
+ (int)this.getYPos() - 2,
+ 3, 3);
+ }
+ }
+
+
+ void paintStatus(Graphics g) {
+ int left1 = 60;
+ int top1 = 0;
+
+ int left2 = 200;
+ int top2 = 0;
+
+ g.setColor(statusLabelsColor);
+ g.drawString("energy:", 5, top1 + 15);
+ g.drawString("damage:", 5, top1 + 30);
+
+ if (getPilot1() != null)
+ paintLevels(g, getPilot1().getShip(), top1, left1);
+ if (getPilot2() != null)
+ paintLevels(g, getPilot2().getShip(), top2, left2);
+ }
+
+ static void paintLevels(Graphics g, Ship ship, int top, int left) {
+ if (ship == null)
+ return;
+ else if (ship.isAlive()) {
+ g.setColor(statusMeterBorderColor);
+ g.drawRect(left, top + 6, 101, 10);
+ g.drawRect(left, top + 21, 101, 10);
+ g.setColor(energyStatusMeterColor);
+ g.fillRect(left + 1, top + 7, (int)(ship.getEnergyLevel()*100), 9);
+ g.setColor(damageStatusMeterColor);
+ g.fillRect(left + 1, top + 22, (int)(ship.getDamageLevel()*100), 9);
+ }
+ else {
+ g.setColor(damageStatusMeterColor);
+ g.drawString("Ship is destroyed", left+1, top+15);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Display2.java b/docs/modules/ROOT/pages/examples/spacewar/Display2.java
new file mode 100644
index 000000000..0430a1cc5
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Display2.java
@@ -0,0 +1,136 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display2.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+
+import java.awt.Graphics;
+import java.awt.Color;
+
+
+/**
+ * This is the cheap Display aspect.
+ */
+class Display2 extends Display {
+
+ Display2(Game game) {
+ super(game);
+ frame.setLocation(540, 20);
+ }
+
+ void noticeSizeChange() {
+ super.noticeSizeChange();
+ setBackground(Color.darkGray);
+ }
+
+ void paintObjects(Graphics g) {
+ SpaceObject[] objects = game.getRegistry().getObjects();
+ final int len = objects.length;
+ for (int i = 0; i < len; i++) {
+ objects[i].paint(g);
+ }
+ }
+
+ static aspect SpaceObjectPainting {
+
+ abstract private void SpaceObject.paint(Graphics g);
+
+ /*
+ * Ships are by far and away the most complex of the space Objects
+ * to paint.
+ */
+ private Color Ship.color;
+
+ after(Pilot pilot) returning (Ship ship): call(Ship Game.newShip(Pilot)) && args(pilot) {
+ if (pilot.getNumber() == 1)
+ ship.color = Color.white;
+ else if (pilot.getNumber() == 2)
+ ship.color = Color.gray;
+ else
+ ship.color = new Color(0xa00000);
+ }
+
+ private void Ship.paint(Graphics g) {
+ if (this.getDamage() < this.MAX_DAMAGE) {
+ double x = this.getXPos();
+ double y = this.getYPos();
+ double sinTheta = Math.sin(this.getOrientation());
+ double cosTheta = Math.cos(this.getOrientation());
+
+ g.setColor(color);
+ g.drawLine((int)(x + 8*cosTheta), (int)(y + 8*sinTheta),
+ (int)(x - 8*cosTheta), (int)(y - 8*sinTheta));
+
+ // if the ship is accelerating, draw thruster
+ if (this.getRAcc() != 0) {
+ g.setColor(Color.red);
+ g.fillOval((int)(x - 8*cosTheta), (int)(y - 8*sinTheta), 6, 6);
+ }
+ }
+ }
+
+ private void Bullet.paint(Graphics g) {
+ g.setColor(Color.green);
+ g.fillOval((int)this.getXPos() - 1,
+ (int)this.getYPos() - 1,
+ 3,
+ 3);
+ }
+
+ private void EnergyPacket.paint(Graphics g) {
+ g.setColor(Color.white);
+ g.fillOval((int)this.getXPos() - 5,
+ (int)this.getYPos() - 5,
+ 10,
+ 10);
+ }
+ }
+
+ void paintStatus(Graphics g) {
+ int left1 = 60;
+ int top1 = 0;
+
+ int left2 = 200;
+ int top2 = 0;
+
+ g.setColor(Color.white);
+ g.drawString("energy:", 5, top1 + 15);
+ g.drawString("damage:", 5, top1 + 30);
+
+ if (getPilot1() != null)
+ paintLevels(g, getPilot1().getShip(), top1, left1);
+ if (getPilot2() != null)
+ paintLevels(g, getPilot2().getShip(), top2, left2);
+ }
+
+ void paintLevels(Graphics g, Ship ship, int top, int left) {
+ if (ship == null)
+ return;
+ else if (ship.isAlive()) {
+ g.drawString(Float.toString(ship.getEnergyLevel()*100), left+1, top+15);
+ g.drawString(Float.toString(ship.getDamageLevel()*100), left+1, top+30);
+ }
+ else {
+ g.setColor(Color.red);
+ g.drawString("Ship is destroyed", left+1, top+15);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/EnergyPacket.java b/docs/modules/ROOT/pages/examples/spacewar/EnergyPacket.java
new file mode 100644
index 000000000..d7bc4f9ec
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/EnergyPacket.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+EnergyPacket.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+class EnergyPacket extends SpaceObject {
+
+ static private final int SIZE = 5; //Can't be changed for now!!!
+ int getSize() { return SIZE; }
+
+ private double energy;
+
+ double getEnergy() { return energy; }
+
+ EnergyPacket(Game theGame,
+ double xP, double yP, double xV, double yV, double e) {
+ super(theGame, xP, yP, xV, yV);
+ energy = e;
+ }
+
+ void handleCollision(SpaceObject obj) {
+ die();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/EnergyPacketProducer.java b/docs/modules/ROOT/pages/examples/spacewar/EnergyPacketProducer.java
new file mode 100644
index 000000000..efd276042
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/EnergyPacketProducer.java
@@ -0,0 +1,63 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+EnergyPacketProducer.java
+Part of the Spacewar system.
+
+ This implementation creates booby-trapped packets 20% of the time.
+
+*/
+
+package spacewar;
+
+
+class EnergyPacketProducer extends Thread {
+ private final static int MIN = -20;
+ private final static int MAX = 80;
+ private final static int EXPECTEDINTERVAL = 15;
+
+ private Game game;
+
+ Game getGame() { return game; }
+
+ EnergyPacketProducer(Game theGame) {
+ super("EnergyPacketProducer");
+ game = theGame;
+ }
+
+ public void run() {
+ while(true) {
+ produceAPacket();
+ waitForABit();
+ }
+ }
+
+ void waitForABit() {
+ try { Thread.sleep((int)(Math.random() * EXPECTEDINTERVAL * 2000)); }
+ catch (InterruptedException e) {}
+ }
+
+ void produceAPacket() {
+ EnergyPacket pkt =
+ new EnergyPacket(game,
+ Math.random() * getGame().getWidth(),
+ Math.random() * getGame().getHeight(),
+ Math.random() * 2 - 1,
+ Math.random() * 2 - 1,
+ Math.random() * (MAX - MIN) + MIN);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/EnsureShipIsAlive.java b/docs/modules/ROOT/pages/examples/spacewar/EnsureShipIsAlive.java
new file mode 100644
index 000000000..f7b949a92
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/EnsureShipIsAlive.java
@@ -0,0 +1,35 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+Ship.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+/**
+ * This aspect makes sure that the ship is alive before performing any console
+ * commands.
+ *
+ */
+aspect EnsureShipIsAlive {
+ void around (Ship ship): Ship.helmCommandsCut(ship) {
+ if ( ship.isAlive() ) {
+ proceed(ship);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Game.java b/docs/modules/ROOT/pages/examples/spacewar/Game.java
new file mode 100644
index 000000000..54b1bf2ac
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Game.java
@@ -0,0 +1,215 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Game.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.awt.Dimension;
+
+/**
+ * The Game class is the root of the spacewar game. To start a spacewar
+ * game, you can either call the main method, or instantiate this class
+ * directly.
+ *
+ * Synchronization is done by the GameSynchronization aspect.
+ */
+public class Game extends Thread {
+
+ /**
+ * To run the game from top level, simply say Java Game, as usual. Passing
+ * an argument makes the game run in demo mode. Without an argument it runs
+ * in the normal player mode.
+ */
+ public static void main(String[] args) {
+ if ( args.length == 0 )
+ new Game("1").run();
+ new Game(args[0]).run();
+ }
+
+
+ private Timer timer;
+ private EnergyPacketProducer ePP;
+
+ private Registry registry;
+ private Pilot pilot1, pilot2;
+
+ private Dimension screenSize = new Dimension(500, 500);
+
+ Registry getRegistry() { return registry; }
+ Pilot getPilot1() { return pilot1; }
+ Pilot getPilot2() { return pilot2; }
+
+ /** returns the width of the screen, delegating to screenSize */
+ int getWidth() { return screenSize.width; }
+
+ /** returns the height of the screen, delegating to screenSize */
+ int getHeight() { return screenSize.height; }
+
+ /**
+ * To run the game, simply instantiate this class. It runs in its own
+ * thread. You can instantiate multiple games at once. For the time being
+ * the only way to end the game is to exit from the Java VM.
+ *
+ * @param mode Controls whether the game runs in demo mode or not. True
+ * means it is a demo, false means it runs in normal 2 player mode.
+ */
+ public Game(String mode) {
+ timer = new Timer(this);
+ ePP = new EnergyPacketProducer(this);
+ registry = new Registry(this);
+ }
+
+ public void run() {
+ timer.start();
+ ePP.start();
+
+ while(true) {
+ try {
+ newRobot(3);
+ Thread.sleep(15000);
+ }
+ catch (InterruptedException e) {}
+ }
+ }
+
+
+ /**
+ * add a robot to the game. This is a menu command.
+ */
+ void addRobot() {
+ newRobot(3);
+ }
+
+ /**
+ * resurrect the ships in the game. This is a menu command.
+ */
+ void resetShips() {
+ Ship[] ships = registry.getShips();
+
+ for (int i = 0; i < ships.length; i++) {
+ Ship ship = ships[i];
+ Pilot pilot = ship.getPilot();
+ newShip(pilot);
+ }
+ }
+
+ /**
+ * leave the game. This is a menu command.
+ */
+ void quit() {
+ System.exit(0);
+ }
+
+ void error(Object o) {
+ System.err.println(o);
+ }
+
+
+ /**
+ * returns a new player. With {@link #newRobot} and {@link
+ * #newShip}, the only ways to make a Player, a Robot, or a Ship.
+ * The structural invariant is that there should be no calls to
+ * new of one of these three classes outside these three methods.
+ */
+ Player newPlayer(int number) {
+ Player player = new Player(this, number);
+ newShip(player);
+ return player;
+ }
+
+ /**
+ * returns a new robot. With {@link #newPlayer} and {@link
+ * #newShip}, the only ways to make a Player, a Robot, or a Ship.
+ * The structural invariant is that there should be no calls to
+ * new of one of these three classes outside these three methods.
+ */
+ Robot newRobot(int number) {
+ Robot robot = new Robot(this, number);
+ newShip(robot);
+ robot.start();
+ return robot;
+ }
+
+ /**
+ * returns a new ship. With {@link #newRobot} and {@link
+ * #newPlayer}, the only ways to make a Player, a Robot, or a
+ * Ship. The structural invariant is that there should be no
+ * calls to new of one of these three classes outside these three
+ * methods.
+ */
+ Ship newShip(Pilot pilot) {
+ //
+ // If there is an old ship (we're doing a reset), then remove it from
+ // the registry.
+ //
+ Ship oldShip = pilot.getShip();
+ if (! (oldShip == null))
+ oldShip.die();
+
+ Ship newShip = new Ship(this,
+ Math.random() * getWidth(),
+ Math.random() * getHeight(),
+ Math.random() * Math.PI * 2);
+ pilot.setShip(newShip);
+ newShip.setPilot(pilot);
+
+ return newShip;
+ }
+
+ void clockTick() {
+ registry.clockTick();
+ handleCollisions();
+ }
+
+ // collision detection
+
+ void handleCollisions() {
+ SpaceObject[] objects = registry.getObjects();
+
+ SpaceObject objI, objJ;
+ for (int i = 0; i < objects.length; i++) {
+ objI = objects[i];
+ for (int j = i + 1; j < objects.length; j++) {
+ objJ = objects[j];
+ if (objI instanceof Bullet && objJ instanceof Bullet)
+ continue;
+ if (isCollision(objI, objJ)) {
+ if (objI instanceof Ship && objJ instanceof Ship)
+ Ship.bounce((Ship)(objI), (Ship)(objJ));
+ else {
+ objI.handleCollision(objJ);
+ objJ.handleCollision(objI);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Is the distance between the two centers less than the sum of the two
+ * radii. This is a cheap and dirty (i.e. wrong) implementation of this.
+ */
+ static boolean isCollision(SpaceObject a, SpaceObject b) {
+ return (Math.abs(a.getXPos() - b.getXPos()) +
+ Math.abs(a.getYPos() - b.getYPos())) <
+ (a.getSize()/2 + b.getSize()/2);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/GameSynchronization.java b/docs/modules/ROOT/pages/examples/spacewar/GameSynchronization.java
new file mode 100644
index 000000000..dcf42e904
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/GameSynchronization.java
@@ -0,0 +1,54 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+RegistrySynchronization.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import coordination.Coordinator;
+
+/**
+ * This aspect ensures synchronized access to methods of the Game in the
+ * presence of several threads.
+ *
+ * It uses the Coordinator class, from the AspectJ coordination library.
+ * (This case is right on the borderline of being too simple to use the
+ * coordination library, but we use it anyways to keep the similarity
+ * with the RegistrySynchronizer.)
+ *
+ * It uses a per-Game coordination scheme, so there is one instance of
+ * this class for each instance of the Game class. When this class is
+ * constructed, it registers appropriate mutexes and selfexes using
+ * the behavior inherited from Coordinator.
+ *
+ * The coordination constraints for the Game are simple. We just need to
+ * make sure that newShip and handleCollisions are mutually exclusive. That
+ * ensures that they we can't destroy a ship that has just been replaced.
+ */
+aspect GameSynchronization extends Coordinator perthis(this(Game)) {
+
+ protected pointcut synchronizationPoint():
+ call(void Game.handleCollisions(..)) || call(Ship Game.newShip(..));
+
+ public GameSynchronization() {
+ addMutex(new String[] {"handleCollisions", "newShip"});
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Makefile b/docs/modules/ROOT/pages/examples/spacewar/Makefile
new file mode 100644
index 000000000..e425dfd55
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Makefile
@@ -0,0 +1,12 @@
+SHELL=bash
+ACJOPTS=-verbose -nosymbols
+AJC=ajc
+
+.PHONY: demo debug
+
+demo:
+ $(AJC) $(ACJOPTS) @demo.lst
+
+debug:
+ $(AJC) $(ACJOPTS) @debug.lst
+
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Pilot.java b/docs/modules/ROOT/pages/examples/spacewar/Pilot.java
new file mode 100644
index 000000000..330d860bf
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Pilot.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+*/
+
+package spacewar;
+
+
+/**
+ * Pilot is the abstract superclass of Player and Robot.
+ *
+ */
+
+abstract class Pilot {
+ private Game game;
+ private int number;
+ protected Ship ship = null;
+
+ Game getGame() { return game; }
+ int getNumber() { return number; }
+ Ship getShip() { return ship; }
+
+ void setShip(Ship s) { ship = s; }
+
+ Pilot (Game g, int n) {
+ super();
+ game = g;
+ number = n;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Player.java b/docs/modules/ROOT/pages/examples/spacewar/Player.java
new file mode 100644
index 000000000..3899c6d52
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Player.java
@@ -0,0 +1,121 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+*/
+
+package spacewar;
+
+import java.awt.event.KeyListener;
+import java.awt.event.KeyEvent;
+
+class Player extends Pilot implements KeyListener {
+
+ private KeyMapping keyMapping;
+
+ /** current rotation key */
+ private int rotation_direction = Ship.STOP; // current rotation key
+
+ /** current thrust */
+ private boolean thrust_on = false;
+
+ Player(Game theGame, int number) {
+ super(theGame,number);
+
+ if (getNumber() == 1)
+ keyMapping = KeyMapping.keyMapping1;
+ else if (getNumber() == 2)
+ keyMapping = KeyMapping.keyMapping2;
+
+ }
+
+ public void keyPressed(KeyEvent e) {
+ int keyCode = e.getKeyCode();
+ boolean consumed = true;
+
+ if (keyCode == keyMapping.fire) {
+ ship.fire();
+ }
+ else if (keyCode == keyMapping.thrust && !thrust_on) {
+ ship.thrust(true);
+ thrust_on = true;
+ }
+ else if (keyCode == keyMapping.right &&
+ rotation_direction != Ship.COUNTERCLOCKWISE) {
+ //start rotating clockwise unless already rotating in the
+ //opposite direction
+ rotation_direction = Ship.CLOCKWISE;
+ ship.rotate(Ship.CLOCKWISE);
+ }
+ else if (keyCode == keyMapping.left &&
+ rotation_direction != Ship.CLOCKWISE) {
+ //start rotating counterclockwise unless already rotating in the
+ //opposite direction
+ rotation_direction = Ship.COUNTERCLOCKWISE;
+ ship.rotate(Ship.COUNTERCLOCKWISE);
+ }
+ else {
+ consumed = false;
+ }
+
+ if (consumed) e.consume();
+ }
+
+ public void keyReleased(KeyEvent e) {
+ int keyCode = e.getKeyCode();
+
+ if (keyCode == keyMapping.thrust) {
+ ship.thrust(false); //engine off
+ thrust_on = false;
+ }
+ else if (keyCode == keyMapping.right &&
+ rotation_direction == Ship.CLOCKWISE
+ ||
+ keyCode == keyMapping.left &&
+ rotation_direction == Ship.COUNTERCLOCKWISE) {
+ ship.rotate(Ship.STOP); //stop rotation
+ rotation_direction = Ship.STOP;
+ }
+ }
+
+ public void keyTyped(KeyEvent e) {
+ // have to implement this because it's in KeyListener
+ }
+}
+
+class KeyMapping {
+
+ static final KeyMapping keyMapping1 =
+ new KeyMapping(KeyEvent.VK_LEFT,
+ KeyEvent.VK_RIGHT,
+ KeyEvent.VK_UP,
+ KeyEvent.VK_SPACE);
+
+ static final KeyMapping keyMapping2 =
+ new KeyMapping(KeyEvent.VK_X,
+ KeyEvent.VK_V,
+ KeyEvent.VK_D,
+ KeyEvent.VK_ALT);
+
+ int left, right, thrust, fire;
+
+ KeyMapping(int k_left, int k_right, int k_thrust, int k_fire) {
+ left = k_left;
+ right = k_right;
+ thrust = k_thrust;
+ fire = k_fire;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/README.adoc b/docs/modules/ROOT/pages/examples/spacewar/README.adoc
new file mode 100644
index 000000000..9991867a3
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/README.adoc
@@ -0,0 +1,56 @@
+[[_5]]
+== Exploring the Spacewar Example
+
+_© Copyright 1997-2001 Xerox Corporation. All rights reserved._
+
+_Last updated: January 10, 2001_
+
+The code in this directory is an implementation of the classic video
+game Spacewar.
+
+The Spacewar game is intended to provide a modest-sized example of a
+program that uses aspects. The code for this example is evolving, as we
+add new features to AspectJ and come up with a better understanding of
+how to use the features.
+
+In order to compile and run this example, make sure to have the latest
+version of AspectJ correctly installed. If you're not sure you do, try
+the helloworld example first by following the instructions in
+xref:../doc/primer/default.html[Primer] section Getting Started.
+
+[[_5_1]]
+=== Compiling Spacewar
+
+* Change to the `examples` directory.
+* Type `ajc -argfile spacewar/demo.lst` to compile the system.
+
+[[_5_2]]
+=== Running Spacewar
+
+* In the examples directory, type `java spacewar.Game`
+
+When the game starts up you will see two different displays. These are
+the two built-in display aspects of the game. In each you will see a
+single white ship and two red ships. The white ship is yours to control;
+the red ships are an enemy robots. Your ship is controlled with the four
+arrow keys to turn, thrust and stop; the spacebar fires. As you play,
+the game will be displayed in both windows.
+
+When running on a 1.4 or later VM, click in the main panel to give it
+focus so that your keystrokes are recognized.
+
+You can quit the game with ctl-Q.
+
+[[_5_3]]
+=== Exploring the Code
+
+There is one other built-in configurations for the Spacewar game. Try it
+by typing `ajc @spacewar\debug.lst`. This compiles in an elaborate
+debugging aspect for the game.
+
+We recommend you explore the Spacewar source code and look at the
+aspects that it uses. You will find several of them, of different scales
+and different degrees of cross-cutting. Remember that these represent
+our evolving understanding of how to use AspectJ to implement Spacewar.
+If you believe we should be doing something differently, then please let
+us know.
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Registry.java b/docs/modules/ROOT/pages/examples/spacewar/Registry.java
new file mode 100644
index 000000000..a9cec0418
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Registry.java
@@ -0,0 +1,126 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Registry.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * The Registry keeps track of all the space objects that are floating around.
+ * It basically supports register, unregister and contents type operations.
+ *
+ * The synchronization is done by the RegistrySynchronization aspect.
+ */
+
+class Registry {
+
+ private Hashtable table;
+ private Game game;
+
+ Game getGame() { return game; }
+
+ Registry (Game theGame) {
+ game = theGame;
+ table = new Hashtable();
+ }
+
+
+ void register(SpaceObject object) {
+ table.put(object, object);
+ }
+
+ void unregister(SpaceObject object) {
+ table.remove(object);
+ }
+
+ /*
+ * It is an invariant of the design that only two points in SpaceObject
+ * should call register and unregister. This aspect enforces that.
+ *
+ * Unfortunately, in the current compiler, we get a static warning when
+ * there are no illegal calls that this advice has no targets. That will
+ * be fixed in a future release. For the time being the dummy method
+ * just below this fixes that.
+ */
+ static aspect RegistrationProtection {
+ after() returning():
+ (call(void Registry.register(SpaceObject)) ||
+ call(void Registry.unregister(SpaceObject))) &&
+ !(within(SpaceObject) && (withincode(new(..)) ||
+ withincode(void die()))) {
+ throw new IllegalAccessError(
+ "This is an illegal call to " + thisJoinPoint + "\n" +
+ "Only the constructor and the die() on SpaceObject\n" +
+ "should call the primitive registry operations.");
+ }
+ }
+
+ void dummy() { // see comment above
+ register(getObjects()[0]);
+ unregister(getObjects()[0]);
+ }
+
+
+ SpaceObject[] getObjects() {
+ SpaceObject[] allObjects = new SpaceObject[table.size()];
+ Enumeration elements = table.elements();
+ for(int i = 0; elements.hasMoreElements(); i++) {
+ allObjects[i] = (SpaceObject)(elements.nextElement());
+ }
+ return allObjects;
+ }
+
+ Ship[] getShips() {
+ //
+ // First we have to put just the Ships into a vector, then we can put
+ // them into an array of exactly the right length.
+ //
+ Ship[] arrayOfShips;
+ Vector vectorOfShips = new Vector();
+ Enumeration elements = table.elements();
+ while (elements.hasMoreElements()) {
+ Object object = elements.nextElement();
+ if (object instanceof Ship) {
+ vectorOfShips.addElement(object);
+ }
+ }
+
+ arrayOfShips = new Ship[(vectorOfShips.size())];
+ vectorOfShips.copyInto(arrayOfShips);
+ return arrayOfShips;
+ }
+
+ Hashtable getTable() { return table; }
+
+ //
+ // The protocol for clockTick is that it automatically cascades.
+ //
+ void clockTick() {
+ Enumeration elements = table.elements();
+ while (elements.hasMoreElements()) {
+ ((SpaceObject)elements.nextElement()).clockTick();
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/examples/spacewar/RegistrySynchronization.java b/docs/modules/ROOT/pages/examples/spacewar/RegistrySynchronization.java
new file mode 100644
index 000000000..986e4bd30
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/RegistrySynchronization.java
@@ -0,0 +1,58 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+RegistrySynchronization.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import coordination.Coordinator;
+
+
+/**
+ * This aspect ensures synchronized access to methods of the Registry in
+ * the presence of several threads.
+ *
+ * It uses the Coordinator class, from the AspectJ coordination library.
+ *
+ * It uses a per-Registry coordination scheme, so there is one instance of
+ * this class for each instance of the Registry class. When this class is
+ * constructed, it registers appropriate mutexes and selfexes using the
+ * behavior inherited from Coordinator.
+ *
+ * The mutating methods (register and unregister) should be self-exclusive.
+ * Each reader method should be mutually exclusive with the mutating
+ * methods. But the readers can run concurrently. */
+aspect RegistrySynchronization extends Coordinator perthis(this(Registry)) {
+
+ protected pointcut synchronizationPoint():
+ call(void Registry.register(..)) ||
+ call(void Registry.unregister(..)) ||
+ call(SpaceObject[] Registry.getObjects(..)) ||
+ call(Ship[] Registry.getShips(..));
+
+ public RegistrySynchronization() {
+ addSelfex("register");
+ addSelfex("unregister");
+
+ addMutex(new String[] {"register", "unregister", "getObjects"});
+ addMutex(new String[] {"register", "unregister", "getShips"});
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Robot.java b/docs/modules/ROOT/pages/examples/spacewar/Robot.java
new file mode 100644
index 000000000..05f276108
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Robot.java
@@ -0,0 +1,201 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Robot.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.util.Random;
+
+/**
+ * Robot is an automatic pilot that now has quite a bit of intelligence.
+ * So, beware !
+ */
+class Robot extends Pilot implements Runnable {
+
+ private static final int FIRE_INTERVAL = 60;
+ private static final int REBIRTH_DELAY = 900;
+
+ private final Random random = new Random();
+
+ private Thread runner;
+ private boolean runnable = true;
+
+ Robot(Game theGame, int number) {
+ super(theGame, number);
+ }
+
+ void start() {
+ if (runner == null) {
+ runner = new Thread(this);
+ runner.start();
+ }
+ }
+
+ void destroy() {
+ if (runner != null) {
+ runnable = false;
+ runner = null;
+ }
+ }
+
+
+ // A Robot tracks User-controlled ships and fires at them
+ public void run() {
+ Ship target = null;
+
+ while(runnable) {
+ // find target ship
+ do {
+ Ship[] potentials = getGame().getRegistry().getShips();
+ if(potentials.length != 0)
+ target = potentials[Math.abs(random.nextInt() % potentials.length)];
+ sleepForABit(25);
+ } while (target == ship);
+ // main loop
+ int currentRotation = Ship.STOP;
+ int time;
+ boolean currentlyAccelerating = false;
+ double dx, dy, angleA, angleB, theta, dtheta, d,
+ targetVel, a, b, c, targetXVel, targetYVel;
+
+ while(true) {
+ sleepForABit(FIRE_INTERVAL);
+
+ // if my ship is destroyed, give me a new one
+ if (!ship.isAlive()) {
+ sleepForABit(REBIRTH_DELAY);
+ getGame().newShip(this);
+ }
+
+ // find direction and distance from target to me
+ dx = ship.getXPos() - target.getXPos();
+ if (dx < - getGame().getWidth() / 2)
+ dx += getGame().getWidth();
+ if (dx > getGame().getWidth() / 2)
+ dx -= getGame().getWidth();
+ dy = ship.getYPos() - target.getYPos();
+ if (dy < - getGame().getHeight() / 2)
+ dy += getGame().getHeight();
+ if (dy > getGame().getHeight() / 2)
+ dy -= getGame().getHeight();
+ d = Math.sqrt(dx * dx + dy * dy);
+ angleA = Math.atan(dy / dx);
+ if (dx < 0)
+ angleA += Math.PI;
+
+ // find relative velocity and trajectory of target
+ targetXVel = target.getXVel() - ship.getXVel();
+ targetYVel = target.getYVel() - ship.getYVel();
+ targetVel = Math.sqrt(targetXVel * targetXVel +
+ targetYVel * targetYVel);
+ angleB = Math.atan(targetYVel / targetXVel);
+ if (targetXVel < 0)
+ angleB+=Math.PI;
+
+ // find angle between line to target and taget's direction of travel
+ theta = (angleA - angleB) % (2 * Math.PI);
+ if (theta < -Math.PI)
+ theta += 2 * Math.PI;
+ if (theta > Math.PI)
+ theta -= 2 * Math.PI;
+
+ // calculate time to bullet impact using law of cosines
+ a = targetVel * targetVel + Ship.BULLET_SPEED * Ship.BULLET_SPEED;
+ b = d * targetVel * Math.cos(theta);
+ c = - d * d;
+ time = (int)((-b + Math.sqrt(b * b - 4 * a * c)) / 2 / a);
+
+ // calculate angle and distance to bullet impact location
+ dx = targetXVel * time - dx;
+ dy = targetYVel * time - dy;
+ theta = Math.atan(dy / dx);
+ if(dx < 0)
+ theta += Math.PI;
+
+ // find desired change in rotation
+ dtheta = (theta - ship.getOrientation()) % (2 * Math.PI);
+ // find the shortest path to the desired orientation;
+ if(dtheta < - Math.PI)
+ dtheta += 2 * Math.PI;
+ if(dtheta > Math.PI)
+ dtheta -= 2 * Math.PI;
+
+ // turn if nessecary
+ if (dtheta > Ship.DEFAULT_ANGULAR_VELOCITY / 2) {
+ if (currentRotation != Ship.CLOCKWISE)
+ ship.rotate(currentRotation = Ship.CLOCKWISE);
+ }
+ else if (dtheta < -Ship.DEFAULT_ANGULAR_VELOCITY / 2) {
+ if (currentRotation != Ship.COUNTERCLOCKWISE)
+ ship.rotate(currentRotation = Ship.COUNTERCLOCKWISE);
+ } // otherwise, fire, maybe even a burst
+ else {
+ if(currentRotation != Ship.STOP)
+ ship.rotate(currentRotation = Ship.STOP);
+ if (random.nextInt() % 40 == 0) {
+ ship.fire();
+ }
+ }
+
+ // randomly accelerate
+ if (currentlyAccelerating && random.nextInt() % 2 == 0)
+ ship.thrust(currentlyAccelerating = false);
+ else {
+ if (ship.getXVel() == 0)
+ angleA = 0;
+ else
+ angleA = Math.atan(ship.getYVel() / ship.getXVel());
+
+ if (ship.getXVel() < 0)
+ angleA+=Math.PI;
+ angleB = (angleA - ship.getOrientation()) % (2 * Math.PI);
+ if (angleB < -Math.PI)
+ angleB += 2 * Math.PI;
+ if (angleB > Math.PI)
+ angleB -= 2 * Math.PI;
+ angleB = Math.abs(angleB);
+
+ // angleB now represents the angle between the ship's
+ // orientation and velocity vector. This will be used to
+ // determine the probably that the ship will thrust to
+ // prevent ships from accelerating too much in one direction
+ if (random.nextInt() % (int)(12 * (Math.PI - angleB) + 1) == 0)
+ ship.thrust(currentlyAccelerating = true);
+ }
+
+ // switch targets if current one has been destroyed
+ if (target.getDamage() == 100)
+ break;
+
+ // randomly switch targets
+ if (random.nextInt() % 4000 == 0)
+ break;
+ }
+ }
+ }
+
+ void sleepForABit (int time) {
+ try {
+ runner.sleep(time);
+ }
+ catch (InterruptedException e) {}
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/SWFrame.java b/docs/modules/ROOT/pages/examples/spacewar/SWFrame.java
new file mode 100644
index 000000000..6dfb9f6f6
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/SWFrame.java
@@ -0,0 +1,92 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+SWFrame.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.MenuShortcut;
+import java.awt.Dimension;
+import java.awt.Insets;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+class SWFrame extends Frame implements ActionListener {
+ private Game game;
+ private Display display;
+ private Menu menu;
+
+ Game getGame() { return game; }
+ Display getDisplay() { return display; }
+ Menu getMenu() { return menu; }
+
+ SWFrame(Game theGame, Display d) {
+ super("Space War!");
+
+ game = theGame;
+
+ display = d;
+ add(display);
+
+ // create menu
+ menu = new Menu("Game");
+ MenuItem item1 = new MenuItem("Add Robot", new MenuShortcut('a'));
+ MenuItem item2 = new MenuItem("Reset Ships", new MenuShortcut('r'));
+ MenuItem item3 = new MenuItem("Quit", new MenuShortcut('q'));
+ item1.setActionCommand("Add Robot");
+ item2.setActionCommand("Reset Ships");
+ item3.setActionCommand("Quit");
+ menu.add(item1);
+ menu.add(item2);
+ menu.add(item3);
+ menu.addActionListener(this);
+
+ setMenuBar(new MenuBar());
+ getMenuBar().add(menu);
+
+ Dimension screenSize = new Dimension(500, 500);
+ setSize(screenSize);
+ setVisible(true);
+ toFront();
+
+ Insets inset = getInsets();
+ int displayWidth = screenSize.width - inset.left - inset.right;
+ int displayHeight = screenSize.height - inset.top - inset.bottom;
+ display.setSize(displayWidth, displayHeight);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ String s = e.getActionCommand();
+ if (s.equals("Add Robot")) {
+ getGame().addRobot();
+ }
+ else if (s.equals("Reset Ships")) {
+ getGame().resetShips();
+ }
+ else if (s.equals("Quit")) {
+ getGame().quit();
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Ship.java b/docs/modules/ROOT/pages/examples/spacewar/Ship.java
new file mode 100644
index 000000000..9978fe694
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Ship.java
@@ -0,0 +1,296 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+Ship.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+class Ship extends SpaceObject {
+
+ pointcut helmCommandsCut(Ship ship):
+ target(ship) && ( call(void rotate(int)) ||
+ call(void thrust(boolean)) ||
+ call(void fire()) );
+
+
+ /**
+ * Energy and Damage are key values in the state of a ship. Energy is
+ * basically about fuel, and damage is about how bad a shape we are in.
+ *
+ * The energy related values are:
+ * <ul>
+ * <li>MAX_ENERGY</li>
+ * <li>BULLET_ENERGY</li>
+ * <li>ACCELERATION_ENERGY_FACTOR</li>
+ * <li>energy</li>
+ * </ul>
+ * The damage related values are:
+ * <ul>
+ * <li>MAX_DAMAGE</li>
+ * <li>BULLET_DAMAGE</li>
+ * <li>COLLISION_DAMAGE_FACTOR</li>
+ * <li>damage</li>
+ * </ul>
+ * Finally, REPAIR_RATE is the rate at which energy is consumed to fix
+ * damage.
+ *
+ */
+ private static final int MAX_ENERGY = 100;
+ private static final int BULLET_ENERGY= 2;
+ private static final double ACCELERATION_COST_FACTOR = 0.05;
+
+ //XXX was private
+ static final int MAX_DAMAGE = 100;
+ private static final int BULLET_DAMAGE = 15;
+ private static final double COLLISION_DAMAGE_FACTOR = 0.1;
+
+ private static final double REPAIR_RATE = 0.08;
+
+
+ private static final int EXPLOSION_LENGTH = 10;
+
+ static final int BULLET_SPEED = 10;
+
+ static final int CLOCKWISE = 1;
+ static final int STOP = 0;
+ static final int COUNTERCLOCKWISE = (-1);
+
+ static final double DEFAULT_ANGULAR_VELOCITY = 0.2;
+ static final double DEFAULT_ACCELERATION = .4;
+
+ static private final int SIZE = 30; //Can't be changed for now!!!
+
+ private double energy; // range: 0 to MAX_ENERGY
+ private double damage; // range: 0 to MAX_DAMAGE
+ private double orientation; // in degrees
+ private double angularVel; // in ???
+ private double xAcc, yAcc, rAcc; //
+ private int countdown; // remaining explosion time
+
+ private Pilot pilot;
+
+ Ship(Game theGame, double xPos, double yPos, double orientation) {
+ super(theGame, xPos, yPos, 0, 0);
+ xAcc = 0;
+ yAcc = 0;
+ this.orientation = orientation;
+ angularVel = 0;
+
+ energy = MAX_ENERGY;
+ damage = 0;
+ countdown = EXPLOSION_LENGTH;
+ }
+
+
+ int getSize() { return SIZE; }
+
+ double getEnergy() { return energy; }
+ double getDamage() { return damage; }
+ double getOrientation() { return orientation; }
+ double getRAcc() { return rAcc; }
+
+ Pilot getPilot() { return pilot; }
+ void setPilot (Pilot p) { pilot = p; }
+
+ float getEnergyLevel() {
+ return (float)energy / (float)MAX_ENERGY;
+ }
+ float getDamageLevel() {
+ return (float)damage / (float)MAX_DAMAGE;
+ }
+
+ /** returns false if energy is out, otherwise decrements energy by amount
+ * and returns true
+ */
+ boolean expendEnergy(double amount) {
+ if (amount <= energy) {
+ energy -= amount;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /** increments damage by amount and handles the destruction of a ship if
+ * damage reaches MAX_DAMAGE.
+ */
+ void inflictDamage(double amount) {
+ if (amount < 0) // shouldn't happen
+ return;
+ damage = Math.min(MAX_DAMAGE, damage + amount);
+ if (damage == MAX_DAMAGE)
+ setIsAlive(false);
+ }
+
+ /** repairs some damage
+ */
+ void repairDamage(double amount) {
+ if (amount < 0) // shouldn't happen
+ return;
+ if (damage == 0)
+ return;
+ damage = Math.max(0, damage - amount);
+ }
+
+ public void clockTick() {
+ if (! isAlive()) {
+ //
+ // If we aren't alive, but we are still in the registry, it means
+ // we are exploding. countdown counts the length of the explosion.
+ //
+ if (--countdown == 0)
+ die();
+ }
+ else {
+ if (angularVel != 0) {
+ orientation += angularVel;
+ xAcc = rAcc * Math.cos(orientation);
+ yAcc = rAcc * Math.sin(orientation);
+ }
+ setXVel(getXVel() + xAcc);
+ setYVel(getYVel() + yAcc);
+
+ //expend energy
+ if (!expendEnergy(rAcc * ACCELERATION_COST_FACTOR))
+ rAcc = xAcc = yAcc = 0;
+
+ // fix damage
+ if (energy > 10 && damage > REPAIR_RATE) {
+ expendEnergy(REPAIR_RATE);
+ repairDamage(REPAIR_RATE);
+ }
+ }
+ super.clockTick();
+ }
+
+ /**
+ * First check to make sure we have enough energy to accelerate. If
+ * we do, then go ahead and do so. Acceleration is in the direction
+ * we are already facing (i.e. orientation).
+ */
+ void setAcceleration(double acc) {
+ if (acc * ACCELERATION_COST_FACTOR <= energy) {
+ rAcc = acc;
+ xAcc = rAcc * Math.cos(orientation);
+ yAcc = rAcc * Math.sin(orientation);
+ }
+ }
+
+ /**
+ * First check to make sure we have enough energy to rotate. If
+ * we do, then go ahead and do so.
+ */
+ void setAngularVelocity(double omega) {
+ // changing direction of rotation takes energy
+ if (!expendEnergy(Math.abs(omega - angularVel) / 2))
+ return;
+ //sets amount of degree rotation per clock tick, in radians;
+ //clockwise is positive
+ angularVel = omega;
+ }
+
+ /** affect rotation thrusters. Direction can be one of {@link
+ * #CLOCKWISE}, {@link #COUNTERCLOCKWISE}, or zero for turning off
+ * the thrusters.
+ */
+ void rotate(int direction) {
+ setAngularVelocity(
+ direction == CLOCKWISE ? DEFAULT_ANGULAR_VELOCITY :
+ direction == COUNTERCLOCKWISE ? -DEFAULT_ANGULAR_VELOCITY :
+ 0);
+ }
+
+ /** turn on acceleration */
+ void thrust(boolean onOff) {
+ setAcceleration(onOff ? DEFAULT_ACCELERATION : 0);
+ }
+
+ /** create a bullet and fire it */
+ void fire() {
+ // firing a shot takes energy
+ if (!expendEnergy(BULLET_ENERGY))
+ return;
+
+ //create a bullet object so it doesn't hit the ship that's firing it
+ double xV = getXVel() + BULLET_SPEED * (Math.cos(orientation));
+ double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation));
+
+ // create the actual bullet
+ new Bullet(
+ getGame(),
+ (getXPos() + ((getSize()/2 + 2) * (Math.cos(orientation))) + xV),
+ (getYPos() + ((getSize()/2 + 2) * (Math.sin(orientation))) + yV),
+ xV,
+ yV);
+ }
+
+
+ void handleCollision(SpaceObject obj) {
+ if (obj instanceof Ship) {
+ // should never be called. ship - ship collisions are handled in
+ // Ship.bounce(Ship shipA, Ship shipB)
+ }
+ else if (obj instanceof Bullet) {
+ inflictDamage(BULLET_DAMAGE);
+ }
+ else if (obj instanceof EnergyPacket) {
+ double packetEnergy = ((EnergyPacket)obj).getEnergy();
+ energy = Math.max(0, Math.min(energy + packetEnergy, MAX_ENERGY));
+ }
+ else {
+ System.err.println("collision with UFO!");
+ }
+ }
+
+ static void bounce(Ship shipA, Ship shipB) {
+ double dx, dy, denominator,
+ xAccA, yAccA, xAccB, yAccB, damage,
+ xComp, yComp, dvx, dvy;
+
+ dx = Math.abs(shipA.getXPos() - shipB.getXPos());
+ dy = Math.abs(shipA.getYPos() - shipB.getYPos());
+ denominator = Math.sqrt(dx * dx + dy * dy);
+ xComp = dx / denominator;
+ yComp = dy / denominator;
+ xAccA = shipB.getXVel() * xComp + shipA.getXVel() * (1 - xComp) -
+ shipA.getXVel();
+ yAccA = shipB.getYVel() * yComp + shipA.getYVel() * (1 - yComp) -
+ shipA.getYVel();
+ xAccB = shipA.getXVel() * xComp + shipB.getXVel() * (1 - xComp) -
+ shipB.getXVel();
+ yAccB = shipA.getYVel() * yComp + shipB.getYVel() * (1 - yComp) -
+ shipB.getYVel();
+ shipA.accelerate(xAccA, yAccA);
+ shipB.accelerate(xAccB, yAccB);
+ dvx = shipA.getXVel() - shipB.getXVel();
+ dvy = shipA.getYVel() - shipA.getYVel();
+ damage = COLLISION_DAMAGE_FACTOR * (dvx * dvx + dvy * dvy);
+ shipA.inflictDamage(damage);
+ shipB.inflictDamage(damage);
+
+ // !!!
+ // !!! poopers! this does a local time warp. this has to be a
+ // !!! violation of the clockTick protocol
+ // !!!
+ while (Game.isCollision(shipA, shipB)) {
+ shipA.clockTick();
+ shipB.clockTick();
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/SpaceObject.java b/docs/modules/ROOT/pages/examples/spacewar/SpaceObject.java
new file mode 100644
index 000000000..ee3afabcc
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/SpaceObject.java
@@ -0,0 +1,106 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+SpaceObject.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+/**
+ * SpaceObjects are objects that float around in space. They support the
+ * minimal SpaceObject protocol, having to do with position, velocity,
+ * size and liveness. They are constructed with game, position, velocity
+ * and size. When constructed, a spaceobject adds itself to the registry.
+ *
+ * When it dies, a spaceobject removes itself from the registry. But note
+ * that it doesn't decide when to die, subclasses do that.
+ *
+ * The display aspects actually draw the space object on the screen and say
+ * how much space it takes up there.
+ */
+abstract class SpaceObject {
+
+ private Game game;
+ private double xPos, yPos, oldXPos, oldYPos, xVel, yVel;
+ private boolean alive;
+
+ SpaceObject (Game theGame, double xP, double yP, double xV, double yV) {
+ game = theGame;
+ xPos = xP;
+ yPos = yP;
+ oldXPos = xP;
+ oldYPos = yP;
+ xVel = xV;
+ yVel = yV;
+
+ alive = true;
+ getGame().getRegistry().register(this);
+ }
+
+ Game getGame() { return game; }
+
+ double getXPos() { return xPos; }
+ double getYPos() { return yPos; }
+
+ double getOldXPos() { return oldXPos; }
+ double getOldYPos() { return oldYPos; }
+
+ double getXVel() { return xVel; }
+ double getYVel() { return yVel; }
+
+ void setXVel (double n) { xVel = n; }
+ void setYVel (double n) { yVel = n; }
+
+ boolean isAlive() { return alive; }
+ void setIsAlive(boolean n) { alive = n; }
+
+
+ /**
+ * Move 1 unit of time's worth of distance. I.e. increment xPos by xVel
+ * and yPos by yVel. If we move off an edge of the screen move us back
+ * in the opposite edge.
+ */
+ void clockTick() {
+ oldXPos = xPos;
+ oldYPos = yPos;
+ xPos = (xPos + xVel) % getGame().getWidth();
+ if(xPos < 0)
+ xPos += getGame().getWidth();
+ yPos = (yPos + yVel) % getGame().getHeight();
+ if(yPos < 0)
+ yPos += getGame().getHeight();
+ }
+
+ void accelerate(double dXVel, double dYVel) {
+ xVel += dXVel;
+ yVel += dYVel;
+ }
+
+ void die() {
+ getGame().getRegistry().unregister(this);
+ }
+
+ abstract int getSize();
+
+ /** resolve the effects of colliding with a space object.
+ * @param obj the space object that this object is colliding with.
+ */
+ abstract void handleCollision(SpaceObject obj);
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/Timer.java b/docs/modules/ROOT/pages/examples/spacewar/Timer.java
new file mode 100644
index 000000000..1f4a992a7
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/Timer.java
@@ -0,0 +1,53 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Timer.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+class Timer extends Thread {
+
+ private final static int TICK_PERIOD = 40; // time between ticks in millis
+
+ private Game game;
+
+ Game getGame() { return game; }
+
+ Timer (Game theGame) {
+ super("Timer");
+ game = theGame;
+ }
+
+ public void run() {
+ long t1, tdiff;
+ while (true) {
+ t1 = System.currentTimeMillis();
+ getGame().clockTick();
+ tdiff = System.currentTimeMillis() - t1;
+ if (tdiff < TICK_PERIOD) {
+ try {
+ sleep (Math.max(0 , TICK_PERIOD - tdiff));
+ }
+ catch (InterruptedException e) { }
+ }
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/spacewar/debug.lst b/docs/modules/ROOT/pages/examples/spacewar/debug.lst
new file mode 100644
index 000000000..3de8ddafe
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/debug.lst
@@ -0,0 +1,2 @@
+@demo.lst
+Debug.java
diff --git a/docs/modules/ROOT/pages/examples/spacewar/demo.lst b/docs/modules/ROOT/pages/examples/spacewar/demo.lst
new file mode 100644
index 000000000..dd188af83
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/spacewar/demo.lst
@@ -0,0 +1,19 @@
+@../coordination/lib.lst
+Bullet.java
+EnergyPacket.java
+EnergyPacketProducer.java
+Game.java
+GameSynchronization.java
+Pilot.java
+Registry.java
+RegistrySynchronization.java
+Robot.java
+Ship.java
+EnsureShipIsAlive.java
+SpaceObject.java
+Timer.java
+SWFrame.java
+Display.java
+Display1.java
+Display2.java
+Player.java
diff --git a/docs/modules/ROOT/pages/examples/telecom/AbstractSimulation.java b/docs/modules/ROOT/pages/examples/telecom/AbstractSimulation.java
new file mode 100644
index 000000000..1c44af7a7
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/AbstractSimulation.java
@@ -0,0 +1,80 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+public abstract class AbstractSimulation {
+
+ public static AbstractSimulation simulation;
+
+ /**
+ * Creates objects and puts them to work.
+ */
+ public void run() {
+ Customer jim = new Customer("Jim", 650);
+ Customer mik = new Customer("Mik", 650);
+ Customer crista = new Customer("Crista", 415);
+
+ say("jim calls mik...");
+ Call c1 = jim.call(mik);
+ wait(1.0);
+ say("mik accepts...");
+ mik.pickup(c1);
+ wait(2.0);
+ say("jim hangs up...");
+ jim.hangup(c1);
+ report(jim);
+ report(mik);
+ report(crista);
+
+ say("mik calls crista...");
+ Call c2 = mik.call(crista);
+ say("crista accepts...");
+ crista.pickup(c2);
+ wait(1.5);
+ say("crista hangs up...");
+ crista.hangup(c2);
+ report(jim);
+ report(mik);
+ report(crista);
+ }
+
+ /**
+ * Print a report of the connection time for customer
+ */
+ abstract protected void report(Customer c);
+
+ /**
+ * Wait 0.1 seconds per "second" for simulation
+ */
+ protected static void wait(double seconds) {
+ Object dummy = new Object();
+ synchronized (dummy) {
+ //XXX cheat and only wait 0.1 seconds per second
+ try {dummy.wait((long)(seconds*100)); }
+ catch (Exception e) {}
+ }
+ }
+
+ /**
+ * Put a message on standard output
+ */
+ protected static void say(String s){
+ System.out.println(s);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/BasicSimulation.java b/docs/modules/ROOT/pages/examples/telecom/BasicSimulation.java
new file mode 100644
index 000000000..ab7426376
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/BasicSimulation.java
@@ -0,0 +1,34 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+/**
+ * This simulation subclass implements AbstractSimulation.run(..)
+ * with a test script for the telecom system with only the
+ * basic objects.
+ */
+public class BasicSimulation extends AbstractSimulation {
+
+ public static void main(String[] args){
+ simulation = new BasicSimulation();
+ simulation.run();
+ }
+
+ protected void report(Customer c) { }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/Billing.java b/docs/modules/ROOT/pages/examples/telecom/Billing.java
new file mode 100644
index 000000000..651d64b36
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Billing.java
@@ -0,0 +1,73 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package telecom;
+/**
+ * The Billing aspect deals with... billing.
+ * How much money did each connection cost?
+ * How much money did each call cost?
+ * How much money is being debited to a customer?
+ * This aspect can be used by other parts of the system. (not in this example)
+ *
+ * Billing can depend many things, such as timing, the type of the connection,
+ * some special discounts the customer has, special features, etc. In here,
+ * it depends only on timing and on the type of the connection.
+ */
+public aspect Billing {
+ // precedence required to get advice on endtiming in the right order
+ declare precedence: Billing, Timing;
+
+ public static final long LOCAL_RATE = 3;
+ public static final long LONG_DISTANCE_RATE = 10;
+
+ public Customer Connection.payer;
+ public Customer getPayer(Connection conn) { return conn.payer; }
+ /**
+ * Caller pays for the call
+ */
+ after(Customer cust) returning (Connection conn):
+ args(cust, ..) && call(Connection+.new(..)) {
+ conn.payer = cust;
+ }
+
+ /**
+ * Connections give the appropriate call rate
+ */
+ public abstract long Connection.callRate();
+
+
+ public long LongDistance.callRate() { return LONG_DISTANCE_RATE; }
+ public long Local.callRate() { return LOCAL_RATE; }
+
+
+ /**
+ * When timing stops, calculate and add the charge from the
+ * connection time
+ */
+ after(Connection conn): Timing.endTiming(conn) {
+ long time = Timing.aspectOf().getTimer(conn).getTime();
+ long rate = conn.callRate();
+ long cost = rate * time;
+ getPayer(conn).addCharge(cost);
+ }
+
+
+ /**
+ * Customers have a bill paying aspect with state
+ */
+ public long Customer.totalCharge = 0;
+ public long getTotalCharge(Customer cust) { return cust.totalCharge; }
+
+ public void Customer.addCharge(long charge){
+ totalCharge += charge;
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/BillingSimulation.java b/docs/modules/ROOT/pages/examples/telecom/BillingSimulation.java
new file mode 100644
index 000000000..09f273ff6
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/BillingSimulation.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+/**
+ * This simulation subclass implements AbstractSimulation.report(..)
+ *
+ */
+public class BillingSimulation extends AbstractSimulation {
+
+ public static void main(String[] args){
+ System.out.println("\n... Billing simulation 2 ...\n");
+ simulation = new BillingSimulation();
+ simulation.run();
+ }
+
+ /**
+ * Print a report of the connection time and the bill for customer
+ */
+ protected void report(Customer c){
+ Timing t = Timing.aspectOf();
+ Billing b = Billing.aspectOf();
+ System.out.println(c + " has been connected for "
+ + t.getTotalConnectTime(c)
+ + " seconds and has a bill of "
+ + b.getTotalCharge(c));
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/examples/telecom/Call.java b/docs/modules/ROOT/pages/examples/telecom/Call.java
new file mode 100644
index 000000000..3d3489e86
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Call.java
@@ -0,0 +1,97 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+import java.util.Vector;
+import java.util.Enumeration;
+
+/**
+ * A call supports the process of a customer trying to
+ * connect to others.
+ */
+public class Call {
+
+ private Customer caller, receiver;
+ private Vector connections = new Vector();
+
+ /**
+ * Create a new call connecting caller to receiver
+ * with a new connection. This should really only be
+ * called by Customer.call(..)
+ */
+ public Call(Customer caller, Customer receiver) {
+ this.caller = caller;
+ this.receiver = receiver;
+ Connection c;
+ if (receiver.localTo(caller)) {
+ c = new Local(caller, receiver);
+ } else {
+ c = new LongDistance(caller, receiver);
+ }
+ connections.addElement(c);
+ }
+
+ /**
+ * picking up a call completes the current connection
+ * (this means that you shouldnt merge calls until
+ * they are completed)
+ */
+ public void pickup() {
+ Connection connection = (Connection)connections.lastElement();
+ connection.complete();
+ }
+
+
+ /**
+ * Is the call in a connected state?
+ */
+ public boolean isConnected(){
+ return ((Connection)connections.lastElement()).getState()
+ == Connection.COMPLETE;
+ }
+
+ /**
+ * hanging up a call drops the connection
+ */
+ public void hangup(Customer c) {
+ for(Enumeration e = connections.elements(); e.hasMoreElements();) {
+ ((Connection)e.nextElement()).drop();
+ }
+ }
+
+ /**
+ * is Customer c one of the customers in this call?
+ */
+ public boolean includes(Customer c){
+ boolean result = false;
+ for(Enumeration e = connections.elements(); e.hasMoreElements();) {
+ result = result || ((Connection)e.nextElement()).connects(c);
+ }
+ return result;
+ }
+
+ /**
+ * Merge all connections from call 'other' into 'this'
+ */
+ public void merge(Call other){
+ for(Enumeration e = other.connections.elements(); e.hasMoreElements();){
+ Connection conn = (Connection)e.nextElement();
+ other.connections.removeElement(conn);
+ connections.addElement(conn);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/Connection.java b/docs/modules/ROOT/pages/examples/telecom/Connection.java
new file mode 100644
index 000000000..7d54ec843
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Connection.java
@@ -0,0 +1,87 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+/**
+ * Connections are circuits between customers
+ * There are two kinds: local and long distance
+ * see subclasses at the end of this file.
+ */
+public abstract class Connection {
+
+ public static final int PENDING = 0;
+ public static final int COMPLETE = 1;
+ public static final int DROPPED = 2;
+
+ Customer caller, receiver;
+ private int state = PENDING;
+
+ /**
+ * Creatte a new Connection between a and b
+ */
+ Connection(Customer a, Customer b) {
+ this.caller = a;
+ this.receiver = b;
+ }
+
+ /**
+ * what is the state of the connection?
+ */
+ public int getState(){
+ return state;
+ }
+
+ /**
+ * get the customer who initiated this connection
+ */
+ public Customer getCaller() { return caller; }
+
+ /**
+ * get the customer who received this connection
+ */
+ public Customer getReceiver() { return receiver; }
+
+ /**
+ * Called when a call is picked up. This means the b side has picked up
+ * and the connection should now complete itself and start passing data.
+ */
+ void complete() {
+ state = COMPLETE;
+ System.out.println("connection completed");
+ }
+
+ /**
+ * Called when the connection is dropped from a call. Is intended to
+ * free up any resources the connection was consuming.
+ */
+ void drop() {
+ state = DROPPED;
+ System.out.println("connection dropped");
+ }
+
+ /**
+ * Is customer c connected by this connection?
+ */
+ public boolean connects(Customer c){
+ return (caller == c || receiver == c);
+ }
+
+}
+
+
+
diff --git a/docs/modules/ROOT/pages/examples/telecom/Customer.java b/docs/modules/ROOT/pages/examples/telecom/Customer.java
new file mode 100644
index 000000000..1e099984c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Customer.java
@@ -0,0 +1,112 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+import java.util.Vector;
+
+/**
+ * Customers have a unique id (name in this case for didactic purposes
+ * but it could be telephone number) and area code.
+ * They also have protocol for managing calls: call, pickup, etc.
+ */
+public class Customer {
+
+ private String name;
+ private int areacode;
+ private Vector calls = new Vector();
+
+ /**
+ * unregister a call
+ */
+ protected void removeCall(Call c){
+ calls.removeElement(c);
+ }
+
+ /**
+ * register a call
+ */
+ protected void addCall(Call c){
+ calls.addElement(c);
+ }
+
+ /**
+ * Make a new customer with given name
+ */
+ public Customer(String name, int areacode) {
+ this.name = name;
+ this.areacode = areacode;
+ }
+
+ /**
+ * String rendition of customer
+ */
+ public String toString() {
+ return name + "(" + areacode + ")";
+ }
+
+ /**
+ * what area is the customer in?
+ */
+ public int getAreacode(){
+ return areacode;
+ }
+
+ /**
+ * Is the other customer in the same area?
+ */
+ public boolean localTo(Customer other){
+ return areacode == other.areacode;
+ }
+
+ /**
+ * Make a new call to receiver
+ */
+ public Call call(Customer receiver) {
+ Call call = new Call(this, receiver);
+ addCall(call);
+ return call;
+ }
+
+ /**
+ * pick up a call
+ */
+ public void pickup(Call call) {
+ call.pickup();
+ addCall(call);
+ }
+
+ /**
+ * hang up a call
+ */
+ public void hangup(Call call) {
+ call.hangup(this);
+ removeCall(call);
+ }
+
+ /**
+ * Merge a pair of calls -- conference them
+ * PRE: call1.includes(this)
+ * call2.includes(this)
+ * call1.connected()
+ * call2.connected()
+ * POST: call1 includes all customers connected by call1@pre and call2@pre
+ */
+ public void merge(Call call1, Call call2){
+ call1.merge(call2);
+ removeCall(call2);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/Local.java b/docs/modules/ROOT/pages/examples/telecom/Local.java
new file mode 100644
index 000000000..e0bc02679
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Local.java
@@ -0,0 +1,26 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+public class Local extends Connection {
+ Local(Customer a, Customer b) {
+ super(a, b);
+ System.out.println("[new local connection from " +
+ a + " to " + b + "]");
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/LongDistance.java b/docs/modules/ROOT/pages/examples/telecom/LongDistance.java
new file mode 100644
index 000000000..b2ed6eb7d
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/LongDistance.java
@@ -0,0 +1,26 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+public class LongDistance extends Connection {
+ LongDistance(Customer a, Customer b) {
+ super(a, b);
+ System.out.println("[new long distance connection from " +
+ a + " to " + b + "]");
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/Timer.java b/docs/modules/ROOT/pages/examples/telecom/Timer.java
new file mode 100644
index 000000000..813ae3a0d
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Timer.java
@@ -0,0 +1,50 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+
+/**
+ * Simple timer machine used to record elapsed time
+ */
+public class Timer {
+ public long startTime, stopTime;
+
+ /**
+ * set the start time
+ */
+ public void start() {
+ startTime = System.currentTimeMillis();
+ stopTime = startTime;
+ }
+
+ /**
+ * set the end time
+ */
+ public void stop() {
+ stopTime = System.currentTimeMillis();
+ }
+
+ /**
+ * set how much time passed between last start and stop?
+ */
+ public long getTime() {
+ return stopTime - startTime;
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/examples/telecom/TimerLog.java b/docs/modules/ROOT/pages/examples/telecom/TimerLog.java
new file mode 100644
index 000000000..c736625b5
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/TimerLog.java
@@ -0,0 +1,23 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+package telecom;
+
+public aspect TimerLog {
+
+ after(Timer t): target(t) && call(* Timer.start()) {
+ System.err.println("Timer started: " + t.startTime);
+ }
+
+ after(Timer t): target(t) && call(* Timer.stop()) {
+ System.err.println("Timer stopped: " + t.stopTime);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/Timing.java b/docs/modules/ROOT/pages/examples/telecom/Timing.java
new file mode 100644
index 000000000..29eba02ea
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/Timing.java
@@ -0,0 +1,57 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package telecom;
+
+/**
+ * The Timing aspect is concerned with the duration
+ * of connections and with customer's cumulative
+ * connection time.
+ */
+public aspect Timing {
+
+ /**
+ * Every Customer has a total connection time
+ */
+ public long Customer.totalConnectTime = 0;
+
+ public long getTotalConnectTime(Customer cust) {
+ return cust.totalConnectTime;
+ }
+ /**
+ * Every connection has a timer
+ */
+ private Timer Connection.timer = new Timer();
+ public Timer getTimer(Connection conn) { return conn.timer; }
+
+ /**
+ * Start the timer when call completed
+ */
+ after (Connection c): target(c) && call(void Connection.complete()) {
+ getTimer(c).start();
+ }
+
+ /**
+ * When to stop the timer
+ */
+ pointcut endTiming(Connection c): target(c) &&
+ call(void Connection.drop());
+
+ /**
+ * Stop the timer when call dropped and update the involved parties
+ */
+ after(Connection c): endTiming(c) {
+ getTimer(c).stop();
+ c.getCaller().totalConnectTime += getTimer(c).getTime();
+ c.getReceiver().totalConnectTime += getTimer(c).getTime();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/TimingSimulation.java b/docs/modules/ROOT/pages/examples/telecom/TimingSimulation.java
new file mode 100644
index 000000000..309563769
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/TimingSimulation.java
@@ -0,0 +1,40 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+package telecom;
+
+/**
+ * This simulation subclass implements AbstractSimulation.report(..)
+ *
+ */
+public class TimingSimulation extends AbstractSimulation {
+
+ public static void main(String[] args){
+ System.out.println("\n... Timing simulation 2 ...\n");
+ simulation = new TimingSimulation();
+ simulation.run();
+ }
+
+ /**
+ * Print a report of the connection time for customer
+ */
+ protected void report(Customer c){
+ Timing t = Timing.aspectOf();
+ System.out.println(c + " spent " + t.getTotalConnectTime(c));
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/examples/telecom/basic.lst b/docs/modules/ROOT/pages/examples/telecom/basic.lst
new file mode 100644
index 000000000..018a679ac
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/basic.lst
@@ -0,0 +1,7 @@
+AbstractSimulation.java
+BasicSimulation.java
+Call.java
+Connection.java
+Local.java
+LongDistance.java
+Customer.java
diff --git a/docs/modules/ROOT/pages/examples/telecom/billing.lst b/docs/modules/ROOT/pages/examples/telecom/billing.lst
new file mode 100644
index 000000000..7b2cf087c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/billing.lst
@@ -0,0 +1,10 @@
+AbstractSimulation.java
+BillingSimulation.java
+Call.java
+Connection.java
+Local.java
+LongDistance.java
+Customer.java
+Timer.java
+Billing.java
+Timing.java
diff --git a/docs/modules/ROOT/pages/examples/telecom/timing.lst b/docs/modules/ROOT/pages/examples/telecom/timing.lst
new file mode 100644
index 000000000..3ca514f85
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/telecom/timing.lst
@@ -0,0 +1,10 @@
+AbstractSimulation.java
+TimingSimulation.java
+Call.java
+Connection.java
+Local.java
+LongDistance.java
+Customer.java
+Timer.java
+TimerLog.java
+Timing.java
diff --git a/docs/modules/ROOT/pages/examples/tjp/Demo.java b/docs/modules/ROOT/pages/examples/tjp/Demo.java
new file mode 100644
index 000000000..64d249c82
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tjp/Demo.java
@@ -0,0 +1,37 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package tjp;
+
+public class Demo {
+ static Demo d;
+
+ public static void main(String[] args){
+ new Demo().go();
+ }
+
+ void go(){
+ d = new Demo();
+ d.foo(1,d);
+ System.out.println(d.bar(new Integer(3)));
+ }
+
+ void foo(int i, Object o){
+ System.out.println("Demo.foo(" + i + ", " + o + ")\n");
+ }
+
+ String bar (Integer j){
+ System.out.println("Demo.bar(" + j + ")\n");
+ return "Demo.bar(" + j + ")";
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tjp/GetInfo.java b/docs/modules/ROOT/pages/examples/tjp/GetInfo.java
new file mode 100644
index 000000000..0d38a3766
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tjp/GetInfo.java
@@ -0,0 +1,49 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tjp;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+
+aspect GetInfo {
+
+ static final void println(String s){ System.out.println(s); }
+
+ pointcut goCut(): cflow(this(Demo) && execution(void go()));
+
+ pointcut demoExecs(): within(Demo) && execution(* *(..));
+
+ Object around(): demoExecs() && !execution(* go()) && goCut() {
+ println("Intercepted message: " +
+ thisJoinPointStaticPart.getSignature().getName());
+ println("in class: " +
+ thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+ printParameters(thisJoinPoint);
+ println("Running original method: \n" );
+ Object result = proceed();
+ println(" result: " + result );
+ return result;
+ }
+
+ static private void printParameters(JoinPoint jp) {
+ println("Arguments: " );
+ Object[] args = jp.getArgs();
+ String[] names = ((CodeSignature)jp.getSignature()).getParameterNames();
+ Class[] types = ((CodeSignature)jp.getSignature()).getParameterTypes();
+ for (int i = 0; i < args.length; i++) {
+ println(" " + i + ". " + names[i] +
+ " : " + types[i].getName() +
+ " = " + args[i]);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tjp/files.lst b/docs/modules/ROOT/pages/examples/tjp/files.lst
new file mode 100644
index 000000000..0cfc34bdf
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tjp/files.lst
@@ -0,0 +1,2 @@
+Demo.java
+GetInfo.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/Circle.java b/docs/modules/ROOT/pages/examples/tracing/Circle.java
new file mode 100644
index 000000000..76b73e20a
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/Circle.java
@@ -0,0 +1,71 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing;
+
+/**
+ *
+ * Circle is a 2D shape. It extends the TwoDShape class with the radius
+ * variable, and it implements TwoDShape's abstract methods for
+ * correctly computing a circle's area and distance.
+ *
+ */
+public class Circle extends TwoDShape {
+ protected double r; // radius
+
+ /*
+ * All sorts of constructors
+ */
+ public Circle(double x, double y, double r) {
+ super(x, y); this.r = r;
+ }
+
+ public Circle(double x, double y) {
+ this(x, y, 1.0);
+ }
+
+ public Circle(double r) {
+ this(0.0, 0.0, r);
+ }
+
+ public Circle() {
+ this(0.0, 0.0, 1.0);
+ }
+
+ /**
+ * Returns the perimeter of this circle
+ */
+ public double perimeter() {
+ return 2 * Math.PI * r;
+ }
+
+ /**
+ * Returns the area of this circle
+ */
+ public double area() {
+ return Math.PI * r*r;
+ }
+
+ /**
+ * This method overrides the one in the superclass. It adds some
+ * circle-specific information.
+ */
+ public String toString() {
+ return ("Circle radius = " + String.valueOf(r) + super.toString());
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/ExampleMain.java b/docs/modules/ROOT/pages/examples/tracing/ExampleMain.java
new file mode 100644
index 000000000..93cc465b7
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/ExampleMain.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing;
+
+/**
+ *
+ * A main function for testing 2D shapes.
+ *
+ */
+public class ExampleMain {
+ public static void main(String[] args) {
+ Circle c1 = new Circle(3.0, 3.0, 2.0);
+ Circle c2 = new Circle(4.0);
+
+ Square s1 = new Square(1.0, 2.0);
+
+ System.out.println("c1.perimeter() = " + c1.perimeter());
+ System.out.println("c1.area() = " + c1.area());
+
+ System.out.println("s1.perimeter() = " + s1.perimeter());
+ System.out.println("s1.area() = " + s1.area());
+
+ System.out.println("c2.distance(c1) = " + c2.distance(c1));
+ System.out.println("s1.distance(c1) = " + s1.distance(c1));
+
+ System.out.println("s1.toString(): " + s1.toString());
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/README b/docs/modules/ROOT/pages/examples/tracing/README
new file mode 100644
index 000000000..bf8e70390
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/README
@@ -0,0 +1,32 @@
+
+This directory contains several examples of tracing aspects,
+including a reusable tracing library and examples of
+using that library.
+
+A lesson in the AspectJ Primer explains all of this code.
+
+To work with these (or any other examples), first be sure .../examples
+is on your classpath, where ... is where you have installed AspectJ.
+
+
+--To compile and run the example without tracing--
+
+ ajc @.../examples/tracing/notrace.lst
+
+ java tracing.ExampleMain
+
+
+--To compile and run the example with tracing version<N>--
+
+ ajc @.../examples/tracing/tracev<N>.lst
+
+ java tracing.version<N>.TraceMyClasses
+
+where <N> is 1, 2, 3 or 4
+
+--To use the tracing.lib.AbstractTrace aspect--
+
+ Make sure .../examples is in your classpath.
+
+ In order to use this aspect, please read the documentation under
+ tracing/doc
diff --git a/docs/modules/ROOT/pages/examples/tracing/Square.java b/docs/modules/ROOT/pages/examples/tracing/Square.java
new file mode 100644
index 000000000..78b36882d
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/Square.java
@@ -0,0 +1,71 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing;
+
+/**
+ *
+ * Square is a 2D shape. It extends the TwoDShape class with the side
+ * variable, and it implements TwoDShape's abstract methods for
+ * correctly computing a square's area and distance.
+ *
+ */
+public class Square extends TwoDShape {
+ protected double s; // side
+
+ /*
+ * All sorts of constructors
+ */
+ public Square(double x, double y, double s) {
+ super(x, y); this.s = s;
+ }
+
+ public Square(double x, double y) {
+ this(x, y, 1.0);
+ }
+
+ public Square(double s) {
+ this(0.0, 0.0, s);
+ }
+
+ public Square() {
+ this(0.0, 0.0, 1.0);
+ }
+
+ /**
+ * Returns the perimeter of this square
+ */
+ public double perimeter() {
+ return 4 * s;
+ }
+
+ /**
+ * Returns the area of this square
+ */
+ public double area() {
+ return s*s;
+ }
+
+ /**
+ * This method overrides the one in the superclass. It adds some
+ * circle-specific information.
+ */
+ public String toString() {
+ return ("Square side = " + String.valueOf(s) + super.toString());
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/TwoDShape.java b/docs/modules/ROOT/pages/examples/tracing/TwoDShape.java
new file mode 100644
index 000000000..531b6f120
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/TwoDShape.java
@@ -0,0 +1,69 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tracing;
+
+/**
+ * TwoDShape is an abstract class that defines generic functionality
+ * for 2D shapes.
+ */
+public abstract class TwoDShape {
+ /**
+ * Coordinates of the center of the shape.
+ */
+ protected double x, y;
+
+ protected TwoDShape(double x, double y) {
+ this.x = x; this.y = y;
+ }
+
+ /**
+ * Returns the x coordinate of the shape.
+ */
+ public double getX() { return x; }
+
+ /**
+ * Returns the y coordinate of the shape.
+ */
+ public double getY() { return y; }
+
+ /**
+ * Returns the distance between this shape and the shape given as
+ * parameter.
+ */
+ public double distance(TwoDShape s) {
+ double dx = Math.abs(s.getX() - x);
+ double dy = Math.abs(s.getY() - y);
+ return Math.sqrt(dx*dx + dy*dy);
+ }
+
+ /**
+ * Returns the perimeter of this shape. Must be defined in
+ * subclasses.
+ */
+ public abstract double perimeter();
+
+ /**
+ * Returns the area of this shape. Must be defined in
+ * subclasses.
+ */
+ public abstract double area();
+
+ /**
+ * Returns a string representation of 2D shapes -- simply its
+ * coordinates.
+ */
+ public String toString() {
+ return (" @ (" + String.valueOf(x) + ", " + String.valueOf(y) + ") ");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/examples/tracing/lib/AbstractTrace.java b/docs/modules/ROOT/pages/examples/tracing/lib/AbstractTrace.java
new file mode 100644
index 000000000..8c67b12c3
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/lib/AbstractTrace.java
@@ -0,0 +1,185 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing.lib;
+
+import java.io.PrintStream;
+import org.aspectj.lang.JoinPoint;
+
+
+/**
+ * This class provides support for printing trace messages into a stream.
+ * The trace messages consist of the class name, method name (if method)
+ * and the list of parameter types.<P>
+ * The class is thread-safe. Different threads may use different output streams
+ * by simply calling the method initStream(myStream).<P>
+ * This class should be extended.
+ * It defines 3 abstract crosscuts for injecting the tracing functionality
+ * into any constructors and methods of any application classes.<P>
+ *
+ * One example of using this class might be
+ * <PRE>
+ * import tracing.lib.AbstractTrace;
+ * aspect TraceMyClasses extends AbstractTrace of eachJVM() {
+ * pointcut classes(): within(TwoDShape) | within(Circle) | within(Square);
+ * pointcut constructors(): executions(new(..));
+ * pointcut methods(): executions(!abstract * *(..))
+ * }
+ * </PRE>
+ * (Make sure .../aspectj/examples is in your classpath)
+ */
+public abstract aspect AbstractTrace {
+
+ /**
+ * Application classes - left unspecified.
+ * Subclasses should concretize this crosscut with class names.
+ */
+ abstract pointcut classes();
+ /**
+ * Constructors - left unspecified.
+ * Subclasses should concretize this crosscut with constructors.
+ */
+ abstract pointcut constructors();
+ /**
+ * Methods - left unspecified.
+ * Subclasses should concretize this crosscut with method names.
+ */
+ abstract pointcut methods();
+
+ before(): classes() && constructors() {
+ doTraceEntry(thisJoinPoint, true);
+ }
+ after(): classes() && constructors() {
+ doTraceExit(thisJoinPoint, true);
+ }
+
+ before(): classes() && methods() {
+ doTraceEntry(thisJoinPoint, false);
+ }
+ after(): classes() && methods() {
+ doTraceExit(thisJoinPoint, false);
+ }
+
+ /*
+ * From here on, it's an ordinary class implementation.
+ * The static state is thread-safe by using ThreadLocal variables.
+ */
+
+ /**
+ * This method initializes this thread's trace output stream.
+ * By default, the output stream is System.err, and it is the same for
+ * all threads. In multithreaded applications, you may want to define
+ * different output streams for the different threads. For doing it,
+ * simply call this method in the beginning of each thread's main loop,
+ * giving it different output streams.
+ */
+ public void initStream(PrintStream _stream) {
+ setStream(_stream);
+ }
+
+
+ private ThreadLocal stream = new ThreadLocal() {
+ protected Object initialValue() {
+ return System.err;
+ }
+ };
+ private ThreadLocal callDepth = new ThreadLocal() {
+ protected Object initialValue() {
+ return new Integer(0);
+ }
+ };
+
+ private PrintStream getStream() {
+ return (PrintStream)stream.get();
+ }
+ private void setStream(PrintStream s) {
+ stream.set(s);
+ }
+ private int getCallDepth() {
+ return ((Integer)(callDepth.get())).intValue();
+ }
+ private void setCallDepth(int n) {
+ callDepth.set(new Integer(n));
+ }
+
+ private void doTraceEntry (JoinPoint jp, boolean isConstructor) {
+ setCallDepth(getCallDepth() + 1);
+ printEntering(jp, isConstructor);
+ }
+
+ private void doTraceExit (JoinPoint jp, boolean isConstructor) {
+ printExiting(jp, isConstructor);
+ setCallDepth(getCallDepth() - 1);
+ }
+
+ private void printEntering (JoinPoint jp, boolean isConstructor) {
+ printIndent();
+ getStream().print("--> ");
+ getStream().print(jp);
+ // printParameterTypes(jp);
+ getStream().println();
+ }
+
+ private void printExiting (JoinPoint jp, boolean isConstructor) {
+ printIndent();
+ getStream().print("<-- ");
+ getStream().print(jp);
+ // printParameterTypes(jp);
+ getStream().println();
+ }
+
+// private void printParameterTypes(JoinPoint jp) {
+// Class[] ptypes = jp.parameterTypes;
+
+// getStream().print("(");
+// for (int i = 0; i < ptypes.length; i++) {
+// getStream().print(ptypes[i].getName());
+// if (i < ptypes.length - 1) getStream().print(", ");
+// }
+// getStream().print(")");
+// }
+
+ private void printIndent() {
+ for (int i = 0; i < getCallDepth(); i++)
+ getStream().print(" ");
+ }
+
+ /**
+ * This method is not being used.
+ * It's being included solely for illustrating how to access and use
+ * the information in JoinPoint.
+ * If you want, you can replace the calls to printParameterTypes (above)
+ * by calls to this method.
+ */
+// private void printParameters(JoinPoint jp) {
+// Class[] ptypes = jp.parameterTypes;
+// String[] pnames = jp.parameterNames;
+// Object[] params = jp.parameters;
+
+// getStream().print("(");
+// for (int i = 0; i < ptypes.length; i++) {
+// getStream().print(ptypes[i].getName() + " " +
+// pnames[i] + "=" +
+// params[i]);
+// if (i < ptypes.length - 1) getStream().print(", ");
+// }
+// getStream().print(")");
+// }
+
+}
+
diff --git a/docs/modules/ROOT/pages/examples/tracing/lib/TraceMyClasses.java b/docs/modules/ROOT/pages/examples/tracing/lib/TraceMyClasses.java
new file mode 100644
index 000000000..95c3a859c
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/lib/TraceMyClasses.java
@@ -0,0 +1,67 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing.lib;
+
+import tracing.TwoDShape;
+import tracing.Circle;
+import tracing.Square;
+import tracing.ExampleMain;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.io.FileNotFoundException;
+
+aspect TraceMyClasses extends AbstractTrace {
+ /**
+ * The application classes
+ */
+ pointcut classes(): within(TwoDShape) || within(Circle) || within(Square);
+ /**
+ * The constructors in those classes - but only the ones with 3
+ * arguments.
+ */
+ pointcut constructors(): execution(new(double, double, double));
+ /**
+ * This specifies all the message executions.
+ */
+ pointcut methods(): execution(* *(..));
+
+ /**
+ * A main function for testing the trace aspect.
+ */
+ public static void main(String[] _args) {
+ final String[] args = _args;
+ new Thread() {
+ public void run() {
+ TraceMyClasses.aspectOf().initStream(System.err);
+ ExampleMain.main(args);
+ }
+ }.start();
+
+ new Thread() {
+ public void run() {
+ try {
+ TraceMyClasses.aspectOf().initStream(new PrintStream(new FileOutputStream("AJTRACETEST")));
+ }
+ catch (FileNotFoundException e) {}
+ ExampleMain.main(args);
+ }
+ }.start();
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/notrace.lst b/docs/modules/ROOT/pages/examples/tracing/notrace.lst
new file mode 100644
index 000000000..ebd820352
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/notrace.lst
@@ -0,0 +1,4 @@
+TwoDShape.java
+Circle.java
+Square.java
+ExampleMain.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/tracelib.lst b/docs/modules/ROOT/pages/examples/tracing/tracelib.lst
new file mode 100644
index 000000000..a9a494d10
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/tracelib.lst
@@ -0,0 +1,6 @@
+TwoDShape.java
+Circle.java
+Square.java
+ExampleMain.java
+lib/AbstractTrace.java
+lib/TraceMyClasses.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/tracev1.lst b/docs/modules/ROOT/pages/examples/tracing/tracev1.lst
new file mode 100644
index 000000000..35a95c46f
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/tracev1.lst
@@ -0,0 +1,6 @@
+TwoDShape.java
+Circle.java
+Square.java
+ExampleMain.java
+version1/Trace.java
+version1/TraceMyClasses.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/tracev2.lst b/docs/modules/ROOT/pages/examples/tracing/tracev2.lst
new file mode 100644
index 000000000..e37fe1a11
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/tracev2.lst
@@ -0,0 +1,6 @@
+TwoDShape.java
+Circle.java
+Square.java
+ExampleMain.java
+version2/Trace.java
+version2/TraceMyClasses.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/tracev3.lst b/docs/modules/ROOT/pages/examples/tracing/tracev3.lst
new file mode 100644
index 000000000..2804f306d
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/tracev3.lst
@@ -0,0 +1,6 @@
+TwoDShape.java
+Circle.java
+Square.java
+ExampleMain.java
+version3/Trace.java
+version3/TraceMyClasses.java
diff --git a/docs/modules/ROOT/pages/examples/tracing/version1/Trace.java b/docs/modules/ROOT/pages/examples/tracing/version1/Trace.java
new file mode 100644
index 000000000..97b5edb3f
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version1/Trace.java
@@ -0,0 +1,77 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tracing.version1;
+
+import java.io.PrintStream;
+
+/**
+ *
+ * This class provides some basic functionality for printing trace messages
+ * into a stream.
+ *
+ */
+public class Trace {
+ /**
+ * There are 3 trace levels (values of TRACELEVEL):
+ * 0 - No messages are printed
+ * 1 - Trace messages are printed, but there is no indentation
+ * according to the call stack
+ * 2 - Trace messages are printed, and they are indented
+ * according to the call stack
+ */
+ public static int TRACELEVEL = 0;
+ protected static PrintStream stream = null;
+ protected static int callDepth = 0;
+
+ /**
+ * Initialization.
+ */
+ public static void initStream(PrintStream s) {
+ stream = s;
+ }
+
+ /**
+ * Prints an "entering" message. It is intended to be called in the
+ * beginning of the blocks to be traced.
+ */
+ public static void traceEntry(String str) {
+ if (TRACELEVEL == 0) return;
+ if (TRACELEVEL == 2) callDepth++;
+ printEntering(str);
+ }
+
+ /**
+ * Prints an "exiting" message. It is intended to be called in the
+ * end of the blocks to be traced.
+ */
+ public static void traceExit(String str) {
+ if (TRACELEVEL == 0) return;
+ printExiting(str);
+ if (TRACELEVEL == 2) callDepth--;
+ }
+
+ private static void printEntering(String str) {
+ printIndent();
+ stream.println("--> " + str);
+ }
+
+ private static void printExiting(String str) {
+ printIndent();
+ stream.println("<-- " + str);
+ }
+
+ private static void printIndent() {
+ for (int i = 0; i < callDepth; i++)
+ stream.print(" ");
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/version1/TraceMyClasses.java b/docs/modules/ROOT/pages/examples/tracing/version1/TraceMyClasses.java
new file mode 100644
index 000000000..736e96413
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version1/TraceMyClasses.java
@@ -0,0 +1,69 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tracing.version1;
+
+/**
+ *
+ * This class connects the tracing functions in the Trace class with
+ * the constructors and methods in the application classes.
+ *
+ */
+import tracing.TwoDShape;
+import tracing.Circle;
+import tracing.Square;
+import tracing.ExampleMain;
+
+aspect TraceMyClasses {
+ /**
+ * Application classes.
+ */
+ pointcut myClass(): within(TwoDShape) || within(Circle) || within(Square);
+ /**
+ * The constructors in those classes.
+ */
+ pointcut myConstructor(): myClass() && execution(new(..));
+ /**
+ * The methods of those classes.
+ */
+ pointcut myMethod(): myClass() && execution(* *(..));
+
+ /**
+ * Prints trace messages before and after executing constructors.
+ */
+ before (): myConstructor() {
+ Trace.traceEntry("" + thisJoinPointStaticPart.getSignature());
+ }
+ after(): myConstructor() {
+ Trace.traceExit("" + thisJoinPointStaticPart.getSignature());
+ }
+
+ /**
+ * Prints trace messages before and after executing methods.
+ */
+ before (): myMethod() {
+ Trace.traceEntry("" + thisJoinPointStaticPart.getSignature());
+ }
+ after(): myMethod() {
+ Trace.traceExit("" + thisJoinPointStaticPart.getSignature());
+ }
+
+ /**
+ * A main function for testing the trace aspect.
+ */
+ public static void main(String[] args) {
+ Trace.TRACELEVEL = 2;
+ Trace.initStream(System.err);
+ ExampleMain.main(args);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/examples/tracing/version2/Trace.java b/docs/modules/ROOT/pages/examples/tracing/version2/Trace.java
new file mode 100644
index 000000000..6c43d60f8
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version2/Trace.java
@@ -0,0 +1,117 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tracing.version2;
+
+import java.io.PrintStream;
+
+/**
+ *
+ * This class provides support for printing trace messages into a stream.
+ * Trace messages are printed before and after constructors and methods
+ * are executed.
+ * It defines one abstract crosscut for injecting that tracing functionality
+ * into any application classes.
+ * To use it, provide a subclass that concretizes the abstract crosscut.
+ */
+abstract aspect Trace {
+
+ /*
+ * Functional part
+ */
+
+ /**
+ * There are 3 trace levels (values of TRACELEVEL):
+ * 0 - No messages are printed
+ * 1 - Trace messages are printed, but there is no indentation
+ * according to the call stack
+ * 2 - Trace messages are printed, and they are indented
+ * according to the call stack
+ */
+ public static int TRACELEVEL = 2;
+ protected static PrintStream stream = System.err;
+ protected static int callDepth = 0;
+
+ /**
+ * Initialization.
+ */
+ public static void initStream(PrintStream s) {
+ stream = s;
+ }
+
+ protected static void traceEntry(String str) {
+ if (TRACELEVEL == 0) return;
+ if (TRACELEVEL == 2) callDepth++;
+ printEntering(str);
+ }
+
+ protected static void traceExit(String str) {
+ if (TRACELEVEL == 0) return;
+ printExiting(str);
+ if (TRACELEVEL == 2) callDepth--;
+ }
+
+ private static void printEntering(String str) {
+ printIndent();
+ stream.println("--> " + str);
+ }
+
+ private static void printExiting(String str) {
+ printIndent();
+ stream.println("<-- " + str);
+ }
+
+
+ private static void printIndent() {
+ for (int i = 0; i < callDepth; i++)
+ stream.print(" ");
+ }
+
+
+ /*
+ * Crosscut part
+ */
+
+ /**
+ * Application classes - left unspecified.
+ * Subclasses should concretize this pointcut with class names.
+ */
+ abstract pointcut myClass();
+ /**
+ * The constructors in those classes.
+ */
+ pointcut myConstructor(): myClass() && execution(new(..));
+ /**
+ * The methods of those classes.
+ */
+ pointcut myMethod(): myClass() && execution(* *(..));
+
+ /**
+ * Prints trace messages before and after executing constructors.
+ */
+ before(): myConstructor() {
+ traceEntry("" + thisJoinPointStaticPart.getSignature());
+ }
+ after(): myConstructor() {
+ traceExit("" + thisJoinPointStaticPart.getSignature());
+ }
+
+ /**
+ * Prints trace messages before and after executing methods.
+ */
+ before(): myMethod() {
+ traceEntry("" + thisJoinPointStaticPart.getSignature());
+ }
+ after(): myMethod() {
+ traceExit("" + thisJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/version2/TraceMyClasses.java b/docs/modules/ROOT/pages/examples/tracing/version2/TraceMyClasses.java
new file mode 100644
index 000000000..d9ba21c54
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version2/TraceMyClasses.java
@@ -0,0 +1,37 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tracing.version2;
+
+import tracing.TwoDShape;
+import tracing.Circle;
+import tracing.Square;
+import tracing.ExampleMain;
+
+/**
+ *
+ * This class concretizes the abstract crosscut in Trace,
+ * applying the trace facility to these application classes.
+ *
+ */
+public aspect TraceMyClasses extends Trace {
+ pointcut myClass(): within(TwoDShape) || within(Circle) || within(Square);
+
+ /**
+ * A main function for testing the trace aspect.
+ */
+ public static void main(String[] args) {
+ Trace.TRACELEVEL = 2;
+ Trace.initStream(System.err);
+ ExampleMain.main(args);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/version3/Trace.java b/docs/modules/ROOT/pages/examples/tracing/version3/Trace.java
new file mode 100644
index 000000000..8fc9d8613
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version3/Trace.java
@@ -0,0 +1,123 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing.version3;
+
+import java.io.PrintStream;
+
+/**
+ *
+ * This class provides support for printing trace messages into a stream.
+ * Trace messages are printed before and after constructors and methods
+ * are executed.
+ * The messages are appended with the string representation of the objects
+ * whose constructors and methods are being traced.
+ * It defines one abstract pointcut for injecting that tracing functionality
+ * into any application classes.
+ *
+ */
+abstract aspect Trace {
+
+ /*
+ * Functional part
+ */
+
+ /**
+ * There are 3 trace levels (values of TRACELEVEL):
+ * 0 - No messages are printed
+ * 1 - Trace messages are printed, but there is no indentation
+ * according to the call stack
+ * 2 - Trace messages are printed, and they are indented
+ * according to the call stack
+ */
+ public static int TRACELEVEL = 0;
+ protected static PrintStream stream = null;
+ protected static int callDepth = 0;
+
+ /**
+ * Initialization.
+ */
+ public static void initStream(PrintStream s) {
+ stream = s;
+ }
+
+ protected static void traceEntry(String str, Object o) {
+ if (TRACELEVEL == 0) return;
+ if (TRACELEVEL == 2) callDepth++;
+ printEntering(str + ": " + o.toString());
+ }
+
+ protected static void traceExit(String str, Object o) {
+ if (TRACELEVEL == 0) return;
+ printExiting(str + ": " + o.toString());
+ if (TRACELEVEL == 2) callDepth--;
+ }
+
+ private static void printEntering(String str) {
+ printIndent();
+ stream.println("--> " + str);
+ }
+
+ private static void printExiting(String str) {
+ printIndent();
+ stream.println("<-- " + str);
+ }
+
+
+ private static void printIndent() {
+ for (int i = 0; i < callDepth; i++)
+ stream.print(" ");
+ }
+
+
+ /*
+ * Crosscut part
+ */
+
+ /**
+ * Application classes - left unspecified.
+ */
+ abstract pointcut myClass(Object obj);
+ /**
+ * The constructors in those classes.
+ */
+ pointcut myConstructor(Object obj): myClass(obj) && execution(new(..));
+ /**
+ * The methods of those classes.
+ */
+ // toString is called from within our advice, so we shouldn't
+ // advise its executions. But if toString is overridden, even
+ // this might not be enough, so we might want
+ // && !cflow(execution(String toString()))
+ pointcut myMethod(Object obj): myClass(obj) &&
+ execution(* *(..)) && !execution(String toString());
+
+ before(Object obj): myConstructor(obj) {
+ traceEntry("" + thisJoinPointStaticPart.getSignature(), obj);
+ }
+ after(Object obj): myConstructor(obj) {
+ traceExit("" + thisJoinPointStaticPart.getSignature(), obj);
+ }
+
+ before(Object obj): myMethod(obj) {
+ traceEntry("" + thisJoinPointStaticPart.getSignature(), obj);
+ }
+ after(Object obj): myMethod(obj) {
+ traceExit("" + thisJoinPointStaticPart.getSignature(), obj);
+ }
+}
diff --git a/docs/modules/ROOT/pages/examples/tracing/version3/TraceMyClasses.java b/docs/modules/ROOT/pages/examples/tracing/version3/TraceMyClasses.java
new file mode 100644
index 000000000..c986d2615
--- /dev/null
+++ b/docs/modules/ROOT/pages/examples/tracing/version3/TraceMyClasses.java
@@ -0,0 +1,46 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package tracing.version3;
+
+import tracing.TwoDShape;
+import tracing.Circle;
+import tracing.Square;
+import tracing.ExampleMain;
+
+/**
+ *
+ * This class concretizes the abstract crosscut in Trace,
+ * applying the trace facility to these application classes.
+ *
+ */
+public aspect TraceMyClasses extends Trace {
+ pointcut myClass(Object obj):
+ this(obj) &&
+ (within(TwoDShape) || within(Circle) || within(Square));
+
+ /**
+ * A main function for testing the trace aspect.
+ */
+ public static void main(String[] args) {
+ Trace.TRACELEVEL = 2;
+ Trace.initStream(System.err);
+ ExampleMain.main(args);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc
new file mode 100644
index 000000000..4daa8ee0a
--- /dev/null
+++ b/docs/modules/ROOT/pages/index.adoc
@@ -0,0 +1,221 @@
+[[top]]
+== AspectJ Documentation and Resources
+
+AspectJ^TM^ is a seamless aspect-oriented extension to Java^TM^. The compiler and development tools are available under
+an open-source license, require Java 8 to run, and produce code that runs in JDK 1.3 and later VM's. For the latest
+materials, see https://eclipse.org/aspectj. Not all of these materials have been updated for AspectJ 5.
+
+[cols=",",]
+|===
+|+++Section+++ |+++Contents+++
+
+|xref:#documentation[Documentation]
+|xref:faq/faq.adoc#faq[FAQ], xref:quickref/quick5.pdf[Quick Reference (AspectJ 5)],
+xref:quickref/quick.pdf[Quick Reference (1.2.1)], xref:adk15notebook/index.adoc[AspectJ 5 Developer's Notebook],
+xref:progguide/index.adoc[programming], xref:devguide/index.adoc[development] and
+xref:pdguide/index.adoc[problem diagnosis] guides, link:runtime-api/index.html[runtime API],
+link:weaver-api/index.html[weaver API] and link:examples[example code]
+
+|xref:#distributions[Distributions]
+|https://eclipse.org/aspectj[AspectJ] development environment support for https://eclipse.org/ajdt[Eclipse]
+
+|xref:#resources[Other resources]
+|https://eclipse.org/aspectj[AspectJ project], the bug https://bugs.eclipse.org/bugs[db], and mailing lists for
+mailto:aspectj-users@eclipse.org[users] and mailto:aspectj-dev@eclipse.org[developers].
+
+|xref:#paths[Learning paths] |for those new to AspectJ
+|===
+
+[[documentation]]
+=== AspectJ documentation
+
+[width="100%",cols="50%,50%",options="header",]
+|===
+|Documentation
+|Description
+
+|xref:quickref/quick5.pdf[AspectJ 5 Quick Reference]
+|Four-page quick reference for the AspectJ 5 language
+
+|xref:quickref/quick.pdf[AspectJ Quick Reference]
+|Two-page quick reference for the AspectJ language
+
+a|AspectJ 5 Developer's Notebook
+
+* xref:adk15notebook/index.adoc[HTML multi-page]
+* xref:adk15notebook/adk15notebook.adoc[HTML single page]
+* xref:adk15notebook/adk15notebook.pdf[PDF]
+|Describes the changes to the AspectJ language and tools introduced in the AspectJ 5 Development Kit. These changes are
+additive, and are not yet reflected in the programming guide or quick reference.
+
+a|Programming Guide
+
+* xref:progguide/index.adoc[HTML multi-page]
+* xref:progguide/progguide.adoc[HTML single page]
+* xref:progguide/progguide.pdf[PDF]
+|Introduces AOP and the AspectJ language. xref:progguide/gettingstarted.adoc[Getting Started] describes basic semantics
+and shows development- and production-time applications. xref:progguide/language.adoc[The AspectJ Language] describes
+join points, pointcuts, advice, and introduction, all features new to AOP. xref:progguide/examples.adoc[Examples] walks
+you through the examples included with the documentation, and there are two short chapters on useful
+xref:progguide/idioms.adoc[Idioms] and a few xref:progguide/pitfalls.html[Pitfalls]. +
+The appendices have reference information: the xref:progguide/quickreference.adoc[Quick Reference] summarizes AspectJ
+syntax, the xref:progguide/semantics.adoc[Language Semantics] best describes AspectJ usage, and
+xref:progguide/implementation.adoc[Implementation Notes] describes how the current version is limited to code the
+compiler controls.
+
+a|Development Environment Guide
+
+* xref:devguide/index.adoc[HTML multi-page]
+* xref:devguide/devguide.adoc[HTML single page]
+* xref:devguide/devguide.pdf[PDF]
+|Guide to the command-line compiler xref:devguide/ajc.adoc[ajc] and the xref:devguide/antsupport.adoc[Ant tasks] for
+building AspectJ programs
+
+a|Problem Diagnosis Guide
+
+* xref:pdguide/index.adoc[HTML multi-page]
+* xref:pdguide/pdguide.adoc[HTML single page]
+* xref:pdguide/pdguide.pdf[PDF]
+|Guide to various debugging features available, such as messages and trace to help you both solve problems with you own
+programs and report bugs to the AspectJ team
+
+|xref:runtime-api/index.html[AspectJ Runtime API]
+|API documentation for AspectJ runtime classes. `JoinPoint` shows the state automatically available at each join point.
+`ProceedingJoinPoint` explains how to `proceed(..)` to the intercepted join point from an around advice.
+
+|xref:weaver-api/index.html[AspectJ Weaver API]
+|API documentation for AspectJ weaver classes. This is a superset of the runtime API plus all the additional classes
+used for byte code weaving, both during compilation from source code and binary weaving during post-compile and
+load-time weaving.
+
+|xref:faq/faq.adoc#faq[FAQ]
+|Frequently asked questions about the AspectJ language, tools, and project
+
+|xref:release/JavaVersionCompatibility.adoc[Java version compatibility]
+|Compatibility matrix, explaining which AspectJ compiler version supports which Java language version and needs which
+JDK to run
+
+|Release notes |Release notes, describing new features, improvements, bugfixes per AspectJ version: +
+ +
+xref:release/README-1.9.21.adoc[1.9.21],
+xref:release/README-1.9.20.adoc[1.9.20 and 1.9.20.1], xref:release/README-1.9.19.adoc[1.9.19],
+xref:release/README-1.9.9.adoc[1.9.9 and 1.9.9.1], xref:release/README-1.9.8.adoc[1.9.8],
+xref:release/README-1.9.7.adoc[1.9.7], xref:release/README-1.9.6.adoc[1.9.6],
+xref:release/README-1.9.5.adoc[1.9.5], xref:release/README-1.9.4.adoc[1.9.4],
+xref:release/README-1.9.3.adoc[1.9.3], xref:release/README-1.9.2.adoc[1.9.2],
+xref:release/README-1.9.1.adoc[1.9.1], xref:release/README-1.9.0.adoc[1.9.0],
+xref:release/README-1.8.11.adoc[1.8.11], xref:release/README-1.8.10.adoc[1.8.10],
+xref:release/README-1.8.9.adoc[1.8.9], xref:release/README-1.8.8.adoc[1.8.8],
+xref:release/README-1.8.7.adoc[1.8.7], xref:release/README-1.8.6.adoc[1.8.6],
+xref:release/README-1.8.5.adoc[1.8.5], xref:release/README-1.8.4.adoc[1.8.4],
+xref:release/README-1.8.3.adoc[1.8.3], xref:release/README-1.8.2.adoc[1.8.2],
+xref:release/README-1.8.1.adoc[1.8.1], xref:release/README-1.8.0.adoc[1.8.0],
+xref:release/README-1.7.4.adoc[1.7.4], xref:release/README-1.7.3.adoc[1.7.3],
+xref:release/README-1.7.2.adoc[1.7.2], xref:release/README-1.7.1.adoc[1.7.1],
+xref:release/README-1.7.0.adoc[1.7.0], xref:release/README-1.6.12.adoc[1.6.12],
+xref:release/README-1.6.11.adoc[1.6.11], xref:release/README-1.6.10.adoc[1.6.10],
+xref:release/README-1.6.9.adoc[1.6.9], xref:release/README-1.6.8.adoc[1.6.8],
+xref:release/README-1.6.7.adoc[1.6.7], xref:release/README-1.6.6.adoc[1.6.6],
+xref:release/README-1.6.5.adoc[1.6.5], xref:release/README-1.6.4.adoc[1.6.4],
+xref:release/README-1.6.3.adoc[1.6.3], xref:release/README-1.6.2.adoc[1.6.2],
+xref:release/README-1.6.1.adoc[1.6.1], xref:release/README-1.6.0.adoc[1.6.0],
+xref:release/README-1.5.4.adoc[1.5.4], xref:release/README-1.5.3.adoc[1.5.3],
+xref:release/README-1.5.2.adoc[1.5.2], xref:release/README-1.5.1.adoc[1.5.1],
+xref:release/README-1.5.0.adoc[1.5.0], xref:release/README-1.2.1.adoc[1.2.1],
+xref:release/README-1.2.adoc[1.2], xref:release/README-1.1.adoc[1.1].
+
+|xref:release/changes.adoc[Changes] (historical)
+|Changes between historical releases up to 1.6.0
+
+|xref:release/porting.adoc[Porting guide] (historical)
+|Porting guide for historical releases to 1.2
+
+|link:examples[Examples]
+|AspectJ code to demonstrate some language features and implement JavaBean properties, the Observer pattern, a tracing
+library, and a game application where aspects handle display updating
+
+a|AspectJ Design Overview
+
+* xref:developer/index.adoc[HTML multi-page]
+* xref:developer/design-overview.adoc[HTML single page]
+* xref:developer/design-overview.pdf[PDF]
+|Introductory information about AspectJ language design, developer guides, module structure
+|===
+
+[[distributions]]
+
+=== AspectJ distributions
+
+[cols=",",options="header",]
+|===
+|Distributions
+|Description
+
+|https://eclipse.org/aspectj[AspectJ binary distribution]
+|The AspectJ distribution contains a Java-based installer, binaries for the compiler, Ant taskdefs as well as the
+documentation and examples.
+
+|https://eclipse.org/aspectj[AspectJ source code]
+|Source code for AspectJ is available under the open-source
+https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt[Eclipse Public License v 2.0] license from the Git
+repositories for the AspectJ project. See the xref:faq/faq.adoc#buildingsource[FAQ entry].
+
+|https://eclipse.org/ajdt[AspectJ for Eclipse]
+|AspectJ Development Environment support for Eclipse is available under Eclipse Public License v 1.0 from the
+eclipse.org project site https://eclipse.org/ajdt
+|===
+
+[[resources]]
+
+=== Other AspectJ resources
+
+[cols=",",options="header",]
+|===
+|Resources
+|Description
+
+|Mail lists
+|AspectJ users discuss tips and best practices for writing AspectJ programs on aspectj-users@eclipse.org. AspectJ
+developers discuss issues with developing the AspectJ tools on aspectj-dev@eclipse.org. To get occasional emails about
+AspectJ releases and relevant events, subscribe to aspectj-announce@eclipse.org. To view list archives or subscribe to
+the list, go to https://eclipse.org/aspectj[the AspectJ home page]. To find archived emails, use the Eclipse site
+https://www.eclipse.org/search/search.cgi[search page].
+
+|https://bugs.eclipse.org/bugs[Bug database]
+|Use the Eclipse project's Bugzilla database to view and submit bugs against the AspectJ product components
+https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler[Compiler] (for the AspectJ compiler, ajc),
+https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=IDE[IDE] (for AJDE bugs),
+https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Ant[Ant] (for the Ant tasks) and
+https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Docs[Docs] (for the documentation).
+Bugs all users should know about are
+https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&keywords=info[flagged with the "info" keyword].
+See the xref:faq/faq.adoc#ajcbugs[FAQ entry] for instructions on submitting compiler bugs.
+|===
+
+[[paths]]
+=== Suggested learning paths for those new to AspectJ
+
+To learn the AspectJ language, read the xref:progguide/index.adoc[Programming Guide], keeping the
+xref:progguide/semantics.adoc[Semantics appendix] nearby as the best reference for AspectJ usage. Focus initially on the
+join point model and pointcuts, concepts AOP adds to OOP. To read about how the link:examples[examples] work, see the
+xref:progguide/examples.adoc[Examples] section in the xref:progguide/index.adoc[Programming Guide]. View and navigate
+the crosscutting structure using https://eclipse.org/ajdt[AJDT].
+
+To start using AspectJ with your own code, modify the example aspects to apply to your classes. As you learn, use the
+compiler's `-Xlint` flags to catch some common mistakes. (Understand that the
+xref:progguide/implementation.adoc[current implementation] is limited to code the compiler controls.)
+
+To plan how to adopt AspectJ into a project, read the xref:progguide/index.adoc[Programming Guide] on development- and
+production-time aspects and the FAQ entries for xref:faq/faq.adoc#howToStartUsing[How should I start using AspectJ?],
+xref:faq/faq.adoc#adoption[Deciding to adopt AspectJ], the Development tools sections
+(xref:faq/faq.adoc#integrateWithDevTools[How does AspectJ integrate with existing Java development tools?],
+xref:faq/faq.adoc#devtools[Integrating AspectJ into your development environment],
+xref:faq/faq.adoc#ltw[Load-time weaving]), and xref:faq/faq.adoc#opensource[AspectJ as open-source]).
+
+Enjoy the language!
+
+The AspectJ Team
+
+'''''
+
+[.small]#xref:#top[Top]#
diff --git a/docs/modules/ROOT/pages/quickref/quick.doc b/docs/modules/ROOT/pages/quickref/quick.doc
new file mode 100644
index 000000000..515e04e73
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quick.doc
Binary files differ
diff --git a/docs/modules/ROOT/pages/quickref/quick.pdf b/docs/modules/ROOT/pages/quickref/quick.pdf
new file mode 100644
index 000000000..8fc2bdaa6
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quick.pdf
Binary files differ
diff --git a/docs/modules/ROOT/pages/quickref/quick5.doc b/docs/modules/ROOT/pages/quickref/quick5.doc
new file mode 100644
index 000000000..2f372f0a9
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quick5.doc
Binary files differ
diff --git a/docs/modules/ROOT/pages/quickref/quick5.pdf b/docs/modules/ROOT/pages/quickref/quick5.pdf
new file mode 100644
index 000000000..02452caac
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quick5.pdf
Binary files differ
diff --git a/docs/modules/ROOT/pages/quickref/quick5A4.pdf b/docs/modules/ROOT/pages/quickref/quick5A4.pdf
new file mode 100644
index 000000000..317512818
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quick5A4.pdf
Binary files differ
diff --git a/docs/modules/ROOT/pages/quickref/quickA4.pdf b/docs/modules/ROOT/pages/quickref/quickA4.pdf
new file mode 100644
index 000000000..502916ecb
--- /dev/null
+++ b/docs/modules/ROOT/pages/quickref/quickA4.pdf
Binary files differ
diff --git a/docs/modules/ROOT/pages/readme-docs-module.adoc b/docs/modules/ROOT/pages/readme-docs-module.adoc
new file mode 100644
index 000000000..d7d236749
--- /dev/null
+++ b/docs/modules/ROOT/pages/readme-docs-module.adoc
@@ -0,0 +1,19 @@
+= AspectJ docs
+
+== Contents and build
+
+This module contains the sources for the documentation delivered with
+the AspectJ distribution and for various internal, teaching, and online
+works:
+
+* `devguide`: AsciiDoc sources for the AspectJ Development Environment Guide
+* `progguide`: AsciiDoc sources for the AspectJ Programming Language Guide
+* `faq`: AsciiDoc sources for the AspectJ Frequently Asked Questions
+* `sandbox`: a collection of sample AspectJ programs, tools built on the
+ AspectJ API's, script snippets, and instructional trails, all intended
+ to serve as sources for documentation. See xref:sandbox/readme-sandbox.adoc[].
+* `teaching`: Teaching materials, esp. for the AspectJ tutorials.
+* `quickref/quick.doc`: The Microsoft Word source file for the .pdf Quick Reference
+ guides `quickref/quick.pdf` and `quickref/quickA4.pdf`.
+* `build.xml`: Ant build script for the doc distribution
+* `developer`: Docs for AspectJ developers
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/aopalliance.jar b/docs/modules/ROOT/pages/sandbox/aopalliance/aopalliance.jar
new file mode 100644
index 000000000..578b1a0c3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/aopalliance.jar
Binary files differ
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/lib/aj-aopalliance.jar b/docs/modules/ROOT/pages/sandbox/aopalliance/lib/aj-aopalliance.jar
new file mode 100644
index 000000000..b41ecaaac
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/lib/aj-aopalliance.jar
Binary files differ
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/readme.txt b/docs/modules/ROOT/pages/sandbox/aopalliance/readme.txt
new file mode 100644
index 000000000..2c6083fe1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/readme.txt
@@ -0,0 +1,21 @@
+This example shows how to call an AOP Alliance aspect (interceptor) from
+within AspectJ.
+
+The contents of the src directory comprise some library classes plus an
+abstract aspect that can be extended to create AOP Alliance invoking concrete
+aspects (provide an implementation of getMethodInterceptor() and the
+targetJP() pointcut in your concrete subaspect).
+
+The contents of the testsrc directory supply test cases, and in so doing a
+sample of using the AOPAllianceAdapter aspect (HelloAOPAllianceAdapter aspect).
+
+With the docs module checked out of the AspectJ CVS tree, I build and test
+these AOPAlliance samples as follows:
+
+Create an AJDT project, "AOPAlliance" (you can call it whatever you like).
+Add the file lib/aopalliance.jar to the build path. Remove the default source
+directory that will have been set up for the project, and add a "src" directory.
+When doing this click "advanced" and set it up as a link to the src folder in
+this directory. Do the same for "testsrc". Now you have an AJDT project that
+should build and take its source from this directory. To run the tests, select
+the "AllTests.java" file in the AJDT project and choose "run as junit."
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj
new file mode 100644
index 000000000..50c71830b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/AOPAllianceAdapter.aj
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.aopalliance;
+
+import org.aspectj.lang.SoftException;
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.ConstructorInterceptor;
+
+public abstract aspect AOPAllianceAdapter {
+
+ /**
+ * Return the interceptor to use at method execution join points.
+ * Must be overriden by subclasses.
+ * @return MethodInterceptor, or null if no method advice required
+ */
+ protected abstract MethodInterceptor getMethodInterceptor();
+
+ /**
+ * Return the interceptor to use at constructor execution join points.
+ * May be overriden by subclasses.
+ * @return ConstructorInterceptor, or null if no constructor advice required
+ */
+ protected ConstructorInterceptor getConstructorInterceptor() {
+ return null;
+ }
+
+ protected abstract pointcut targetJoinPoint();
+
+ pointcut methodExecution() : execution(* *(..));
+ pointcut constructorExecution() : execution(new(..));
+
+ Object around() : targetJoinPoint() && methodExecution() {
+ MethodInvocationClosure mic = new MethodInvocationClosure(thisJoinPoint) {
+ public Object execute() { return proceed();}
+ };
+ MethodInterceptor mInt = getMethodInterceptor();
+ if (mInt != null) {
+ try {
+ return mInt.invoke(mic);
+ } catch (Throwable t) {
+ throw new SoftException(t);
+ }
+ } else {
+ return proceed();
+ }
+ }
+
+ Object around() : targetJoinPoint() && constructorExecution() {
+ ConstructorInvocationClosure cic = new ConstructorInvocationClosure(thisJoinPoint) {
+ public Object execute() { proceed(); return thisJoinPoint.getThis();}
+ };
+ ConstructorInterceptor cInt = getConstructorInterceptor();
+ if (cInt != null) {
+ try {
+ return cInt.construct(cic);
+ } catch (Throwable t) {
+ throw new SoftException(t);
+ }
+ } else {
+ return proceed();
+ }
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java
new file mode 100644
index 000000000..8495d13be
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/ConstructorInvocationClosure.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.aopalliance;
+
+import java.lang.reflect.Constructor;
+
+import org.aopalliance.intercept.ConstructorInvocation;
+import org.aspectj.lang.JoinPoint;
+
+public abstract class ConstructorInvocationClosure extends InvocationJoinPointClosure
+ implements ConstructorInvocation {
+
+ public ConstructorInvocationClosure(JoinPoint jp) {
+ super(jp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.MethodInvocation#getMethod()
+ */
+ public Constructor getConstructor() {
+ return (Constructor) getStaticPart();
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java
new file mode 100644
index 000000000..d26f031b8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/InvocationJoinPointClosure.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.aopalliance;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.aopalliance.intercept.Invocation;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+import org.aspectj.lang.reflect.ConstructorSignature;
+import org.aspectj.lang.reflect.MethodSignature;
+
+public abstract class InvocationJoinPointClosure extends JoinPointClosure implements Invocation {
+
+ public InvocationJoinPointClosure(JoinPoint jp) {
+ super(jp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.Joinpoint#getStaticPart()
+ */
+ public AccessibleObject getStaticPart() {
+ CodeSignature cSig = (CodeSignature)jp.getSignature();
+ Class clazz = cSig.getDeclaringType();
+ AccessibleObject ret = null;
+ try {
+ if (cSig instanceof MethodSignature) {
+ ret = clazz.getMethod(cSig.getName(),cSig.getParameterTypes());
+ } else if (cSig instanceof ConstructorSignature) {
+ ret = clazz.getConstructor(cSig.getParameterTypes());
+ }
+ } catch (NoSuchMethodException mEx) {
+ throw new UnsupportedOperationException(
+ "Can't find member " + cSig.toLongString());
+ }
+ return ret;
+ }
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.Invocation#getArguments()
+ */
+ public Object[] getArguments() {
+ return jp.getArgs();
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java
new file mode 100644
index 000000000..38f2846d4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/JoinPointClosure.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.aopalliance;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.aopalliance.intercept.Joinpoint;
+import org.aspectj.lang.JoinPoint;
+
+public abstract class JoinPointClosure implements Joinpoint {
+
+ protected JoinPoint jp;
+
+ public JoinPointClosure(JoinPoint joinPoint) {
+ this.jp = joinPoint;
+ }
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.Joinpoint#proceed()
+ */
+ public Object proceed() throws Throwable {
+ return execute();
+ }
+
+ // for subclasses, renamed from proceed to avoid confusion in
+ // AspectJ around advice.
+ public abstract Object execute();
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.Joinpoint#getThis()
+ */
+ public Object getThis() {
+ return jp.getThis();
+ }
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.Joinpoint#getStaticPart()
+ * Must return either a Field, Method or Constructor representing the entity
+ * at the joinpoint.
+ */
+ public abstract AccessibleObject getStaticPart();
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java
new file mode 100644
index 000000000..087761fec
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/src/org/aspectj/aopalliance/MethodInvocationClosure.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.aopalliance;
+
+import java.lang.reflect.Method;
+
+import org.aopalliance.intercept.MethodInvocation;
+import org.aspectj.lang.JoinPoint;
+
+public abstract class MethodInvocationClosure extends InvocationJoinPointClosure
+ implements
+ MethodInvocation {
+
+ public MethodInvocationClosure(JoinPoint jp) {
+ super(jp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.MethodInvocation#getMethod()
+ */
+ public Method getMethod() {
+ return (Method) getStaticPart();
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java
new file mode 100644
index 000000000..94c2be076
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AOPAllianceAdapterTest.java
@@ -0,0 +1,19 @@
+
+package org.aspectj.aopalliance.tests;
+
+import junit.framework.TestCase;
+
+public class AOPAllianceAdapterTest extends TestCase {
+
+ public void testHello() {
+ Hello h = new Hello();
+ h.sayHello();
+ Hello h2 = new Hello("Hello AOP Alliance");
+ h2.sayHello();
+ assertTrue("Constructor executed", Hello.defaultConsExecuted);
+ assertTrue("2nd Constructor executed", Hello.paramConsExecuted);
+ assertEquals("sayHello invoked twice",2,Hello.sayHelloCount);
+ assertEquals("Constructor interceptor ran twice",2,HelloConstructionInterceptor.runCount);
+ assertEquals("Method interceptor ran twice",2,HelloMethodInterceptor.runCount);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java
new file mode 100644
index 000000000..b86c576bc
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/AllTests.java
@@ -0,0 +1,19 @@
+package org.aspectj.aopalliance.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.aspectj.aopalliance.tests");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(JoinPointClosureTest.class);
+ suite.addTestSuite(InvocationJoinPointClosureTest.class);
+ suite.addTestSuite(MethodInvocationClosureTest.class);
+ suite.addTestSuite(ConstructorInvocationClosureTest.class);
+ suite.addTestSuite(AOPAllianceAdapterTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java
new file mode 100644
index 000000000..18e7f4a84
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/ConstructorInvocationClosureTest.java
@@ -0,0 +1,39 @@
+package org.aspectj.aopalliance.tests;
+
+import java.lang.reflect.Constructor;
+
+import org.aspectj.aopalliance.ConstructorInvocationClosure;
+
+import junit.framework.TestCase;
+
+public class ConstructorInvocationClosureTest extends TestCase {
+
+
+ public void testGetArguments() {
+ MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
+ new Class[] {});
+ Object[] args = new Object[] {this};
+ MockJoinPoint jp = new MockJoinPoint(this,sig,args);
+ ConstructorInvocationClosure cic = new ConstructorInvocationClosure(jp) {
+ public Object execute() {return null;}
+ };
+ assertEquals(args,cic.getArguments());
+ }
+
+ public void testGetConstructor() {
+ MockConstructorSignature sig = new MockConstructorSignature("new",StringBuffer.class,
+ new Class[] {String.class});
+ MockJoinPoint jp = new MockJoinPoint(this,sig,null);
+ ConstructorInvocationClosure cic = new ConstructorInvocationClosure(jp) {
+ public Object execute() {return null;}
+ };
+ Constructor c = cic.getConstructor();
+ try {
+ assertEquals("Should find StringBuffer constructor",StringBuffer.class.getConstructor(new Class[]{String.class}),
+ c);
+ } catch (NoSuchMethodException e) {
+ fail("Duff test:" + e);
+ }
+
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java
new file mode 100644
index 000000000..46bf4c6ad
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/Hello.java
@@ -0,0 +1,24 @@
+
+package org.aspectj.aopalliance.tests;
+
+public class Hello {
+
+ public static boolean defaultConsExecuted = false;
+ public static boolean paramConsExecuted = false;
+ public static int sayHelloCount = 0;
+
+ private String msg = "Hello";
+
+ public Hello() { defaultConsExecuted = true;}
+
+ public Hello(String s) {
+ msg = s;
+ paramConsExecuted = true;
+ }
+
+ public String sayHello() {
+ sayHelloCount++;
+ return msg;
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj
new file mode 100644
index 000000000..28db6621b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloAOPAllianceAdapter.aj
@@ -0,0 +1,28 @@
+package org.aspectj.aopalliance.tests;
+
+import org.aspectj.aopalliance.AOPAllianceAdapter;
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.ConstructorInterceptor;
+
+
+public aspect HelloAOPAllianceAdapter extends AOPAllianceAdapter {
+
+ private MethodInterceptor mInt;
+ private ConstructorInterceptor cInt;
+
+ public pointcut targetJoinPoint() : within(Hello);
+
+ protected MethodInterceptor getMethodInterceptor() {
+ return mInt;
+ }
+
+ protected ConstructorInterceptor getConstructorInterceptor() {
+ return cInt;
+ }
+
+ public HelloAOPAllianceAdapter() {
+ mInt = new HelloMethodInterceptor();
+ cInt = new HelloConstructionInterceptor();
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java
new file mode 100644
index 000000000..cf5d89aa7
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloConstructionInterceptor.java
@@ -0,0 +1,21 @@
+package org.aspectj.aopalliance.tests;
+
+import org.aopalliance.intercept.ConstructorInterceptor;
+import org.aopalliance.intercept.ConstructorInvocation;
+
+public class HelloConstructionInterceptor implements ConstructorInterceptor {
+
+ public static int runCount = 0;
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.ConstructorInterceptor#construct(org.aopalliance.intercept.ConstructorInvocation)
+ */
+ public Object construct(ConstructorInvocation jp) throws Throwable {
+ System.out.println("About to invoke AOP Alliance constructor interceptor");
+ Object ret = jp.proceed();
+ System.out.println("Invoked AOP Alliance constructor interceptor, return = " +
+ (ret != null ? ret.toString() : "null"));
+ runCount++;
+ return ret;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java
new file mode 100644
index 000000000..163e30da9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/HelloMethodInterceptor.java
@@ -0,0 +1,20 @@
+package org.aspectj.aopalliance.tests;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+public class HelloMethodInterceptor implements MethodInterceptor {
+
+ public static int runCount = 0;
+
+ /* (non-Javadoc)
+ * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
+ */
+ public Object invoke(MethodInvocation jp) throws Throwable {
+ System.out.println("About to invoke AOP Alliance method interceptor");
+ Object ret = jp.proceed();
+ System.out.println("Invoked AOP Alliance method interceptor, return = " + ret.toString());
+ runCount++;
+ return ret;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java
new file mode 100644
index 000000000..a9e15aed1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/InvocationJoinPointClosureTest.java
@@ -0,0 +1,76 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import java.lang.reflect.AccessibleObject;
+
+import junit.framework.TestCase;
+
+import org.aspectj.aopalliance.InvocationJoinPointClosure;
+
+
+public class InvocationJoinPointClosureTest extends TestCase {
+
+ public void testGetStaticPartMethod() {
+ MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
+ new Class[] {});
+ MockJoinPoint jp = new MockJoinPoint(this,sig,null);
+ InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
+ public Object execute() {return null;}
+ };
+ AccessibleObject ao = mejpc.getStaticPart();
+ try {
+ assertEquals("Should find toString method",Object.class.getMethod("toString",new Class[]{}),
+ ao);
+ } catch (NoSuchMethodException e) {
+ fail("Duff test:" + e);
+ }
+ }
+
+ public void testGetStaticPartConstructor() {
+ MockConstructorSignature sig = new MockConstructorSignature("new",StringBuffer.class,
+ new Class[] {String.class});
+ MockJoinPoint jp = new MockJoinPoint(this,sig,null);
+ InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
+ public Object execute() {return null;}
+ };
+ AccessibleObject ao = mejpc.getStaticPart();
+ try {
+ assertEquals("Should find StringBuffer constructor",StringBuffer.class.getConstructor(new Class[]{String.class}),
+ ao);
+ } catch (NoSuchMethodException e) {
+ fail("Duff test:" + e);
+ }
+ }
+
+ public void testGetStaticPartException() {
+ try {
+ MockMethodSignature sig = new MockMethodSignature("toKettle",Object.class,
+ new Class[] {});
+ MockJoinPoint jp = new MockJoinPoint(this,sig,null);
+ InvocationJoinPointClosure mejpc = new InvocationJoinPointClosure(jp) {
+ public Object execute() {return null;}
+ };
+ AccessibleObject ao = mejpc.getStaticPart();
+ fail("UnsupportedOperationException expected");
+ } catch (UnsupportedOperationException unEx) {
+ assertEquals("Can't find member long string",unEx.getMessage());
+ }
+ }
+
+ public void testGetArguments() {
+ MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
+ new Class[] {});
+ Object[] args = new Object[] {this};
+ MockJoinPoint jp = new MockJoinPoint(this,sig,args);
+ InvocationJoinPointClosure mic = new InvocationJoinPointClosure(jp) {
+ public Object execute() {return null;}
+ };
+ assertEquals(args,mic.getArguments());
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java
new file mode 100644
index 000000000..6aa4fcc8f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/JoinPointClosureTest.java
@@ -0,0 +1,45 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import java.lang.reflect.AccessibleObject;
+
+import junit.framework.TestCase;
+
+import org.aspectj.aopalliance.JoinPointClosure;
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * @author colyer
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class JoinPointClosureTest extends TestCase {
+
+ public void testGetThis() {
+ JoinPoint jp = new MockJoinPoint(this,null,null);
+ JoinPointClosure jpc = new JoinPointClosure(jp) {
+ public Object execute() {return null;}
+ public AccessibleObject getStaticPart() {return null;}};
+ assertEquals("getThis returns join point 'this'",this,jpc.getThis());
+ }
+
+ public void testProceed() {
+ JoinPoint jp = new MockJoinPoint(this,null,null);
+ JoinPointClosure jpc = new JoinPointClosure(jp) {
+ public Object execute() {return this;}
+ public AccessibleObject getStaticPart() {return null;}};
+ try {
+ Object ret = jpc.proceed();
+ assertTrue("should return value from execute",ret instanceof JoinPointClosure);
+ } catch (Throwable e) {
+ fail("Exception proceeding on join point : " + e);
+ }
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java
new file mode 100644
index 000000000..432479a4b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MethodInvocationClosureTest.java
@@ -0,0 +1,27 @@
+package org.aspectj.aopalliance.tests;
+
+import java.lang.reflect.Method;
+
+import org.aspectj.aopalliance.MethodInvocationClosure;
+
+import junit.framework.TestCase;
+
+public class MethodInvocationClosureTest extends TestCase {
+
+
+ public void testGetMethod() {
+ MockMethodSignature sig = new MockMethodSignature("toString",Object.class,
+ new Class[] {});
+ MockJoinPoint jp = new MockJoinPoint(this,sig,null);
+ MethodInvocationClosure mic = new MethodInvocationClosure(jp) {
+ public Object execute() {return null;}
+ };
+ Method m = mic.getMethod();
+ try {
+ assertEquals("Should find toString method",Object.class.getMethod("toString",new Class[]{}),
+ m);
+ } catch (NoSuchMethodException e) {
+ fail("Duff test:" + e);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java
new file mode 100644
index 000000000..442dc59e9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockConstructorSignature.java
@@ -0,0 +1,16 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import org.aspectj.lang.reflect.ConstructorSignature;
+
+
+class MockConstructorSignature extends MockSignature implements ConstructorSignature {
+ public MockConstructorSignature(String name,Class decClass, Class[] paramTypes) {
+ super(name,decClass,paramTypes);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java
new file mode 100644
index 000000000..1bb28206c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockJoinPoint.java
@@ -0,0 +1,53 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.reflect.SourceLocation;
+
+
+class MockJoinPoint implements JoinPoint {
+
+ private Object me;
+ private Signature sig;
+ private Object[] args;
+
+ public MockJoinPoint(Object me, Signature sig, Object[] args) {
+ this.me = me;
+ this.sig = sig;
+ this.args = args;
+ }
+
+ public Object[] getArgs() {
+ return args;
+ }
+ public String getKind() {
+ return null;
+ }
+ public Signature getSignature() {
+ return sig;
+ }
+ public SourceLocation getSourceLocation() {
+ return null;
+ }
+ public StaticPart getStaticPart() {
+ return null;
+ }
+ public Object getTarget() {
+ return null;
+ }
+ public Object getThis() {
+ return me;
+ }
+ public String toLongString() {
+ return null;
+ }
+ public String toShortString() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java
new file mode 100644
index 000000000..eaa444599
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockMethodSignature.java
@@ -0,0 +1,18 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import org.aspectj.lang.reflect.MethodSignature;
+
+
+class MockMethodSignature extends MockSignature implements MethodSignature {
+ public MockMethodSignature(String name,Class decClass, Class[] paramTypes) {
+ super(name,decClass,paramTypes);
+ }
+
+ public Class getReturnType() {return null;}
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java
new file mode 100644
index 000000000..9b397c5ed
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/aopalliance/testsrc/org/aspectj/aopalliance/tests/MockSignature.java
@@ -0,0 +1,51 @@
+/*
+ * Created on 07-May-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.aspectj.aopalliance.tests;
+
+import org.aspectj.lang.reflect.CodeSignature;
+
+
+class MockSignature implements CodeSignature {
+
+ private String name;
+ private Class decClass;
+ private Class[] paramTypes;
+
+ public MockSignature(String name,Class decClass, Class[] paramTypes) {
+ this.name = name;
+ this.decClass = decClass;
+ this.paramTypes = paramTypes;
+ }
+
+ public Class[] getExceptionTypes() {
+ return null;
+ }
+ public String[] getParameterNames() {
+ return null;
+ }
+ public Class[] getParameterTypes() {
+ return paramTypes;
+ }
+ public Class getDeclaringType() {
+ return decClass;
+ }
+ public String getDeclaringTypeName() {
+ return null;
+ }
+ public int getModifiers() {
+ return 0;
+ }
+ public String getName() {
+ return name;
+ }
+ public String toLongString() {
+ return "long string";
+ }
+ public String toShortString() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java
new file mode 100644
index 000000000..040929c67
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmHierarchyBuilderExtensionTest.java
@@ -0,0 +1,67 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Mik Kersten initial implementation
+ * ******************************************************************/
+ package org.aspectj.samples;
+
+import java.util.ArrayList;
+
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
+import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
+import org.aspectj.asm.internal.ProgramElement;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+
+/**
+ * This test demonstrates how hierarchy building in the ASM can be extended
+ * to put additional information in the model, for example method call sites.
+ *
+ * @author Mik Kersten
+ */
+public class AsmHierarchyBuilderExtensionTest extends AjdeTestCase {
+
+ private ExtendedAsmHiearchyBuilder builder = new ExtendedAsmHiearchyBuilder();
+
+ public void testHiearchyExtension() {
+ assertNotNull(AsmManager.getDefault().getHierarchy().getRoot());
+ System.out.println(AsmManager.getDefault().getHierarchy().getRoot().toLongString());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("examples");
+ AjBuildManager.setAsmHierarchyBuilder(builder); // NOTE that we set our builder here
+ assertTrue("build success", doSynchronousBuild("../examples/coverage/coverage.lst"));
+ }
+}
+
+class ExtendedAsmHiearchyBuilder extends AsmHierarchyBuilder {
+
+ public boolean visit(MessageSend messageSend, BlockScope scope) {
+ IProgramElement peNode = new ProgramElement(
+ new String(">>> found call: " + messageSend.toString()),
+ IProgramElement.Kind.CODE,
+ null, //makeLocation(messageSend),
+ 0,
+ "",
+ new ArrayList());
+// peNode.setCorrespondingType(messageSend.typ ieldDeclaration.type.toString());
+// peNode.setSourceSignature(genSourceSignature(fieldDeclaration));
+ ((IProgramElement)stack.peek()).addChild(peNode);
+ stack.push(peNode);
+ return true;
+ }
+ public void endVisit(MessageSend messageSend, BlockScope scope) {
+ stack.pop();
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapExtensionTest.java b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapExtensionTest.java
new file mode 100644
index 000000000..f11b5bc82
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapExtensionTest.java
@@ -0,0 +1,91 @@
+package org.aspectj.samples;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.asm.*;
+import org.aspectj.asm.internal.ProgramElement;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.weaver.AsmRelationshipProvider;
+import org.aspectj.weaver.ResolvedTypeX;
+
+/**
+ * @author Mik Kersten
+ */
+public class AsmRelationshipMapExtensionTest extends AjdeTestCase {
+
+ public void testDeclares() {
+ System.out.println("----------------------------------");
+ System.out.println("Parents declared by declare parents statements: ");
+ HierarchyWalker walker = new HierarchyWalker() {
+ public void preProcess(IProgramElement node) {
+ if (node.getKind().equals(IProgramElement.Kind.DECLARE_PARENTS)) {
+ System.out.println(node);
+
+ List relations = AsmManager.getDefault().getRelationshipMap().get(node);
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext();) {
+ IRelationship relationship = (IRelationship) it.next();
+ List targets = relationship.getTargets();
+ for (Iterator iter = targets.iterator(); iter.hasNext();) {
+ IProgramElement currElt = AsmManager
+ .getDefault().getHierarchy()
+ .getElement((String) iter.next());
+ System.out.println("--> " + relationship.getName() + ": " + currElt);
+ }
+ }
+ }
+ }
+ }
+ };
+ AsmManager.getDefault().getHierarchy().getRoot().walk(walker);
+ }
+
+ protected void setUp() throws Exception {
+ AsmRelationshipProvider.setDefault(new DeclareInfoProvider());
+ super.setUp("examples");
+
+ assertTrue("build success",
+ doSynchronousBuild("../examples/coverage/coverage.lst"));
+ }
+}
+
+class DeclareInfoProvider extends AsmRelationshipProvider {
+
+ public void addDeclareParentsRelationship(ISourceLocation decp,
+ ResolvedTypeX targetType, List newParents) {
+ super.addDeclareParentsRelationship(decp, targetType, newParents);
+ for (Iterator it = newParents.iterator(); it.hasNext();) {
+ ResolvedTypeX superType = (ResolvedTypeX) it.next();
+
+ String sourceHandle = AsmManager.getDefault().getHandleProvider().createHandleIdentifier(
+ decp.getSourceFile(),decp.getLine(),decp.getColumn(), decp.getOffset());
+ IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForHandle(sourceHandle);
+
+ String superHandle = AsmManager.getDefault().getHandleProvider().createHandleIdentifier(
+ superType.getSourceLocation().getSourceFile(),
+ superType.getSourceLocation().getLine(),
+ superType.getSourceLocation().getColumn(),
+ superType.getSourceLocation().getOffset()
+ );
+
+ if (sourceHandle != null && superHandle != null) {
+ IRelationship foreward = AsmManager.getDefault().getRelationshipMap().get(
+ sourceHandle,
+ IRelationship.Kind.DECLARE,
+ "super types declared",
+ false,
+ true);
+ foreward.addTarget(superHandle);
+
+ IRelationship back = AsmManager.getDefault().getRelationshipMap().get(
+ superHandle, IRelationship.Kind.DECLARE,
+ "declared as super type by",
+ false,
+ true);
+ back.addTarget(sourceHandle);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java
new file mode 100644
index 000000000..d1f050be3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/api-clients/org/aspectj/samples/AsmRelationshipMapUsageTest.java
@@ -0,0 +1,81 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Mik Kersten initial implementation
+ * ******************************************************************/
+
+package org.aspectj.samples;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
+import org.aspectj.asm.*;
+
+/**
+ * Collects join point information for all advised methods and constructors.
+ *
+ * @author Mik Kersten
+ */
+public class AsmRelationshipMapUsageTest extends AjdeTestCase {
+
+ public void testFindAdvisedMethods() {
+ System.out.println("----------------------------------");
+ System.out.println("Methods affected by advice: ");
+ HierarchyWalker walker = new HierarchyWalker() {
+ public void preProcess(IProgramElement node) {
+ if (node.getKind().equals(IProgramElement.Kind.METHOD)) {
+ List relations = AsmManager.getDefault().getRelationshipMap().get(node);
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ IRelationship relationship = (IRelationship)it.next();
+ if (relationship.getKind().equals(IRelationship.Kind.ADVICE)) {
+ System.out.println(
+ "method: " + node.toString()
+ + ", advised by: " + relationship.getTargets());
+ }
+ }
+ }
+ }
+ }
+ };
+ AsmManager.getDefault().getHierarchy().getRoot().walk(walker);
+ }
+
+ public void testListFilesAffectedByInterTypeDecs() {
+ System.out.println("----------------------------------");
+ System.out.println("Files affected by inter type declarations: ");
+ HierarchyWalker walker = new HierarchyWalker() {
+ public void preProcess(IProgramElement node) {
+ if (node.getKind().equals(IProgramElement.Kind.CLASS)) {
+ List relations = AsmManager.getDefault().getRelationshipMap().get(node);
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ IRelationship relationship = (IRelationship)it.next();
+ if (relationship.getKind().equals(IRelationship.Kind.DECLARE_INTER_TYPE)) {
+ System.out.println(
+ "file: " + node.getSourceLocation().getSourceFile().getName()
+ + ", declared on by: " + relationship.getTargets());
+ }
+ }
+ }
+ }
+ }
+ };
+ AsmManager.getDefault().getHierarchy().getRoot().walk(walker);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp("examples");
+ assertTrue("build success", doSynchronousBuild("../examples/spacewar/spacewar/debug.lst"));
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/common/caching/Caching.java b/docs/modules/ROOT/pages/sandbox/common/caching/Caching.java
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/caching/Caching.java
diff --git a/docs/modules/ROOT/pages/sandbox/common/caching/WatchSetters.java b/docs/modules/ROOT/pages/sandbox/common/caching/WatchSetters.java
new file mode 100644
index 000000000..4546977fe
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/caching/WatchSetters.java
@@ -0,0 +1,191 @@
+//@author Ricardo Giacomin, Wes Isberg
+//XXX author n/a at old address for explicit authorization
+
+
+//START-SAMPLE caching-dirty-reflectiveSetters Use getter/setter pattern to track dirtiness
+package caching;
+
+import java.lang.reflect.Method;
+
+/**
+ * Watch setters to skip if new value is same as old
+ * or to set a dirty flag otherwise.
+ * Clients classes opt-in by implementing IWatched,
+ * and anyone can read the dirty and dirty-valid flags.
+ * <pre>
+ * class Foo implements WatchSetters.IWatched {
+ * ...
+ * }
+ * Foo foo = new Foo();
+ * ...
+ * if (!foo.isDirtyValid() || foo.isDirty()) {
+ * foo.write();
+ * }
+ * </pre>
+ *
+ * (Initial draft was sent to aspectj-users@eclipse.org by
+ * Ricardo on 5/13/2003
+ * (https://dev.eclipse.org/mhonarc/lists/aspectj-users/msg00482.html)
+ * but his email fails now, so we
+ * did not get explicit authorization to post.)
+ *
+ * @author Ricardo Giacomin, Wes Isberg
+ */
+public aspect WatchSetters {
+ // just to invoke test code below
+ public static void main(String[] args) {
+ Client.handleTimer(new Timer());
+ }
+
+ private static final Class[] GETTER_ARG_TYPES = new Class[]{};
+ private static final Object[] GETTER_ARGS = new Object[]{};
+ private static final Object NONE = new Object();
+
+ /** maintain dirty flag for any IWatched */
+ public interface IWatched {}
+
+ /** true if new value sent to any setter */
+ private boolean IWatched.dirty;
+
+ /** false if unable to maintain dirty b/c no privileges, no getter... */
+ private boolean IWatched.dirtyValid = true;
+
+ /** clients can use dirty flag */
+ public boolean IWatched.isDirty() {
+ return dirty;
+ }
+
+ /** clients handle case when dirty flag is invalid */
+ public boolean IWatched.isDirtyValid() {
+ return dirtyValid;
+ }
+
+ /** Setters are instance methods returning void,
+ * prefixed "set..." and taking exactly 1 argument.
+ * Does not use args(id), since that requires the
+ * argument be non-null.
+ */
+ public pointcut setters(IWatched watched) : target(watched)
+ && execution(void IWatched+.set*(*)); // advice uses args[0]
+
+ /**
+ * Skip setter if arg is same as current value;
+ * otherwise, set dirty flag after proceeding with setter.
+ * Skip this advice if we tried it but failed because
+ * there wasn't a corresponding setter, we didn't
+ * have the right security permissions, etc.
+ */
+ void around(IWatched watched) : setters(watched)
+ && if(watched.dirtyValid) {
+ // get value by invoking getter method
+ Object value = NONE;
+ try {
+ String getterName = "g" +
+ thisJoinPoint.getSignature().getName().substring(1);
+ Method method = watched.getClass()
+ .getMethod(getterName, GETTER_ARG_TYPES);
+ value = method.invoke(watched, GETTER_ARGS);
+ } catch (Throwable t) {
+ // NoSuchMethodException, SecurityException,
+ // InvocationTargetException...
+ }
+ if (NONE == value) {
+ watched.dirtyValid = false;
+ proceed(watched);
+ return;
+ }
+
+ // compare value with arg being set - pointcut has exactly 1 parm
+ Object arg = thisJoinPoint.getArgs()[0];
+ if (!(null == arg ? value == null : arg.equals(value))) {
+ proceed(watched);
+ watched.dirty = true;
+ }
+ }
+}
+
+// ----------- sample clients of WatchSetter
+// classes may opt in - can also use aspects to declare.
+class Timer implements WatchSetters.IWatched {
+ private static int ID;
+ public final int id = ++ID;
+ private int counter;
+ public int getCounter() {
+ return counter;
+ }
+ public void setCounter(int i) {
+ counter = i;
+ }
+ public void write() {
+ System.out.println("writing " + this);
+ }
+ public String toString() {
+ return "Timer " + id + "==" + counter;
+ }
+}
+
+// clients can use dirty flag directly
+class Client {
+ static void handleTimer(Timer timer) {
+ timer.setCounter(0); // should result in no write
+ if (!timer.isDirtyValid() || timer.isDirty()) {
+ timer.write();
+ }
+ timer.setCounter(2);
+ if (!timer.isDirtyValid() || timer.isDirty()) {
+ timer.write();
+ }
+ }
+}
+
+// ---- aspects use dirty to implement cache, etc.
+// Volatile things are flushed when dirty
+abstract aspect Volatile {
+ // subaspects declare targets using Volatile.ITag
+ protected interface ITag {}
+ declare precedence : Volatile+, WatchSetters;
+ after(WatchSetters.IWatched watched) returning :
+ WatchSetters.setters(watched) {
+ if (!watched.isDirtyValid() || watched.isDirty()) {
+ flushCache(watched);
+ }
+ }
+ abstract void flushCache(Object o);
+}
+
+// treat Timer as volatile, write when flushing
+aspect VolatileTimer extends Volatile {
+ declare parents: Timer implements ITag;
+ void flushCache(Object o) {
+ Timer timer = (Timer) o;
+ timer.write();
+ }
+}
+
+//END-SAMPLE caching-dirty-reflectiveSetters
+
+aspect Testing {
+
+ void signal(String s) {
+ org.aspectj.testing.Tester.event(s);
+ }
+
+ static {
+ org.aspectj.testing.Tester.expectEvent("client-write");
+ org.aspectj.testing.Tester.expectEvent("volatile-write");
+ }
+
+ before() : withincode(void VolatileTimer.flushCache(Object))
+ && call(void Timer.write()) {
+ signal("volatile-write");
+ }
+
+ before() : withincode(void Client.handleTimer(Timer))
+ && call(void Timer.write()) {
+ signal("client-write");
+ }
+
+ after() returning : execution(void WatchSetters.main(String[])) {
+ org.aspectj.testing.Tester.checkAllEvents();
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/common/com/company/app/AppException.java b/docs/modules/ROOT/pages/sandbox/common/com/company/app/AppException.java
new file mode 100644
index 000000000..aa23eeff8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/com/company/app/AppException.java
@@ -0,0 +1,11 @@
+
+package com.company.app;
+
+public class AppException extends Exception {
+ public AppException() {
+ super();
+ }
+ public AppException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/com/company/app/Main.java b/docs/modules/ROOT/pages/sandbox/common/com/company/app/Main.java
new file mode 100644
index 000000000..8d04c0ec9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/com/company/app/Main.java
@@ -0,0 +1,40 @@
+
+package com.company.app;
+
+import java.util.Arrays;
+import org.aspectj.lang.SoftException;
+
+public class Main implements Runnable {
+ public static void main(String[] argList) {
+ new Main().runMain(argList);
+ }
+
+ String[] input;
+
+ void spawn() {
+ new Thread(this, toString()).start(); // KEEP CE 15 declares-factory
+ }
+
+ public void runMain(String[] argList) {
+ this.input = argList;
+ run();
+ }
+
+ public void run() {
+ String[] input = this.input;
+ String s = ((null == input) || (0 == input.length))
+ ? "[]"
+ : Arrays.asList(input).toString();
+ System.out.println("input: " + s);
+ try {
+ doDangerousThings(); // KEEP CW 30 declares-exceptionSpelunking
+ } catch (AppException e) { // KEEP CW 31 declares-exceptionSpelunking
+ e.printStackTrace(System.err);
+ }
+ }
+
+ private void doDangerousThings() throws AppException { // KEEP CW 38
+
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/com/company/lib/Factory.java b/docs/modules/ROOT/pages/sandbox/common/com/company/lib/Factory.java
new file mode 100644
index 000000000..3abb207c9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/com/company/lib/Factory.java
@@ -0,0 +1,14 @@
+
+package com.company.lib;
+
+public class Factory {
+
+ public static Thread makeThread(Runnable runnable, String name) {
+ class MyThread extends Thread {
+ MyThread(Runnable runnable, String name) {
+ super(runnable, name);
+ }
+ }
+ return new MyThread(runnable, name);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/company.lst b/docs/modules/ROOT/pages/sandbox/common/company.lst
new file mode 100644
index 000000000..64c4786f7
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/company.lst
@@ -0,0 +1,2 @@
+com/company/app/*.java
+com/company/lib/*.java
diff --git a/docs/modules/ROOT/pages/sandbox/common/declares/Declares.java b/docs/modules/ROOT/pages/sandbox/common/declares/Declares.java
new file mode 100644
index 000000000..2233cd472
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/declares/Declares.java
@@ -0,0 +1,142 @@
+
+package declares;
+
+import com.company.app.*;
+import java.rmi.RemoteException;
+import java.io.IOException;
+
+/**
+ * @author Wes Isberg
+ */
+aspect A {
+
+ // START-SAMPLE declares-threadFactoryRequired Error when not using Thread factory
+ /** signal error if Thread constructor called outside our Thread factory */
+ declare error : call(Thread+.new(..)) && within(com.company..*)
+ && !withincode(Thread com.company.lib.Factory.makeThread(..)) :
+ "constructing threads prohibited - use Factory.makeThread(..)";
+ // END-SAMPLE declares-threadFactoryRequired
+
+}
+
+// XXX platform invariants: J2ME, J2EE, AWT thread, ...
+
+/* @author Wes Isberg */
+
+aspect TypeConstraints {
+
+// START-SAMPLE declares-typeConstraints Using declare to enforce type constraints
+protected interface SoughtException {}
+// XXX ajc broken here?
+/**
+ * Require that any SoughtException implementation be
+ * a subclass of Throwable. This picks out the mistake
+ * of declaring SoughtException a parent of something
+ * that is not an exception at all.
+ */
+declare error : staticinitialization(SoughtException+)
+ && ! staticinitialization(SoughtException)
+ && ! staticinitialization(Throwable+) :
+ "all SoughtException must be subclasses of Throwable";
+// END-SAMPLE declares-typeConstraints
+}
+
+// START-SAMPLE declares-exceptionSpelunking Using declare warning to find Exception-related code
+
+/**
+ * List AppException catch blocks and callers as a way
+ * of investigating a possibly-large code base.
+ */
+aspect SeekAppExceptions {
+ pointcut withinScope() : within(com.company..*);
+
+ /**
+ * Find calls to stuff that throws AppException.
+ */
+ declare warning : withinScope() &&
+ (call(* *(..) throws AppException+)
+ || call(new(..) throws AppException+)) :
+ "fyi, another call to something that can throw IOException";
+
+ /**
+ * Find catch clauses handling AppException
+ */
+ declare warning : withinScope() && handler(AppException+):
+ "fyi, code that handles AppException";
+}
+// END-SAMPLE declares-exceptionSpelunking
+
+
+/** @author Jim Hugunin, Wes Isberg */
+
+class RuntimeRemoteException extends RuntimeException {
+ RuntimeRemoteException(RemoteException e) {}
+}
+
+// XXX untested sample declares-softenRemoteException
+
+// START-SAMPLE declares-softenRemoteException
+
+/**
+ * Convert RemoteExceptions to RuntimeRemoteException
+ * and log them. Enable clients that don't handle
+ * RemoteException.
+ */
+aspect HandleRemoteException {
+ /**
+ * Declare RemoteException soft to enable use by clients
+ * that are not declared to handle RemoteException.
+ */
+ declare soft: RemoteException: throwsRemoteException();
+
+ /**
+ * Pick out join points to convert RemoteException to
+ * RuntimeRemoteException.
+ * This implementation picks out
+ * execution of any method declared to throw RemoteException
+ * in our library.
+ */
+ pointcut throwsRemoteException(): within(com.company.lib..*)
+ && execution(* *(..) throws RemoteException+);
+
+ /**
+ * This around advice converts RemoteException to
+ * RuntimeRemoteException at all join points picked out
+ * by <code>throwsRemoteException()</code>.
+ * That means *no* RemoteException will be thrown from
+ * this join point, and thus that none will be converted
+ * by the AspectJ runtime to <code>SoftException</code>.
+ */
+ Object around(): throwsRemoteException() {
+ try {
+ return proceed();
+ } catch (RemoteException re) {
+ re.printStackTrace(System.err);
+ throw new RuntimeRemoteException(re);
+ }
+ }
+}
+//END-SAMPLE declares-softenRemoteException
+
+/*
+ XXX another declare-soft example from Jim:
+
+aspect A {
+
+pointcut check():
+ within(com.foo.framework.persistence.*) &&
+ executions(* *(..));
+
+declare soft: SQLException: check();
+
+after () throwing (SQLException sqlex): check() {
+ if (sql.getSQLCode().equals("SZ001")) {
+ throw new AppRuntimeException("Non-fatal Database error occurred.",
+ "cache refresh failure", sqlex);
+ } else {
+ throw new AppFatalRuntimeException(
+ "Database error occurred - contact support", sqlex);
+ }
+}
+}
+*/
diff --git a/docs/modules/ROOT/pages/sandbox/common/language/Context.java b/docs/modules/ROOT/pages/sandbox/common/language/Context.java
new file mode 100644
index 000000000..f0021a28a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/language/Context.java
@@ -0,0 +1,70 @@
+
+package language;
+
+public class Context {
+ public static void main(String[] argList) {
+ new C().run();
+ }
+}
+
+class C {
+ static int MAX = 2;
+ int i;
+ C() {
+ i = 1;
+ }
+ public void run() {
+ try {
+ more();
+ } catch (MoreError e) {
+ // log but continue
+ System.out.println(e.getMessage());
+ }
+ }
+
+ private void more() {
+ i++;
+ if (i >= MAX) {
+ i = 0;
+ throw new MoreError();
+ }
+ }
+ static class MoreError extends Error {
+ MoreError() {
+ super("was too much!");
+ }
+ }
+}
+
+/** @author Erik Hilsdale, Wes Isberg */
+aspect A {
+
+ // START-SAMPLE language-fieldSetContext Check input and result for a field set.
+ /**
+ * Check input and result for a field set.
+ */
+ void around(int input, C targ) : set(int C.i)
+ && args(input) && target(targ) {
+ String m = "setting C.i=" + targ.i + " to " + input;
+ System.out.println(m);
+ proceed(input, targ);
+ if (targ.i != input) {
+ throw new Error("expected " + input);
+ }
+ }
+ // END-SAMPLE language-fieldSetContext
+
+ // START-SAMPLE language-handlerContext Log exception being handled
+ /**
+ * Log exception being handled
+ */
+ before (C.MoreError e) : handler(C.MoreError)
+ && args(e) && within(C) {
+ System.out.println("handling " + e);
+ }
+ // END-SAMPLE language-handlerContext
+
+ // See Initialization.java for constructor call,
+ // constructor execution, and {pre}-initialization
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/language/ControlFlow.java b/docs/modules/ROOT/pages/sandbox/common/language/ControlFlow.java
new file mode 100644
index 000000000..d832259db
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/language/ControlFlow.java
@@ -0,0 +1,43 @@
+
+package language;
+
+public class ControlFlow {
+ public static void main(String[] argList) {
+ Fact.factorial(6);
+ }
+}
+
+class Fact {
+ static int factorial(int i) {
+ if (i < 0) {
+ throw new IllegalArgumentException("negative: " + i);
+ }
+ if (i > 100) {
+ throw new IllegalArgumentException("big: " + i);
+ }
+ return (i == 0 ? 1 : i * factorial(i-1));
+ }
+}
+
+/**
+ * Demonstrate recursive calls.
+ * @author Erik Hilsdale
+ */
+aspect LogFactorial {
+ // START-SAMPLE language-cflowRecursionBasic Pick out latest and original recursive call
+ /** call to factorial, with argument */
+ pointcut f(int i) : call(int Fact.factorial(int)) && args(i);
+
+ /** print most-recent recursive call */
+ before(int i, final int j) : f(i) && cflowbelow(f(j)) {
+ System.err.println(i + "-" + j);
+ }
+
+ /** print initial/topmost recursive call */
+ before(int i, final int j) : f(i)
+ && cflowbelow(cflow(f(j)) && !cflowbelow(f(int))) {
+ System.err.println(i + "@" + j);
+ }
+ // END-SAMPLE language-cflowRecursionBasic
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/common/language/DoubleDispatch.java b/docs/modules/ROOT/pages/sandbox/common/language/DoubleDispatch.java
new file mode 100644
index 000000000..2d5a23f0a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/language/DoubleDispatch.java
@@ -0,0 +1,81 @@
+
+
+package language;
+
+import org.aspectj.testing.Tester;
+
+/** @author Wes Isberg */
+public class DoubleDispatch {
+
+ public static void main(String[] a) {
+ Worker worker = new Worker();
+ worker.run((SuperType) new SubTypeOne());
+ worker.run((SuperType) new SubTypeTwo());
+ worker.run(new SuperType());
+ Tester.checkAllEvents();
+ }
+ static aspect A {
+ static int counter;
+ static {
+ Tester.expectEvent("language.SubTypeOne-1");
+ Tester.expectEvent("language.SubTypeTwo-2");
+ Tester.expectEvent("language.SuperType-3");
+ }
+ before(Object o) : execution(void Worker.run(..)) && args(o) {
+ Tester.event(o.getClass().getName() + "-" + ++counter);
+ }
+ }
+}
+
+// START-SAMPLE language-doubleDispatch Implementing double-dispatch
+
+/**
+ * By hypothesis, there is a working class with
+ * methods taking a supertype and subtypes.
+ * The goal of double-dispatch is to execute the
+ * subtype method rather than the supertype
+ * method selected when the compile-time
+ * reference is of the super's type.
+ */
+class Worker {
+ void run(SuperType t) {}
+ void run(SubTypeOne t) {}
+ void run(SubTypeTwo t) {}
+}
+
+class SuperType {}
+class SubTypeOne extends SuperType {}
+class SubTypeTwo extends SuperType {}
+
+/** Implement double-dispatch for Worker.run(..) */
+aspect DoubleDispatchWorker {
+
+ /**
+ * Replace a call to the Worker.run(SuperType)
+ * by delegating to a target method.
+ * Each target subtype in this method dispatches back
+ * to the subtype-specific Worker.run(SubType..) method,
+ * to implement double-dispatch.
+ */
+ void around (Worker worker, SuperType targ):
+ !withincode(void SuperType.doWorkerRun(Worker)) &&
+ target (worker) && call (void run(SuperType)) &&
+ args (targ) {
+ targ.doWorkerRun(worker);
+ }
+
+ void SuperType.doWorkerRun(Worker worker) {
+ worker.run(this);
+ }
+
+ // these could be in separate aspects
+ void SubTypeOne.doWorkerRun(Worker worker) {
+ worker.run(this);
+ }
+ void SubTypeTwo.doWorkerRun(Worker worker) {
+ worker.run(this);
+ }
+}
+
+// END-SAMPLE language-doubleDispatch
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/language/Initialization.java b/docs/modules/ROOT/pages/sandbox/common/language/Initialization.java
new file mode 100644
index 000000000..a5da0aeae
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/language/Initialization.java
@@ -0,0 +1,133 @@
+
+package language;
+
+public class Initialization {
+ public static void main(String[] argList) {
+ String[] expected = new String[]
+ { "none after-String-constructor-execution after-initialization after-any-constructor-call",
+ "hello after-String-constructor-execution after-initialization after-any-constructor-call",
+ "none after-String-constructor-execution after-initialization",
+ "hi from-AnotherThing after-String-constructor-execution after-initialization"
+ };
+ String[] actual = new String[4];
+ Thing thing = new Thing();
+ actual[0] = new Thing().message;
+ actual[1] = new Thing("hello").message;
+ actual[2] = new AnotherThing().message;
+ actual[3] = new AnotherThing("hi").message;
+
+ StringBuffer errs = new StringBuffer();
+ for (int i = 0; i < actual.length; i++) {
+ if (!expected[i].equals(actual[i])) {
+ errs.append("expected ");
+ errs.append(expected[i]);
+ errs.append(" but got ");
+ errs.append(actual[i]);
+ errs.append("\n");
+ }
+ }
+ if (0 < errs.length()) {
+ throw new Error(errs.toString());
+ }
+ }
+}
+/** @author Erik Hilsdale, Wes Isberg */
+
+// START-SAMPLE language-initialization Understanding object creation join points
+/*
+ * To work with an object right when it is constructed,
+ * understand the differences between the join points for
+ * constructor call, constructor execution, and initialization.
+ */
+ // ------- examples of constructors and the ways they invoke each other.
+class Thing {
+ String message;
+ Thing() {
+ this("none");
+ }
+ Thing(String message) {
+ this.message = message;
+ }
+}
+
+class AnotherThing extends Thing {
+ AnotherThing() {
+ super(); // this does not append to message as the one below does.
+ }
+
+ AnotherThing(String message) {
+ super(message + " from-AnotherThing");
+ }
+}
+
+aspect InitializationSample {
+ // -------- constructor-call picks out the calls
+ /**
+ * After any call to any constructor, fix up the thing.
+ * When creating an object, there is only one call to
+ * construct it, so use call(..) avoid duplicate advice.
+ * There is no target for the call, but the object
+ * constructed is returned from the call.
+ * In AspectJ 1.1, this only picks out callers in the input
+ * classes or source files, and it does not pick out
+ * invocations via <code>super(..)</code>
+ * or <code>this(..)</code>.
+ */
+ after() returning (Thing thing):
+ call(Thing.new(..)) {
+ thing.message += " after-any-constructor-call";
+ }
+
+ // -------- constructor-execution picks out each body
+ /**
+ * After executing the String constructor, fix up the thing.
+ * The object being-constructed is available as either
+ * <code>this</code> or <code>target</code>.
+ * This works even if the constructor was invoked using
+ * <code>super()</code> or <code>this()</code> or by code
+ * outside the control of the AspectJ compiler.
+ * However, if you advise multiple constructors, you'll advise
+ * a single instance being constructed multiple times
+ * if the constructors call each other.
+ * In AspectJ 1.1, this only affects constructors in the input
+ * classes or source files.
+ */
+ after(Thing thing) returning : target(thing) &&
+ execution(Thing.new(String)) {
+ thing.message += " after-String-constructor-execution";
+ }
+
+ /**
+ * DANGER -- BAD!! Before executing the String constructor,
+ * this uses the target object, which is not constructed.
+ */
+ before (Thing thing): this(thing) && execution(Thing.new(String)) {
+ // DANGER!! thing not constructed yet.
+ //thing.message += " before-String-constructor-execution";
+ }
+
+ // -------- initialization picks out any construction, once
+ /**
+ * This advises all Thing constructors in one join point,
+ * even if they call each other with <code>this()</code>, etc.
+ * The object being-constructed is available as either
+ * <code>this</code> or <code>target</code>.
+ * In AspectJ 1.1, this only affects types input to the compiler.
+ */
+ after(Thing thing) returning: this(thing)
+ && initialization(Thing.new(..)) {
+ thing.message += " after-initialization";
+ }
+}
+//END-SAMPLE language-initialization
+
+aspect B {
+ static boolean log = false;
+ before() : withincode(void Initialization.main(String[]))
+ && call(Thing.new(..)) && if(log) {
+ System.out.println("before: " + thisJoinPointStaticPart.getSourceLocation().getLine());
+ }
+ before() : within(A) && adviceexecution() && if(log) {
+ System.out.println("advice: " + thisJoinPointStaticPart.getSourceLocation().getLine());
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/common/libraries/PointcutLibraryTest.java b/docs/modules/ROOT/pages/sandbox/common/libraries/PointcutLibraryTest.java
new file mode 100644
index 000000000..e110c7ced
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/libraries/PointcutLibraryTest.java
@@ -0,0 +1,95 @@
+package libraries;
+
+/** @author Wes Isberg */
+public class PointcutLibraryTest {
+ public static void main(String[] a) {
+ new Test().run();
+ }
+}
+
+class Test {
+ public Test() {}
+ public void run(){ prun(); }
+ private void prun() {
+ System.out.println("Test.prun()");
+ }
+}
+
+// START-SAMPLE library-classPointcutLibrary Defining library pointcuts in a class
+/** private default implementation of library */
+class PrivatePointcutLibrary {
+ pointcut adviceCflow() : cflow(adviceexecution());
+ pointcut publicCalls() : call(public * *(..))
+ && !adviceCflow()
+ ;
+}
+
+/** public interface for library */
+class PointcutLibrary extends PrivatePointcutLibrary {
+}
+
+// ---- different clients of the library
+
+/** client by external reference to library */
+aspect ExternalClientOfLibrary {
+ before() : PointcutLibrary.publicCalls() {
+ System.out.println("XCL: "
+ + thisJoinPointStaticPart);
+ }
+}
+
+/** use library by inheriting scope in aspect */
+aspect AEL extends PointcutLibrary {
+ before() : publicCalls() {
+ System.out.println("AEL: "
+ + thisJoinPointStaticPart);
+ }
+}
+
+/** use library by inheriting scope in class */
+class CEL extends PointcutLibrary {
+ static aspect A {
+ before() : publicCalls() {
+ System.out.println("CEL: "
+ + thisJoinPointStaticPart);
+ }
+ }
+}
+
+/** more clients by inheritance */
+aspect CELSubAspect extends CEL {
+ before() : publicCalls() {
+ System.out.println("CSA: "
+ + thisJoinPointStaticPart);
+ }
+}
+
+
+// ---- redefining library pointcuts
+
+//-- affect all clients of PointcutLibrary
+// test: XCL advises Test()
+class VendorPointcutLibrary extends PrivatePointcutLibrary {
+ /** add calls to public constructors */
+ pointcut publicCalls() : PrivatePointcutLibrary.publicCalls()
+ || (call(public new(..)) && !adviceCflow());
+ static aspect A {
+ declare parents:
+ PointcutLibrary extends VendorPointcutLibrary;
+ }
+}
+
+//-- only affect CEL, subtypes, & references thereto
+// test: CSA does not advise call(* println(String))
+// test: CSA advises call(* prun())
+class CPlus extends PointcutLibrary {
+ /** add calls to private methods, remove calls to java..* */
+ pointcut publicCalls() : (PointcutLibrary.publicCalls()
+ || (call(private * *(..)) && !adviceCflow()))
+ && (!(call(* java..*.*(..)) || call(java..*.new(..))));
+ static aspect A {
+ declare parents: CEL extends CPlus;
+ }
+}
+// END-SAMPLE library-classPointcutLibrary
+
diff --git a/docs/modules/ROOT/pages/sandbox/common/org/aspectj/langlib/Pointcuts.java b/docs/modules/ROOT/pages/sandbox/common/org/aspectj/langlib/Pointcuts.java
new file mode 100644
index 000000000..89faecc95
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/org/aspectj/langlib/Pointcuts.java
@@ -0,0 +1,195 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
+ * ******************************************************************/
+
+// START-SAMPLE library-pointcutIdioms Standard pointcut idioms
+package org.aspectj.langlib;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Library of pointcut idioms to use in combination with
+ * other pointcuts.
+ *
+ * @author Wes Isberg
+ */
+public final class Pointcuts {
+
+ // ------- not staticly-determinable
+ public pointcut adviceCflow() : cflow(adviceexecution());
+
+ public pointcut notInAdviceCflow() : !adviceCflow();
+
+ public pointcut cflowMainExecution() :
+ cflow(mainExecution());
+
+ // ------- staticly-determinable
+
+ public pointcut mainExecution() :
+ execution(public static void main(String[]));
+
+ /** staticly-determinable to never match any join point */
+ public pointcut never();
+ // if(false) && execution(ThreadDeath *(ThreadDeath, ThreadDeath));
+
+ public pointcut afterAdviceSupported() : !handler(*);
+
+ public pointcut aroundAdviceSupported() : !handler(*)
+ && !initialization(new(..)) && !preinitialization(new(..));
+
+ public pointcut anyMethodExecution() :
+ execution(* *(..));
+
+ public pointcut anyPublicMethodExecution() :
+ execution(public * *(..));
+
+ public pointcut anyNonPrivateMethodExecution() :
+ execution(!private * *(..));
+
+ public pointcut anyConstructorExecution() :
+ execution(new(..));
+
+ public pointcut anyPublicConstructorExecution() :
+ execution(public new(..));
+
+ public pointcut anyNonPrivateConstructorExecution() :
+ execution(!private new(..));
+
+ public pointcut anyPublicFieldGet() :
+ get(public * *);
+
+ public pointcut anyNonPrivateFieldGet() :
+ get(!private * *);
+
+ public pointcut anyPublicFieldSet() :
+ set(public * *);
+
+ public pointcut anyNonPrivateFieldSet() :
+ set(!private * *); // also !transient?
+
+ public pointcut withinSetter() : // require !static?
+ withincode(void set*(*)); // use any return type? multiple parms?
+
+ public pointcut withinGetter() :
+ withincode(!void get*()); // permit parms? require !static?
+
+ public pointcut anyNonPublicFieldSetOutsideConstructorOrSetter() :
+ set(!public * *) && !withincode(new(..))
+ && !withinSetter();
+
+ public pointcut anyRunnableImplementation() :
+ staticinitialization(Runnable+);
+
+ public pointcut anyGetSystemErrOut() :
+ get(PrintStream System.err) || get(PrintStream System.out);
+
+ public pointcut anySetSystemErrOut() :
+ call(void System.setOut(..)) || call(void System.setErr(..));
+
+ public pointcut withinAnyJavaCode() :
+ within(java..*) || within(javax..*);
+
+ public pointcut notWithinJavaCode() :
+ !withinAnyJavaCode();
+
+ public pointcut toStringExecution() :
+ execution(String toString()) && !within(String);
+
+ /** call or execution of any Thread constructor, including subclasses */
+ public pointcut anyThreadConstruction() :
+ call(Thread+.new(..)) || execution(Thread+.new(..));
+
+ /**
+ * Any calls to java.io classes
+ * (but not methods declared only on their subclasses).
+ */
+ public pointcut anyJavaIOCalls() :
+ call(* java.io..*.*(..)) || call(java.io..*.new(..));
+
+ /**
+ * Any calls to java.awt or javax.swing methods or constructors
+ * (but not methods declared only on their subclasses).
+ */
+ public pointcut anyJavaAWTOrSwingCalls() :
+ call(* java.awt..*.*(..)) || call(java.awt..*.new(..))
+ || call(* javax.swing..*.*(..)) || call(javax.swing..*.new(..));
+
+ public pointcut cloneImplementationsInNonCloneable() :
+ execution(Object !Cloneable+.clone());
+
+ public pointcut runImplementationsInNonRunnable() :
+ execution(void !Runnable+.run());
+
+ /** any calls to java.lang.reflect or Class.get* (except getName()) */
+ public pointcut anySystemReflectiveCalls() :
+ call(* java.lang.reflect..*.*(..))
+ || (!call(* Class.getName())
+ && call(* Class.get*(..)));
+
+ /** standard class-loading calls by Class and ClassLoader
+ * Note that `Foo.class` in bytecode is `Class.forName("Foo")`,
+ * so 'Foo.class' will also be picked out by this pointcut.
+ */
+ public pointcut anySystemClassLoadingCalls() :
+ call(Class Class.forName(..))
+ || call(Class ClassLoader.loadClass(..));
+
+ public pointcut anySystemProcessSpawningCalls() :
+ call(Process Runtime.exec(..))
+ || call(Class ClassLoader.loadClass(..));
+
+ /** Write methods on Collection
+ * Warning: Does not pick out <code>iterator()</code>, even though
+ * an Iterator can remove elements.
+ */
+ public pointcut anyCollectionWriteCalls() :
+ call(boolean Collection+.add(Object))
+ || call(boolean Collection+.addAll(Collection))
+ || call(void Collection+.clear())
+ || call(boolean Collection+.remove(Object))
+ || call(boolean Collection+.removeAll(Collection))
+ || call(boolean Collection+.retainAll(Collection));
+
+ public pointcut mostThrowableReadCalls() :
+ call(* Throwable+.get*(..))
+ || call(* Throwable+.print*(..))
+ || call(String Throwable+.toString(..));
+
+ public pointcut exceptionWrappingCalls() :
+ (args(Throwable+,..) || args(.., Throwable+))
+ && (set(Throwable+ Throwable+.*)
+ || (call(* Throwable+.*(..))
+ || call(Throwable+.new(..))));
+
+ public pointcut anyCodeThrowingException() :
+ execution(* *(..) throws Exception+)
+ || execution(new(..) throws Exception+);
+
+ private Pointcuts() {} // XXX avoid this? else pointcuts match it...
+}
+//END-SAMPLE library-pointcutIdioms
+
+//aspect A {
+// private static aspect PointcutsOnly {
+// /** require this library to only contain pointcuts */
+// declare error : within(Pointcuts) &&
+// (Pointcuts.anyMethodExecution() || Pointcuts.anyConstructorExecution()
+// || set(* *)) : "only pointcuts permitted in Pointcuts";
+// }
+//}
+//
+//class PointcutQuestions {
+// public pointcut anyCodeThrowingException() : // XXX broken?
+// execution(* *(..) throws Exception+)
+// || execution(new(..) throws Exception+);
+//
+//}
diff --git a/docs/modules/ROOT/pages/sandbox/common/tracing/Logging.java b/docs/modules/ROOT/pages/sandbox/common/tracing/Logging.java
new file mode 100644
index 000000000..349abb235
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/tracing/Logging.java
@@ -0,0 +1,28 @@
+
+package tracing;
+
+import org.aspectj.lang.Signature;
+
+/**
+ * @author Wes Isberg
+ */
+aspect A {
+ // START-SAMPLE tracing-simpleTiming Record time to execute public methods
+ /** record time to execute my public methods */
+ Object around() : execution(public * com.company..*.* (..)) {
+ long start = System.currentTimeMillis();
+ try {
+ return proceed();
+ } finally {
+ long end = System.currentTimeMillis();
+ recordTime(start, end,
+ thisJoinPointStaticPart.getSignature());
+ }
+ }
+ // implement recordTime...
+ // END-SAMPLE tracing-simpleTiming
+
+ void recordTime(long start, long end, Signature sig) {
+ // to implement...
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPoints.java b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPoints.java
new file mode 100644
index 000000000..fd42a0fde
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPoints.java
@@ -0,0 +1,132 @@
+
+// START-SAMPLE tracing-traceJoinPoints Trace join points executed to log
+/* TraceJoinPoints.java */
+
+package tracing;
+
+import org.aspectj.lang.*;
+import org.aspectj.lang.reflect.*;
+import java.io.*;
+
+/**
+ * Print join points being executed in context to a log.xml file.
+ * To use this, define the abstract pointcuts in a subaspect.
+ * @author Jim Hugunin, Wes Isberg
+ */
+public abstract aspect TraceJoinPoints
+ extends TraceJoinPointsBase {
+
+ // abstract protected pointcut entry();
+
+ PrintStream out;
+ int logs = 0;
+ int depth = 0;
+ boolean terminal = false;
+
+ /**
+ * Emit a message in the log, e.g.,
+ * <pre>TraceJoinPoints tjp = TraceJoinPoints.aspectOf();
+ * if (null != tjp) tjp.message("Hello, World!");</pre>
+ */
+ public void message(String s) {
+ out.println("<message>" + prepareMessage(s) + "</message>");
+ }
+
+ protected void startLog() {
+ makeLogStream();
+ }
+
+ protected void completeLog() {
+ closeLogStream();
+ }
+
+ protected void logEnter(JoinPoint.StaticPart jp) {
+ if (terminal) out.println(">");
+ indent(depth);
+ out.print("<" + jp.getKind());
+ writeSig(jp);
+ writePos(jp);
+
+ depth += 1;
+ terminal = true;
+ }
+
+ protected void logExit(JoinPoint.StaticPart jp) {
+ depth -= 1;
+ if (terminal) {
+ getOut().println("/>");
+ } else {
+ indent(depth);
+ getOut().println("</" + jp.getKind() + ">");
+ }
+ terminal = false;
+ }
+
+ protected PrintStream getOut() {
+ if (null == out) {
+ String m = "not in the control flow of entry()";
+ throw new IllegalStateException(m);
+ }
+ return out;
+ }
+
+ protected void makeLogStream() {
+ try {
+ String name = "log" + logs++ + ".xml";
+ out = new PrintStream(new FileOutputStream(name));
+ } catch (IOException ioe) {
+ out = System.err;
+ }
+ }
+
+ protected void closeLogStream() {
+ PrintStream out = this.out;
+ if (null != out) {
+ out.close();
+ // this.out = null;
+ }
+ }
+
+ /** @return input String formatted for XML */
+ protected String prepareMessage(String s) { // XXX unimplemented
+ return s;
+ }
+
+ void message(String sink, String s) {
+ if (null == sink) {
+ message(s);
+ } else {
+ getOut().println("<message sink=" + quoteXml(sink)
+ + " >" + prepareMessage(s) + "</message>");
+ }
+ }
+
+ void writeSig(JoinPoint.StaticPart jp) {
+ PrintStream out = getOut();
+ out.print(" sig=");
+ out.print(quoteXml(jp.getSignature().toShortString()));
+ }
+
+ void writePos(JoinPoint.StaticPart jp) {
+ SourceLocation loc = jp.getSourceLocation();
+ if (loc == null) return;
+ PrintStream out = getOut();
+
+ out.print(" pos=");
+ out.print(quoteXml(loc.getFileName() +
+ ":" + loc.getLine() +
+ ":" + loc.getColumn()));
+ }
+
+ protected String quoteXml(String s) { // XXX weak
+ return "\"" + s.replace('<', '_').replace('>', '_') + "\"";
+ }
+
+ protected void indent(int i) {
+ PrintStream out = getOut();
+ while (i-- > 0) out.print(" ");
+ }
+}
+// END-SAMPLE tracing-traceJoinPoints
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPointsBase.java b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPointsBase.java
new file mode 100644
index 000000000..d06423001
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceJoinPointsBase.java
@@ -0,0 +1,53 @@
+
+// START-SAMPLE tracing-traceJoinPoints Trace join points executed
+/* TraceJoinPointsBase.java */
+
+package tracing;
+
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Trace join points being executed in context.
+ * To use this, define the abstract members in a subaspect.
+ * <b>Warning</b>: this does not trace join points that do not
+ * support after advice.
+ * @author Jim Hugunin, Wes Isberg
+ */
+abstract aspect TraceJoinPointsBase {
+ // this line is for AspectJ 1.1
+ // for Aspectj 1.0, use "TraceJoinPointsBase dominates * {"
+ declare precedence : TraceJoinPointsBase, *;
+
+ abstract protected pointcut entry();
+
+ protected pointcut exit(): call(* java..*.*(..));
+
+ final pointcut start(): entry() && !cflowbelow(entry());
+
+ final pointcut trace(): cflow(entry())
+ && !cflowbelow(exit()) && !within(TraceJoinPointsBase+);
+
+ private pointcut supportsAfterAdvice() : !handler(*)
+ && !preinitialization(new(..));
+
+ before(): start() { startLog(); }
+
+ before(): trace() && supportsAfterAdvice(){
+ logEnter(thisJoinPointStaticPart);
+ }
+
+ after(): trace() && supportsAfterAdvice() {
+ logExit(thisJoinPointStaticPart);
+ }
+
+ after(): start() { completeLog(); }
+
+ abstract protected void logEnter(JoinPoint.StaticPart jp);
+ abstract protected void logExit(JoinPoint.StaticPart jp);
+ abstract protected void startLog();
+ abstract protected void completeLog();
+}
+
+// END-SAMPLE tracing-traceJoinPoints
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/common/tracing/TraceMyJoinPoints.java b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceMyJoinPoints.java
new file mode 100644
index 000000000..a5aa686d6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/common/tracing/TraceMyJoinPoints.java
@@ -0,0 +1,17 @@
+
+
+// START-SAMPLE tracing-traceJoinPoints Trace to log join points executed by main method
+/* TraceMyJoinPoints.java */
+
+package tracing;
+
+import com.company.app.Main;
+
+/**
+ * Trace all join points in company application.
+ * @author Jim Hugunin, Wes Isberg
+ */
+aspect TraceMyJoinPoints extends TraceJoinPoints {
+ protected pointcut entry() : execution(void Main.runMain(String[]));
+}
+// END-SAMPLE tracing-traceJoinPoints
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/buildRun.sh b/docs/modules/ROOT/pages/sandbox/inoculated/buildRun.sh
new file mode 100644
index 000000000..26dce3f59
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/buildRun.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+JDKDIR="${JDKDIR:-${JAVA_HOME:-`setjdk.sh`}}"
+AJ_HOME="${AJ_HOME:-`setajhome.sh`}"
+PS="${PS:-;}"
+ajrt=`pathtojava.sh "$AJ_HOME/lib/aspectjrt.jar"`
+mkdir -p ../classes
+
+for i in *.java; do
+ pack=`sed -n '/package/s|.*package *\([^ ][^ ]*\)[ ;].*|\1|p' "$i"`
+ [ -n "$pack" ] && pack="${pack}."
+ rm -rf classes/*
+ cname=$pack`basename $i .java`
+ echo ""
+ echo "########## $cname"
+ $AJ_HOME/bin/ajc -d ../classes -classpath "$ajrt" "$i"
+ && $JDKDIR/bin/java -classpath "../classes${PS}$ajrt" $cname
+done
+
+rm -rf ../classes
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/readme.internal.txt b/docs/modules/ROOT/pages/sandbox/inoculated/readme.internal.txt
new file mode 100644
index 000000000..61d69591a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/readme.internal.txt
@@ -0,0 +1,54 @@
+// XXX do not distribute
+
+------ contents
+05sd.Isberg40-43,76.pdf # not for distribution
+BufferTest.java
+CompileTime.java
+Injection.java
+MainFailure.java
+RecordingInput.java
+RoundTrip.java
+RunTime.java
+RuntimeWrites.java
+StubReplace.java
+buildRun.sh
+readme.internal.txt # not for distribution
+readme.txt
+
+------ summary of todo's
+- consider moving to packages, combining PrinterStream, etc.
+- use DOS linefeeds - check throughout (also line length)
+- see XXX
+ - assess handling of one style mistake
+ - see if second mistake was actually in article - corrected in code
+
+------ fyi
+- standard of care: show language, not problem
+- formatting: lineation, line width, DOS linefeeds, etc.
+- organization:
+ - code currently compiles/runs one at a time
+ and does not compile all at once b/c of
+ common fixtures (PrinterStream...)
+ - currently packages (com.xerox.printing) in base dir
+
+- Copyright/license: examples, ,but PARC Inc.
+- article code unit flagged with "article page #"
+
+------ style fyi
+- flagging style mistake in StubReplace.java:
+
+ // XXX style mistake in article code
+ //pointcut printerStreamTestCalls() : call(* PrinterStream+.write());
+
+- leaving CompileTime.java use of + in call for factory pointcut:
+
+ call(Point+ SubPoint+.create(..))
+
+ - for static methods where the method name specification
+ involves no * but does reflect a factory naming convention
+ (and not polymorphism)
+ (though not restricting factory methods to being static)
+
+ - for referring to the return value when I want to pick out
+ the type and all subtypes
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/readme.txt b/docs/modules/ROOT/pages/sandbox/inoculated/readme.txt
new file mode 100644
index 000000000..90ced047b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/readme.txt
@@ -0,0 +1,36 @@
+
+This contains demonstration source code for the article
+"Get Inoculated!" in the May 2002 issue of Software Development
+magazine.
+
+To use it you will need the AspectJ tools available from
+https://eclipse.org/aspectj. We also recommend you download the
+documentation bundle and support for the IDE of your choice.
+
+Each file has a snippet for a section of the article. To find
+one in particular, see the back-references to "article page #":
+
+ CompileTime.java: // article page 40 - warning
+ CompileTime.java: // article page 41 - error
+ RunTime.java: // article page 41 - runtime NPE
+ RuntimeWrites.java: // article page 42 - field writes
+ RecordingInput.java: // article page 42 - recording input
+ MainFailure.java: // article page 42 - recording failures from main
+ BufferTest.java: // article page 43 - input driver
+ Injection.java: // article page 43 - fault injection
+ StubReplace.java: // article page 76 - stubs
+ RoundTrip.java: // article page 76 - round trip
+
+Compile and run as usual:
+
+ > set AJ_HOME=c:\aspectj1.0
+ > set PATH=%AJ_HOME%\bin;%PATH%
+ > ajc -classpath "$AJ_HOME/lib/aspectjrt.jar" {file}
+ > java -classpath ".;$AJ_HOME/lib/aspectjrt.jar" {class}
+
+For email discussions and support, see https://eclipse.org/aspectj.
+
+
+Enjoy!
+
+the AspectJ team
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/BufferTest.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/BufferTest.java
new file mode 100644
index 000000000..f2cc479e8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/BufferTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+import java.util.*;
+import java.io.*;
+
+import org.aspectj.lang.*;
+
+/** @author Wes Isberg */
+public aspect BufferTest {
+
+ // article page 43 - input driver
+ // START-SAMPLE testing-inoculated-proceedVariants Using around for integration testing
+ /**
+ * When PrinterBuffer.capacity(int) is called,
+ * test it with repeatedly with a set of input
+ * (validating the result) and then continue with
+ * the original call.
+ *
+ * This assumes that the capacity method causes no
+ * relevant state changes in the buffer.
+ */
+ int around(int original, PrinterBuffer buffer) :
+ call(int PrinterBuffer.capacity(int)) && args(original) && target(buffer) {
+ int[] input = new int[] { 0, 1, 10, 1000, -1, 4096 };
+ for (int i = 0; i < input.length; i++) {
+ int result = proceed(input[i], buffer); // invoke test
+ validateResult(buffer, input[i], result);
+ }
+ return proceed(original, buffer); // continue with original processing
+ }
+ // END-SAMPLE testing-inoculated-proceedVariants
+
+ void validateResult(PrinterBuffer buffer, int input, int result) {
+ System.err.println("validating input=" + input + " result=" + result
+ + " buffer=" + buffer);
+ }
+
+ public static void main(String[] args) {
+ PrinterBuffer p = new PrinterBuffer();
+ int i = p.capacity(0);
+ System.err.println("main - result " + i);
+ }
+}
+
+class PrinterBuffer {
+ int capacity(int i) {
+ System.err.println("capacity " + i);
+ return i;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/Injection.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/Injection.java
new file mode 100644
index 000000000..6a857ef7a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/Injection.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+import java.io.*;
+
+/**
+ * Demonstrate technique of fault-injection
+ * as coordinated by test driver.
+ * @author Wes Isberg
+ */
+aspect InjectingIOException {
+
+ // article page 43 - fault injection
+ // START-SAMPLE testing-inoculated-injectIOException Inject IOException on test driver command
+ /** the test starts when the driver starts executing */
+ pointcut testEntryPoint(TestDriver driver) :
+ target(driver) && execution(* TestDriver.startTest());
+
+ /**
+ * The fault may be injected at the execution of any
+ * (non-static) PrinterStream method that throws an IOException
+ */
+ pointcut testCheckPoint(PrinterStream stream) : target(stream)
+ && execution(public * PrinterStream+.*(..) throws IOException);
+
+ /**
+ * After the method returns normally, query the
+ * test driver to see if we should instead throw
+ * an exception ("inject" the fault).
+ */
+ after (TestDriver driver, PrinterStream stream) returning
+ throws IOException :
+ cflowbelow(testEntryPoint(driver))
+ && testCheckPoint(stream) {
+ IOException e = driver.createException(stream);
+ if (null != e) {
+ System.out.println("InjectingIOException - injecting " + e);
+ throw e;
+ }
+ }
+ /* Comment on the after advice IOException declaration:
+
+ "throws IOException" is a declaration of the advice,
+ not the pointcut.
+
+ Since the advice might throw the injected fault, it
+ must declare that it throws IOException. When advice declares
+ exceptions thrown, the compiler will emit an error if any
+ join point is not also declared to throw an IOException.
+
+ In this case, the testCheckPoint pointcut only picks out
+ methods that throw IOException, so the compile will not
+ signal any errors.
+ */
+ // END-SAMPLE testing-inoculated-injectIOException
+}
+
+/** this runs the test case */
+public class Injection {
+ /** Run three print jobs, two as a test and one normally */
+ public static void main(String[] args) throws Exception {
+ Runnable r = new Runnable() {
+ public void run() {
+ try { new TestDriver().startTest(); }
+ catch (IOException e) {
+ System.err.println("got expected injected error " + e.getMessage());
+ }
+ }
+ };
+
+ System.out.println("Injection.main() - starting separate test thread");
+ Thread t = new Thread(r);
+ t.start();
+
+ System.out.println("Injection.main() - running test in this thread");
+ r.run();
+ t.join();
+
+ System.out.println("Injection.main() - running job normally, not by TestDriver");
+ new PrintJob().runPrintJob();
+ }
+}
+
+/** handle starting of test and determining whether to inject failure */
+class TestDriver {
+
+ /** start a new test */
+ public void startTest() throws IOException {
+ new PrintJob().runPrintJob();
+ }
+
+ /** this implementation always injects a failure */
+ public IOException createException(PrinterStream p) {
+ return new IOException(""+p);
+ }
+}
+
+//--------------------------------------- target classes
+
+class PrintJob {
+ /** this job writes to the printer stream */
+ void runPrintJob() throws IOException {
+ new PrinterStream().write();
+ }
+}
+
+class PrinterStream {
+ /** this printer stream writes without exception */
+ public void write() throws IOException {
+ System.err.println("PrinterStream.write() - not throwing exception");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/MainFailure.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/MainFailure.java
new file mode 100644
index 000000000..6d5a62a35
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/MainFailure.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+import java.util.*;
+import java.io.*;
+import org.aspectj.lang.*;
+
+/** @author Wes Isberg */
+
+public aspect MainFailure {
+
+ public static void main (String[] args) { TargetClass.main(args); }
+
+ pointcut main(String[] args) :
+ args(args) && execution(public static void main(String[]));
+
+ // article page 42 - recording failures from main
+ // START-SAMPLE testing-inoculated-failureCapture Log failures
+ /** log after failure, but do not affect exception */
+ after(String[] args) throwing (Throwable t) : main(args) {
+ logFailureCase(args, t, thisJoinPoint);
+ }
+ // END-SAMPLE testing-inoculated-failureCapture
+
+ // alternate to swallow exception
+// /** log after failure and swallow exception */
+// Object around() : main(String[]) {
+// try {
+// return proceed();
+// } catch (Error e) { // ignore
+// logFailureCase(args, t, thisJoinPoint);
+// // can log here instead
+// }
+// return null;
+// }
+
+ public static void logFailureCase(String[] args, Throwable t, Object jp) {
+ System.err.println("failure case: args " + Arrays.asList(args));
+ }
+}
+
+class TargetClass {
+ static Thread thread;
+ /** will throw error if exactly one argument */
+ public static void main (String[] args) {
+ // make sure to do at least one failure
+ if (thread == null) {
+ Runnable r = new Runnable() {
+ public void run() {
+ main(new String[] {"throwError" });
+ }
+ };
+ thread = new Thread(r);
+ thread.start();
+ }
+ if (1 == args.length) {
+ throw new Error("hello");
+ }
+ try { thread.join(); }
+ catch (InterruptedException ie) { }
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/RunTime.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/RunTime.java
new file mode 100644
index 000000000..e3e93e9d0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/RunTime.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+import java.util.*;
+import java.awt.Point;
+
+import org.aspectj.lang.JoinPoint;
+
+public class RunTime {
+ public static void main(String[] a) {
+ AnotherPoint.create();
+ SubPoint.create();
+ }
+}
+
+/** @author Wes Isberg */
+aspect FactoryValidation {
+
+ // START-SAMPLE declares-inoculated-prohibitNonprivateConstructors Error to have accessible sub-Point constructors
+ /** We make it an error for any Point subclasses to have non-private constructors */
+ declare error : execution(!private Point+.new(..))
+ && !within(java*..*) :
+ "non-private Point subclass constructor";
+ // END-SAMPLE declares-inoculated-prohibitNonprivateConstructors
+
+ // article page 41 - runtime NPE
+ // START-SAMPLE testing-inoculated-runtimeErrorWhenNullReturnedFromFactory Throw Error when factory returns null
+ /** Throw Error if a factory method for creating a Point returns null */
+ after () returning (Point p) :
+ call(Point+ SubPoint+.create(..)) {
+ if (null == p) {
+ String err = "Null Point constructed when this ("
+ + thisJoinPoint.getThis()
+ + ") called target ("
+ + thisJoinPoint.getTarget()
+ + ") at join point ("
+ + thisJoinPoint.getSignature()
+ + ") from source location ("
+ + thisJoinPoint.getSourceLocation()
+ + ") with args ("
+ + Arrays.asList(thisJoinPoint.getArgs())
+ + ")";
+ throw new Error(err);
+ }
+ }
+ // END-SAMPLE testing-inoculated-runtimeErrorWhenNullReturnedFromFactory
+}
+
+class SubPoint extends Point {
+ public static SubPoint create() { return null; } // will cause Error
+ private SubPoint(){}
+}
+
+class AnotherPoint extends Point {
+ public static Point create() { return new Point(); }
+
+ // to see that default constructor is picked out by declare error
+ // comment out this constructor
+ private AnotherPoint(){}
+}
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/RuntimeWrites.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/RuntimeWrites.java
new file mode 100644
index 000000000..0f49247cb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/RuntimeWrites.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+import org.aspectj.lang.*;
+
+/** test cases for controlling field writes */
+public class RuntimeWrites {
+
+ public static void main(String[] args) {
+ System.err.println("---- setup: valid write");
+ final SubPrinterStream me = new SubPrinterStream();
+
+ System.err.println("---- setup: invalid write, outside initialization - nonstatic");
+ me.setOne(1);
+
+ System.err.println("---- setup: invalid write, outside initialization - static");
+ me.one = 0;
+
+ System.err.println("---- setup: invalid write, caller is not same as target");
+ PrinterStream other = new PrinterStream(me);
+ }
+}
+
+
+/**
+ * Control field writes.
+ * This implementation restricts writes to the same object during initialization.
+ * This is like having field values be final, except that
+ * they may be set set outside the constructor.
+ * @author Wes Isberg
+ */
+aspect ControlFieldWrites {
+ public static boolean throwError;
+
+ // article page 42 - field writes
+
+ // START-SAMPLE testing-inoculated-permitWritesDuringConstruction Constructor execution
+ /** execution of any constructor for PrinterStream */
+ pointcut init() : execution(PrinterStream+.new(..));
+ // END-SAMPLE testing-inoculated-permitWritesDuringConstruction
+
+ // START-SAMPLE testing-inoculated-prohibitWritesExceptWhenConstructing Prohibit field writes after construction
+ /** any write to a non-static field in PrinterStream itself */
+ pointcut fieldWrites() : set(!static * PrinterStream.*);
+
+
+ /**
+ * Handle any situation where fields are written
+ * outside of the control flow of initialization
+ */
+ before() : fieldWrites() && !cflow(init()) {
+ handle("field set outside of init", thisJoinPointStaticPart);
+ }
+ // END-SAMPLE testing-inoculated-prohibitWritesExceptWhenConstructing
+
+ // START-SAMPLE testing-inoculated-prohibitWritesByOthers Prohibit field writes by other instances
+ /**
+ * Handle any situation where fields are written
+ * by another object.
+ */
+ before(Object caller, PrinterStream targ) : this(caller)
+ && target(targ) && fieldWrites() {
+ if (caller != targ) {
+ String err = "variation 1: caller (" + caller
+ + ") setting fields in targ (" + targ + ")";
+ handle(err, thisJoinPointStaticPart);
+ }
+ }
+ // END-SAMPLE testing-inoculated-prohibitWritesByOthers
+
+ //---- variations to pick out subclasses as well
+ // START-SAMPLE testing-inoculated-prohibitWritesEvenBySubclasses Prohibit writes by subclasses
+ /** any write to a non-static field in PrinterStream or any subclasses */
+ //pointcut fieldWrites() : set(!static * PrinterStream+.*);
+
+ /** execution of any constructor for PrinterStream or any subclasses */
+ //pointcut init() : execution(PrinterStream+.new(..));
+ // END-SAMPLE testing-inoculated-prohibitWritesEvenBySubclasses
+
+ //---- variation to pick out static callers as well
+ // START-SAMPLE testing-inoculated-prohibitWritesEvenByStaticOthers Prohibit writes by other instances and static methods
+ /**
+ * Handle any situation where fields are written
+ * other than by the same object.
+ */
+ before(PrinterStream targ) : target(targ) && fieldWrites() {
+ Object caller = thisJoinPoint.getThis();
+ if (targ != caller) {
+ String err = "variation 2: caller (" + caller
+ + ") setting fields in targ (" + targ + ")";
+ handle(err, thisJoinPointStaticPart);
+ }
+ }
+ // END-SAMPLE testing-inoculated-prohibitWritesEvenByStaticOthers
+
+ //-------------- utility method
+ void handle(String error, JoinPoint.StaticPart jpsp) {
+ error += " - " + jpsp;
+ if (throwError) {
+ throw new Error(error);
+ } else {
+ System.err.println(error);
+ }
+ }
+}
+
+
+class PrinterStream {
+ int one;
+ private int another;
+
+ PrinterStream() { setOne(1); }
+
+ PrinterStream(PrinterStream other) {
+ other.another = 3;
+ }
+
+ public void setOne(int i) {
+ one = i;
+ }
+}
+
+class SubPrinterStream extends PrinterStream {
+ private int two;
+
+ SubPrinterStream() {
+ setOne(2);
+ setTwo();
+ }
+
+ public void setTwo() {
+ two = 2;
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/StubReplace.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/StubReplace.java
new file mode 100644
index 000000000..56bda0367
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/StubReplace.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+public class StubReplace {
+ public static void main(String[] args) {
+ new PrintJob().run();
+ }
+}
+
+/** @author Wes Isberg */
+aspect Stubs {
+
+ // article page 76 - stubs
+
+ // START-SAMPLE testing-inoculated-replaceWithProxy Replace object with proxy on constructiono
+ /**
+ * Replace all PrintStream with our StubStream
+ * by replacing the call to any constructor of
+ * PrinterStream or any subclasses.
+ */
+ PrinterStream around () : within(PrintJob)
+ && call (PrinterStream+.new(..)) && !call (StubStream+.new(..)) {
+ return new StubStream(thisJoinPoint.getArgs());
+ }
+ // END-SAMPLE testing-inoculated-replaceWithProxy
+
+ // START-SAMPLE testing-inoculated-adviseProxyCallsOnly Advise calls to the proxy object only
+ pointcut stubWrite() : printerStreamTestCalls() && target(StubStream);
+
+ pointcut printerStreamTestCalls() : call(* PrinterStream.write());
+
+ before() : stubWrite() {
+ System.err.println("picking out stubWrite" );
+ }
+ // END-SAMPLE testing-inoculated-adviseProxyCallsOnly
+}
+
+class PrinterStream {
+ public void write() {}
+}
+
+class StubStream extends PrinterStream {
+ public StubStream(Object[] args) {}
+}
+
+class PrintJob {
+ public void run() {
+ PrinterStream p = new PrinterStream();
+ System.err.println("not PrinterStream: " + p);
+ System.err.println("now trying call...");
+ p.write();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/buildRun.sh b/docs/modules/ROOT/pages/sandbox/inoculated/src/buildRun.sh
new file mode 100644
index 000000000..26dce3f59
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/buildRun.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+JDKDIR="${JDKDIR:-${JAVA_HOME:-`setjdk.sh`}}"
+AJ_HOME="${AJ_HOME:-`setajhome.sh`}"
+PS="${PS:-;}"
+ajrt=`pathtojava.sh "$AJ_HOME/lib/aspectjrt.jar"`
+mkdir -p ../classes
+
+for i in *.java; do
+ pack=`sed -n '/package/s|.*package *\([^ ][^ ]*\)[ ;].*|\1|p' "$i"`
+ [ -n "$pack" ] && pack="${pack}."
+ rm -rf classes/*
+ cname=$pack`basename $i .java`
+ echo ""
+ echo "########## $cname"
+ $AJ_HOME/bin/ajc -d ../classes -classpath "$ajrt" "$i"
+ && $JDKDIR/bin/java -classpath "../classes${PS}$ajrt" $cname
+done
+
+rm -rf ../classes
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/CompileTime.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/CompileTime.java
new file mode 100644
index 000000000..f7af344e0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/CompileTime.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+package com.xerox.printing;
+
+import java.awt.Point;
+import java.io.IOException;
+
+class ClassOne {
+ int i = 1 ; // 20 expect warning
+}
+
+class ClassError {
+ int i = 1 ; // 24 expect warning
+}
+
+class PrinterStream {}
+
+class SubPrinterStream extends PrinterStream {
+ public void delegate() {
+ try {
+ throw new IOException("");
+ } catch (IOException e) {} // 33 expect error
+ }
+}
+
+class SubPoint extends Point {
+ Point create() { return new Point(); } // no error
+ Point another() { return new Point(); } // 39 expect error
+}
+
+/** @author Wes Isberg */
+aspect CompileTime {
+
+ // article page 40 - warning
+ // START-SAMPLE declares-inoculated-nonSetterWrites Warn when setting non-public field
+ /** warn if setting non-public field outside a setter */
+ declare warning :
+ within(com.xerox.printing..*)
+ && set(!public * *) && !withincode(* set*(..))
+ : "writing field outside setter" ;
+ // END-SAMPLE declares-inoculated-nonSetterWrites
+
+ // article page 41 - error
+ // START-SAMPLE declares-inoculated-validExceptionHandlingMethod Error when subclass method handles exception
+ declare error : handler(IOException+)
+ && withincode(* PrinterStream+.delegate(..))
+ : "do not handle IOException in this method";
+ // END-SAMPLE declares-inoculated-validExceptionHandlingMethod
+
+ // START-SAMPLE declares-inoculated-validPointConstruction Error when factory not used
+ declare error : !withincode(Point+ SubPoint+.create(..))
+ && within(com.xerox..*)
+ && call(Point+.new(..))
+ : "use SubPoint.create() to create Point";
+ // END-SAMPLE declares-inoculated-validPointConstruction
+}
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RecordingInput.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RecordingInput.java
new file mode 100644
index 000000000..aab1d2076
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RecordingInput.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+package com.xerox.printing;
+
+class PrinterBuffer {
+ public int capacity(int i) { return i; }
+}
+
+public aspect RecordingInput {
+
+ // @author Wes Isberg
+ // article page 42 - recording input
+ pointcut capacityCall (int i) :
+ within(com.xerox..*) && args(i)
+ && call(public * PrinterBuffer.capacity(int)) ;
+ // XXX style error - + not needed
+ // call(public * PrinterBuffer+.capacity(int))
+
+ before (int i) : capacityCall(i) {
+ log.print("<capacityCall tjp=\"" + thisJoinPoint
+ + "\" input=\"" + i + "\"/>");
+ }
+
+ Log log = new Log();
+ class Log {
+ void print(String s) { System.out.println(s); }
+ }
+ public static void main(String[] args) {
+ PrinterBuffer p = new PrinterBuffer();
+ p.capacity(1);
+ p.capacity(2);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RoundTrip.java b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RoundTrip.java
new file mode 100644
index 000000000..4aeb0892b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/inoculated/src/com/xerox/printing/RoundTrip.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1998-2002 PARC Inc. All rights reserved.
+ *
+ * Use and copying of this software and preparation of derivative works based
+ * upon this software are permitted. Any distribution of this software or
+ * derivative works must comply with all applicable United States export
+ * control laws.
+ *
+ * This software is made available AS IS, and PARC Inc. makes no
+ * warranty about the software, its performance or its conformity to any
+ * specification.
+ */
+
+package com.xerox.printing;
+
+public class RoundTrip {
+ public static void main(String[] args) {
+ PrinterStream p = testing();
+ System.err.println(" got "+ p.number);
+ }
+ static PrinterStream testing() { return new PrinterStream(1); }
+
+}
+
+/** @author Wes Isberg */
+aspect VerifyPrinterStreamIntegrity {
+ // article page 76 - round trip
+ // START-SAMPLE testing-inoculated-roundTrip Round-trip integration testing
+ /**
+ * After returning a PrinterStream from any call in our
+ * packages, verify it by doing a round-trip between
+ * PrinterStream and BufferedPrinterStream.
+ * This uses a round-trip as a way to verify the
+ * integrity of PrinterStream, but one could also use
+ * a self-test (built-in or otherwise) coded specifically
+ * for validating the object (without changing state).
+ */
+ after () returning (PrinterStream stream) :
+ call (PrinterStream+ com.xerox.printing..*(..))
+ && !call (PrinterStream PrinterStream.make(BufferedPrinterStream)) {
+ BufferedPrinterStream bufferStream = new BufferedPrinterStream(stream);
+ PrinterStream newStream = PrinterStream.make(bufferStream);
+ if (!stream.equals(newStream)) {
+ throw new Error("round-trip failed for " + stream);
+ } else {
+ System.err.println("round-trip passed for " + stream);
+ }
+ }
+ // END-SAMPLE testing-inoculated-roundTrip
+}
+
+class BufferedPrinterStream {
+ int num;
+ BufferedPrinterStream(int i) { this.num = i; }
+ BufferedPrinterStream(PrinterStream p) { this(p.number); }
+}
+
+class PrinterStream {
+ int number;
+ static PrinterStream make(BufferedPrinterStream p) {
+ return new PrinterStream(p.num);
+ }
+ PrinterStream(int i) { this.number = i; }
+ void write() {}
+ // XXX hashcode
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ } else if (null == o) {
+ return false;
+ } else if (o instanceof PrinterStream) {
+ return ((PrinterStream)o).number == number;
+ } else {
+ return o.equals(this);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/readme-sandbox.adoc b/docs/modules/ROOT/pages/sandbox/readme-sandbox.adoc
new file mode 100644
index 000000000..da4e69cbe
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/readme-sandbox.adoc
@@ -0,0 +1,169 @@
+= AspectJ sandbox for sample code and instructions
+
+This directory is a place to put scraps that might end up in the AspectJ
+documentation or on the web site:
+
+* sample code for AspectJ programs,
+* sample code for extensions to AspectJ tools and API's,
+* sample scripts for invoking AspectJ tools, and
+* documentation trails showing how to do given tasks using AspectJ,
+ AJDT or various IDE or deployment environments.
+
+== General
+
+In the past, we found it tedious to keep and verify sample code used in
+documentation because it involves copying the code from the
+documentation into a form that can be tested (or vice versa). Further,
+there are a lot of tips and sample code contributed on the mailing
+lists, but they can be difficult to find when needed. This aims to be a
+place where such contributions can be gathered, kept in good order, and
+extracted for use in docs, without too much overhead.
+
+Code in the sandbox is kept in a running state; it's tested by running
+the harness on the sandbox test suite file sandbox-test.xml or
+sandbox-api-test.xml. To extract the code for documentation, we use a
+tool that recognizes a sample within a source file if it has comments
+signalling the start and end of the sample. Keeping sample code in sync
+with the documentation and with the test suite specification only takes
+a bit of care with formatting and comments. The rest of this document
+tells how.
+
+== Documenting samples
+
+`org.aspectj.internal.tools.build.SampleGatherer` (in the build module)
+extracts samples of the following form from any "source" file (currently
+source, html, text, and shell scripts):
+
+[source, text]
+....
+... some text, possibly including @author tags
+{comment} START-SAMPLE [anchorName] [anchor title] {end-comment}
+... sample code ...
+{comment} END-SAMPLE [anchorName] {end-comment}
+... more text ...
+....
+
+Each sample extracted consists of the code and associated attributes:
+the source location, the anchor name and title, any text flagged with
+XXX, and the author pulled from the closest-preceding `@author` tag. (If
+there is no author, the AspectJ team is presumed.) `SampleGatherer` can
+render the collected samples back out to HTML (todo: or DocBook) for
+inclusion in the FAQ, the online samples, the Programming Guide, etc. An
+editor might reorder or annotate the samples but the code should not be
+edited to avoid introducing mistakes.
+
+To help keep the sample code in sync with the docs...
+
+* Use comments in the sample to explain the code, rather than describing
+it in the documentation.
+* Preformat samples to be included without modification in docs:
+** Use 4 spaces rather than a tab for each indent.
+** Keep lines short - 60 characters or less.
+** In Java, code taken out of context of the defining type can be
+indented only once in the source code, even though they might normally
+be indented more.
+** In AspectJ, indent advice pointcuts beyond the block code:
++
+[source, java]
+....
+before() : call(!public * com.company.library..*.*(String,..))
+ && within(Runnable+) { // indent once more than code
+ // code here
+}
+....
+
+Where you put the sample code depends on how big it is and what it's
+for. Any code intended as an extension to the AspectJ tools goes in the
+link:api-clients[api-clients/] directory. Most code will instead be
+samples of AspectJ programs. Subdirectories of this directory should be
+the base directories of different source sets. The link:common[common/]
+directory should work for most code snippets, but standalone,
+self-consistent code belongs in its own directory, as do sets pertaining
+to particular publications or tutorials. An example of this are the
+sources for the "Test Inoculated" article in the
+link:inoculated[inoculated/] directory. Finally, the
+link:testsrc[testsrc/] directory is reserved for code used to test the
+other code in the sandbox. There should be no samples under testsrc.
+
+== Testing samples
+
+We try to make sure that the samples we present to people actually work
+by testing each kind differently:
+
+* Most Java and AspectJ programs are tested using sandbox-test.xml.
+* API clients are tested using sandbox-api-test.xml, which requires
+building `aspectjtools.jar`.
+* Shell and Ant scripts should be run per instructions.
+* HTML and text files must be manually reviewed.
+
+When adding Java or AspectJ code, add a corresponding test case in
+sandbox-test.xml. This file has the same format as other harness test
+suites; for more information, see
+../../tests/readme-writing-compiler-tests.html. The test suite should
+run and pass after new code is added and before samples are extracted.
+
+To keep Java/AspectJ code in sync with the tests:
+
+* The test title should be prefixed with the anchor name and have any
+suffixes necessary for clarity and to make sure there are unique titles
+for each test. E.g., for a sample with the anchor
+"`language-initialization`",
++
+[source, xml]
+....
+<ajc-test
+ dir="common"
+ title="language-initialization constructor-call example">
+ ...
+</ajc-test>
+....
++
+(Someday we'll be able to compare the test titles with the anchor names
+to verify that the titles contain all the anchor names.)
+* Avoid mixing compiler-error tests with ordinary code, so others can
+reuse the target code in their samples. Most of the sample code should
+compile.
+* Any code that is supposed to trigger a compiler error should be tested
+by verifying that the error message is produced, checking either or both
+of the line number and the message text. E.g.,
++
+[source, xml]
+....
+<compile files="declares/Declares.java, {others}"
+ <message kind="error" line="15" text="Factory"/>
+</compile>
+....
++
+Where a test case refers to a line number, we have to keep the expected
+message and the target code in sync. You can help with this by adding a
+comment in the target code so people editing the code know not to fix or
+move the code. E.g.,
++
+[source, java]
+....
+void spawn() {
+ new Thread(this, toString()).start(); // KEEP CE 15 declares-factory
+}
+....
++
+Any good comment could work, but here are some optional conventions:
+** Use "CE" or "CW" for compiler error or warning, respectively.
+** Specify the line number, if one is expected.
+** Specify the affected test title(s) or sample code anchor label to
+make it easier to find the test that will break if the code is modified.
+(The editor can also run the tests to find any broken ones.)
+
+If the code is broken (e.g., if it no longer works in the latest version
+of AspectJ), then prefix SAMPLE with BROKEN in the tag:
+
+[source, text]
+....
+{comment} START-BROKEN-SAMPLE ...
+... sample code ...
+{comment} END-BROKEN-SAMPLE ...
+... more text ...
+....
+
+It will no longer be gathered, but can be fixed and reinstated.
+
+Happy coding!
diff --git a/docs/modules/ROOT/pages/sandbox/sandbox-api-test.xml b/docs/modules/ROOT/pages/sandbox/sandbox-api-test.xml
new file mode 100644
index 000000000..1c19e6e9c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/sandbox-api-test.xml
@@ -0,0 +1,36 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
+<!-- ../ path when running, ../../ when editing? -->
+
+
+<!--
+ This is just like sandbox-test.xml except that it is
+ reserved for code that uses the AspectJ API's because
+ it assumes the build has created the target library,
+
+ ../aj-build/dist/tools/lib/aspectjtools.jar
+
+ and that we run from a peer directory of this one.
+-->
+<suite>
+
+ <ajc-test dir="api-clients" title="api-ajde-modelWalker"
+ comment="BROKEN - function unvalidated, only that it compiles and runs">
+ <compile files="org/aspectj/samples/JoinPointCollector.java"
+ classpath="../../../aj-build/dist/tools/lib/aspectjtools.jar"/>
+ <run class="org/aspectj/samples/JoinPointCollector"
+ options="-help"/>
+ </ajc-test>
+
+ <ajc-test dir="api-clients" title="api-asm-listAffectedFiles"
+ comment="function unvalidated; note run paths are relative to harness cwd">
+ <compile files="org/aspectj/samples/AffectedFilesReporter.java"
+ classpath="../../../aj-build/dist/tools/lib/aspectjtools.jar"/>
+ <run class="org/aspectj/samples/AffectedFilesReporter"
+ outStreamIsError="true"
+ options="-emacssym,@../aj-build/dist/docs/doc/examples/tracing/notrace.lst"/>
+ <run class="org/aspectj/samples/AffectedFilesReporter"
+ options="-emacssym,@../aj-build/dist/docs/doc/examples/tracing/tracev3.lst"/>
+ </ajc-test>
+</suite>
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/sandbox-test.xml b/docs/modules/ROOT/pages/sandbox/sandbox-test.xml
new file mode 100644
index 000000000..3e992d26e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/sandbox-test.xml
@@ -0,0 +1,250 @@
+<!DOCTYPE suite SYSTEM "../../tests/ajcTestSuite.dtd">
+<!-- ../ path when running, ../../ when editing? -->
+
+
+<!-- Notes
+
+ - test titles should be prefixed with the corresponding
+ sample anchor/label, and suffixed to be unique.
+
+ - take care to keep error line numbers in sync with sources
+
+ TODO
+ - verify that RunTime and RuntimeWrites throw Errors
+ - harness bug: errStreamIsError not false when not forked; fork?
+ - check output/error stream against expected
+
+-->
+<suite>
+
+ <ajc-test dir="common" title="declares-* default declares">
+ <compile
+ argfiles="company.lst"
+ files="declares/Declares.java">
+ <message
+ kind="error"
+ file="Main.java"
+ line="15"
+ text="Factory"/>
+ <message
+ kind="warning"
+ file="Main.java"
+ line="30"
+ text="throw"/>
+ <message
+ kind="warning"
+ file="Main.java"
+ line="31"
+ text="handles"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="common"
+ title="caching-dirty-reflectiveSetters">
+ <compile files="caching/WatchSetters.java"/>
+ <run class="caching.WatchSetters"/>
+ </ajc-test>
+
+ <ajc-test dir="common"
+ title="ensure company compiles and runs without aspects">
+ <compile argfiles="company.lst"/>
+ <run class="com.company.app.Main"/>
+ </ajc-test>
+
+ <ajc-test dir="common" title="language-initialization">
+ <compile files="language/Initialization.java">
+ <message kind="warning" line="130"/>
+ </compile>
+ <run class="language.Initialization"
+ errStreamIsError="true"/>
+ </ajc-test>
+
+ <ajc-test dir="common" title="language-*Context">
+ <compile files="language/Context.java"/>
+ <run class="language.Context" />
+ </ajc-test>
+
+ <ajc-test dir="common" title="language-cflowRecursionBasic">
+ <compile files="language/ControlFlow.java"/>
+ <run class="language.ControlFlow"/>
+ </ajc-test>
+
+ <ajc-test dir="common" title="language-doubleDispatch">
+ <compile files="language/DoubleDispatch.java"/>
+ <run class="language.DoubleDispatch"/>
+ </ajc-test>
+
+
+ <ajc-test dir="common" title="tracing-simpleLogging">
+ <compile
+ argfiles="company.lst"
+ files="tracing/Logging.java"/>
+ <run class="com.company.app.Main"/>
+ </ajc-test>
+
+ <ajc-test dir="common" title="tracing-traceJoinPoints">
+ <compile
+ argfiles="company.lst"
+ files="tracing/TraceJoinPoints.java,
+ tracing/TraceJoinPointsBase.java,
+ tracing/TraceMyJoinPoints.java"/>
+ <run class="com.company.app.Main"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="declares-inoculated-*">
+ <compile files="com/xerox/printing/CompileTime.java">
+ <message line="20" kind="warning"/>
+ <message line="24" kind="warning"/>
+ <message line="33" kind="error"/>
+ <message line="39" kind="error"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-roundTrip">
+ <compile files="com/xerox/printing/RoundTrip.java"/>
+ <run class="com.xerox.printing.RoundTrip"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-roundTrip">
+ <compile files="BufferTest.java"/>
+ <run class="BufferTest"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-roundTrip">
+ <compile files="BufferTest.java"/>
+ <run class="BufferTest"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-injectIOException">
+ <compile files="Injection.java"/>
+ <run class="Injection"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-injectIOException">
+ <compile files="MainFailure.java"/>
+ <run class="MainFailure"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-runtimeFactories">
+ <compile files="RunTime.java"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-runtimeWrites">
+ <compile files="RuntimeWrites.java"/>
+ </ajc-test>
+
+ <ajc-test dir="inoculated/src" title="testing-inoculated-{proxies}">
+ <compile files="StubReplace.java"/>
+ <run class="StubReplace"/>
+ </ajc-test>
+
+ <ajc-test dir="." title="library-pointcutIdioms compile check">
+ <compile files="common/org/aspectj/langlib/Pointcuts.java"/>
+ </ajc-test>
+</suite>
+<!--
+ <ajc-test dir="." title="library-pointcutIdioms test all pointcuts"
+ >
+ <compile files="common/org/aspectj/langlib/Pointcuts.java,
+ testsrc/org/aspectj/langlib/PointcutsCW.java">
+
+ <message kind="warning" line="172" text="anyConstructorExecution" file="Pointcuts.java"/>
+
+ <message kind="warning" line="20" text="anyConstructorExecution"/>
+ <message kind="warning" line="20" text="anyPublicConstructorExecution"/>
+ <message kind="warning" line="20" text="anyNonPrivateConstructorExecution"/>
+ <message kind="warning" line="59" text="mainExecution"/>
+ <message kind="warning" line="59" text="anyMethodExecution"/>
+ <message kind="warning" line="59" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="59" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="70" text="anyConstructorExecution"/>
+ <message kind="warning" line="72" text="anyConstructorExecution"/>
+ <message kind="warning" line="72" text="anyPublicConstructorExecution"/>
+ <message kind="warning" line="72" text="anyNonPrivateConstructorExecution"/>
+ <message kind="warning" line="76" text="anyConstructorExecution"/>
+ <message kind="warning" line="76" text="anyNonPrivateConstructorExecution"/>
+ <message kind="warning" line="76" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="82" text="anyMethodExecution"/>
+ <message kind="warning" line="82" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="82" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="82" text="toStringExecution "/>
+ <message kind="warning" line="85" text="anyMethodExecution "/>
+ <message kind="warning" line="89" text="anyMethodExecution"/>
+ <message kind="warning" line="89" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="89" text="withinSetter"/>
+ <message kind="warning" line="95" text="anyMethodExecution"/>
+ <message kind="warning" line="95" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="95" text="withinGetter"/>
+ <message kind="warning" line="99" text="anyConstructorExecution"/>
+ <message kind="warning" line="99" text="anyNonPrivateConstructorExecution"/>
+ <message kind="warning" line="102" text="anyMethodExecution"/>
+ <message kind="warning" line="102" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="102" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="102" text="runImplementationsInNonRunnable"/>
+ <message kind="warning" line="105" text="anyRunnableImplementation"/>
+ <message kind="warning" line="105" text="anyConstructorExecution"/>
+ <message kind="warning" line="105" text="anyNonPrivateConstructorExecution"/>
+ <message kind="warning" line="105" text="anyPublicConstructorExecution"/>
+ <message kind="warning" line="110" text="anyMethodExecution"/>
+ <message kind="warning" line="110" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="110" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="114" text="anyMethodExecution"/>
+ <message kind="warning" line="114" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="114" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="114" text="cloneImplementationsInNonCloneable"/>
+ <message kind="warning" line="122" text="anyMethodExecution"/>
+ <message kind="warning" line="122" text="anyPublicMethodExecution"/>
+ <message kind="warning" line="122" text="anyNonPrivateMethodExecution"/>
+ <message kind="warning" line="122" text="anyPublicFieldGet"/>
+ <message kind="warning" line="122" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="124" text="anyPublicFieldGet"/>
+ <message kind="warning" line="124" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="132" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="134" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="136" text="anyPublicFieldSet"/>
+ <message kind="warning" line="136" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="138" text="anyPublicFieldSet"/>
+ <message kind="warning" line="138" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="141" text="anyNonPublicFieldSetOutsideConstructorOrSetter"/>
+ <message kind="warning" line="143" text="anyNonPublicFieldSetOutsideConstructorOrSetter"/>
+ <message kind="warning" line="145" text="anyNonPublicFieldSetOutsideConstructorOrSetter"/>
+ <message kind="warning" line="147" text="anyNonPublicFieldSetOutsideConstructorOrSetter"/>
+ <message kind="warning" line="145" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="147" text="anyNonPrivateFieldSet"/>
+ <message kind="warning" line="149" text="anyJavaIOCalls"/>
+ <message kind="warning" line="149" text="anyGetSystemErrOut"/>
+ <message kind="warning" line="149" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="149" text="anyPublicFieldGet"/>
+ <message kind="warning" line="151" text="anyGetSystemErrOut"/>
+ <message kind="warning" line="151" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="151" text="anyPublicFieldGet"/>
+ <message kind="warning" line="151" text="anyJavaIOCalls"/>
+ <message kind="warning" line="153" text="anyThreadConstruction"/>
+ <message kind="warning" line="155" text="anyJavaIOCalls"/>
+ <message kind="warning" line="157" text="anyJavaIOCalls"/>
+ <message kind="warning" line="159" text="anyJavaAWTOrSwingCalls"/>
+ <message kind="warning" line="161" text="anyJavaAWTOrSwingCalls"/>
+ <message kind="warning" line="163" text="anyJavaAWTOrSwingCalls"/>
+ <message kind="warning" line="165" text="anyJavaAWTOrSwingCalls"/>
+ <message kind="warning" line="167" text="anySystemClassLoadingCalls"/>
+ <message kind="warning" line="167" text="mostThrowableReadCalls"/>
+ <message kind="warning" line="169" text="anySystemClassLoadingCalls"/>
+ <message kind="warning" line="171" text="anySystemReflectiveCalls"/>
+ <message kind="warning" line="173" text="anySystemProcessSpawningCalls"/>
+ <message kind="warning" line="177" text="mostThrowableReadCalls"/>
+ <message kind="warning" line="179" text="mostThrowableReadCalls"/>
+ <message kind="warning" line="184" text="anyCollectionWriteCalls"/>
+ <message kind="warning" line="187" text="anyCollectionWriteCalls"/>
+ <message kind="warning" line="189" text="anyCollectionWriteCalls"/>
+ <message kind="warning" line="189" text="anyNonPrivateFieldGet"/>
+ <message kind="warning" line="189" text="anyPublicFieldGet"/>
+ <message kind="warning" line="191" text="anyCollectionWriteCalls"/>
+ <message kind="warning" line="201" text="anyConstructorExecution"/>
+ <message kind="warning" line="201" text="anyNonPrivateConstructorExecution"/>
+ </compile>
+ <run class="org.aspectj.langlib.PointcutsCW"/>
+ </ajc-test>
+
+</suite>
+-->
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/scripts/precompile-jsp.build.xml b/docs/modules/ROOT/pages/sandbox/scripts/precompile-jsp.build.xml
new file mode 100644
index 000000000..bdabff97b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/scripts/precompile-jsp.build.xml
@@ -0,0 +1,137 @@
+<!-- @author Wes Isberg -->
+<!-- START-SAMPLE j2ee-tomcat4-precompileJsp Precompile JSP's for Tomcat 4.x using AspectJ -->
+<project name="Precompile Tomcat JSPs" default="all" basedir=".">
+
+ <target name="all" depends="jspc,compile"/>
+
+ <target name="info">
+ <echo>
+This Ant script precompiles deployed .jsp files in Tomcat
+using AspectJ 1.1.
+
+Usage:
+
+ {ant} -f {this-script} \
+ -Dtomcat.home=/home/tomcat \
+ -Dwebapp.name=launchWeb \
+ -DASPECTJ_HOME=/dev/tools/aspectj-1.1.0
+
+
+This defines the web application deployment $${webapp.dir} as
+
+ $${tomcat.home}/webapps/$${webapp.name}
+
+, generates the Java source files to
+
+ $${webapp.dir}/WEB-INF/src
+
+, uses iajc (AspectJ) to compile them to
+
+ $${webapp.dir}/WEB-INF/classes,
+
+, and creates the mappings
+
+ $${webapp.dir}/WEB-INF/generated_web.xml,
+
+which must be manually inserted into
+
+ $${webapp.dir}/WEB-INF/generated_web.xml,
+
+at which point the web application can be reloaded.
+
+This assumes that aspectjrt.jar is already deployed in
+any of places on the Tomcat application classpath
+(the application, shared, or common classpath).
+If ASPECTJ_HOME is not defined, it assumes that
+aspectjtools.jar is in
+
+ ${CATALINA_HOME}/common/lib
+
+</echo>
+ </target>
+
+ <target name="init">
+ <!-- declare these two on command-line -->
+ <property name="webapp.name"
+ value="launchWeb"/>
+
+ <property name="tomcat.home"
+ location="i:/home/tomcat"/>
+
+ <property name="webapp.path"
+ location="${tomcat.home}/webapps/${webapp.name}"/>
+ <property name="webapp.src.dir"
+ location="${webapp.path}/WEB-INF/src"/>
+
+ <property name="ASPECTJ_HOME"
+ location="${tomcat.home}/common"/>
+
+ </target>
+
+ <target name="jspc" depends="init">
+
+ <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
+ <classpath id="jspc.classpath">
+ <pathelement location="${java.home}/../lib/tools.jar"/>
+ <fileset dir="${tomcat.home}/server/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${tomcat.home}/common/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <mkdir dir="${webapp.src.dir}"/>
+ <jasper2
+ validateXml="true"
+ uriroot="${webapp.path}"
+ webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
+ outputDir="${webapp.src.dir}" />
+
+ </target>
+
+ <target name="compile" depends="init">
+
+ <mkdir dir="${webapp.path}/WEB-INF/classes"/>
+ <mkdir dir="${webapp.path}/WEB-INF/lib"/>
+
+ <path id="iajc.classpath">
+ <fileset dir="${ASPECTJ_HOME}/lib">
+ <include name="aspectjtools.jar"/>
+ </fileset>
+ </path>
+ <taskdef
+ resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath refid="iajc.classpath"/>
+ </taskdef>
+
+ <!-- forking compile so it runs in Eclipse -->
+ <iajc destdir="${webapp.path}/WEB-INF/classes"
+ sourceroots="${webapp.src.dir}"
+ debug="on"
+ verbose="true"
+ fork="true"
+ forkclasspathRef="iajc.classpath"
+ failonerror="true"
+ >
+ <classpath>
+ <pathelement location="${webapp.path}/WEB-INF/classes"/>
+ <fileset dir="${webapp.path}/WEB-INF/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${tomcat.home}/common/classes"/>
+ <fileset dir="${tomcat.home}/common/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${tomcat.home}/shared/classes"/>
+ <fileset dir="${tomcat.home}/shared/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </iajc>
+
+ </target>
+
+</project>
+<!-- END-SAMPLE j2ee-tomcat4-precompileJsp -->
diff --git a/docs/modules/ROOT/pages/sandbox/scripts/snippets.sh b/docs/modules/ROOT/pages/sandbox/scripts/snippets.sh
new file mode 100644
index 000000000..312ebf064
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/scripts/snippets.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# shell script snippets for AspectJ
+
+
+# @author Wes Isberg
+# START-SAMPLE scripts-weaveLibraries Shell script to use ajc to weave jars and then run
+ASPECTJ_HOME="${ASPECTJ_HOME:-c:/aspectj-1.1.0}"
+ajc="$ASPECTJ_HOME/bin/ajc"
+
+# make system.jar by weaving aspects.jar into lib.jar and app.jar
+$ajc -classpath "$ASPECTJ_HOME/lib/aspectjrt.jar" \
+ -aspectpath aspects.jar" \
+ -injars "app.jar;lib.jar" \
+ -outjar system.jar
+
+# XXX copy any required resources from META-INF directories
+
+# run it
+java -classpath "aspects.jar;system.jar" com.company.app.Main
+
+# END-SAMPLE scripts-weaveLibraries
diff --git a/docs/modules/ROOT/pages/sandbox/testsrc/org/aspectj/langlib/PointcutsCW.java b/docs/modules/ROOT/pages/sandbox/testsrc/org/aspectj/langlib/PointcutsCW.java
new file mode 100644
index 000000000..ff64fad51
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/testsrc/org/aspectj/langlib/PointcutsCW.java
@@ -0,0 +1,232 @@
+package org.aspectj.langlib;
+import org.aspectj.testing.Tester;
+
+import java.awt.Button;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+import java.io.*;
+import java.lang.reflect.Method;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.Action;
+
+
+
+
+/**
+ * todo yet untested:
+ * - dynamic calls
+ */
+public aspect PointcutsCW {
+ declare error: Pointcuts.never() : "never";
+ declare error: within(PointcutsCW) && Pointcuts.never() : "never";
+
+ declare warning: Pointcuts.mainExecution() : "mainExecution";
+ declare warning: Pointcuts.anyMethodExecution() : "anyMethodExecution";
+ declare warning: Pointcuts.anyPublicMethodExecution() : "anyPublicMethodExecution";
+ declare warning: Pointcuts.anyNonPrivateMethodExecution() : "anyNonPrivateMethodExecution";
+ declare warning: Pointcuts.anyConstructorExecution() : "anyConstructorExecution";
+ declare warning: Pointcuts.anyPublicConstructorExecution() : "anyPublicConstructorExecution";
+ declare warning: Pointcuts.anyNonPrivateConstructorExecution() : "anyNonPrivateConstructorExecution";
+
+ declare warning: Pointcuts.anyPublicFieldGet() : "anyPublicFieldGet";
+ declare warning: Pointcuts.anyNonPrivateFieldGet() : "anyNonPrivateFieldGet";
+ declare warning: Pointcuts.anyPublicFieldSet() : "anyPublicFieldSet";
+ declare warning: Pointcuts.anyNonPrivateFieldSet() : "anyNonPrivateFieldSet";
+ declare warning: Pointcuts.withinSetter() : "withinSetter";
+ declare warning: Pointcuts.withinGetter() : "withinGetter";
+ declare warning: Pointcuts.anyNonPublicFieldSetOutsideConstructorOrSetter() : "anyNonPublicFieldSetOutsideConstructorOrSetter";
+
+ declare warning: Pointcuts.anyRunnableImplementation() : "anyRunnableImplementation";
+ declare warning: Pointcuts.anyGetSystemErrOut() : "anyGetSystemErrOut";
+ declare warning: Pointcuts.anySetSystemErrOut() : "anySetSystemErrOut";
+ //declare warning: Pointcuts.withinAnyJavaCode() : "withinAnyJavaCode"; // XXX
+ //declare warning: Pointcuts.notWithinJavaCode() : "notWithinJavaCode"; // XXX
+ declare warning: Pointcuts.toStringExecution() : "toStringExecution";
+ declare warning: Pointcuts.anyThreadConstruction() : "anyThreadConstruction";
+ declare warning: Pointcuts.anyJavaIOCalls() : "anyJavaIOCalls";
+ declare warning: Pointcuts.anyJavaAWTOrSwingCalls() : "anyJavaAWTOrSwingCalls";
+ declare warning: Pointcuts.cloneImplementationsInNonCloneable() : "cloneImplementationsInNonCloneable";
+ declare warning: Pointcuts.runImplementationsInNonRunnable() : "runImplementationsInNonRunnable";
+ declare warning: Pointcuts.anySystemReflectiveCalls() : "anySystemReflectiveCalls";
+ declare warning: Pointcuts.anySystemClassLoadingCalls() : "anySystemClassLoadingCalls";
+ declare warning: Pointcuts.anySystemProcessSpawningCalls() : "anySystemProcessSpawningCalls";
+ declare warning: Pointcuts.mostThrowableReadCalls() : "mostThrowableReadCalls";
+ declare warning: Pointcuts.exceptionWrappingCalls() : "exceptionWrappingCalls";
+ declare warning: Pointcuts.anyCollectionWriteCalls() : "anyCollectionWriteCalls";
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public static void main(String[] list) {
+ new MemberTests(0).toString(); // RT cflowMainExecution
+ }
+}
+class MemberTests {
+ public static int publicStaticInt;
+ public int publicInt;
+ private static int privateStaticInt;
+ private int privateInt;
+ static int defaultStaticInt;
+ int defaultInt;
+
+ private MemberTests() {} // CW anyConstructorExecution
+
+ public MemberTests(int i) {} // CW anyConstructorExecution, anyPublicConstructorExecution, anyNonPrivateConstructorExecution
+
+ MemberTests(String s) { // CW anyConstructorExecution, anyNonPrivateConstructorExecution
+
+ defaultInt = 0; // CW anyNonPrivateFieldSet
+
+ }
+
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public String toString() {// CW toStringExecution
+ return "";
+ }
+
+ private int pperrorCode() { return 0; } // CW anyMethodExecution
+
+ private void setInt(int i) { // CW anyMethodExecution,
+
+ defaultInt = i; // CW anyNonPrivateFieldSet, withinSetter
+
+ }
+
+ private int getInt() {
+
+ return defaultInt; // CW anyNonPrivateFieldGet, withinGetter
+
+ }
+
+ static class NotRunnable {
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public void run() { // CW runImplementationsInNonRunnable
+ }
+ }
+
+ static class R implements Runnable { // CW anyRunnableImplementation
+
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public void run() {
+ int i = 1; // hmm -- getting 110 here instead of 109?
+ }
+
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public Object clone() { // CW cloneImplementationsInNonCloneable
+ return null;
+ }
+
+ }
+
+ // CW anyMethodExecution, anyPublicMethodExecution, anyNonPrivateMethodExecution
+ public void perrorCode() throws Exception {
+
+ int i = publicStaticInt; // CW anyPublicFieldGet, anyNonPrivateFieldGet
+
+ i = publicInt; // CW anyPublicFieldGet, anyNonPrivateFieldGet
+
+ i = privateStaticInt;
+
+ i = privateInt;
+
+
+
+ i = defaultStaticInt; // CW anyNonPrivateFieldGet
+
+ i = defaultInt; // CW anyNonPrivateFieldGet
+
+ publicStaticInt = 1; // CW anyPublicFieldSet, anyNonPrivateFieldSet
+
+ publicInt = 1; // CW anyPublicFieldSet, anyNonPrivateFieldSet
+
+ // for these 4: CW anyNonPublicFieldSetOutsideConstructorOrSetter
+ privateStaticInt = 1;
+
+ privateInt = 1;
+
+ defaultStaticInt = 1; // CW anyNonPrivateFieldSet
+
+ defaultInt = 1; // CW anyNonPrivateFieldSet
+
+ System.out.println(""); // CW anyGetSystemErrOut, anyNonPrivateFieldGet, anyPublicFieldGet, anyJavaIOCalls
+
+ System.err.println(""); // CW anyGetSystemErrOut, anyNonPrivateFieldGet anyPublicFieldGet, anyJavaIOCalls
+
+ new Thread((Runnable)null); // CW anyThreadConstruction, anyConstructorExecution, anyNonPrivateConstructorExecution
+
+ FileReader fr = new FileReader("none"); // CW anyJavaIOCalls
+
+ i = fr.read(); // CW anyJavaIOCalls
+
+ DefaultListModel model = new DefaultListModel(); // CW anyJavaAWTOrSwingCalls
+
+ model.addElement(null); // CW anyJavaAWTOrSwingCalls
+
+ Button button = new Button(); // CW anyJavaAWTOrSwingCalls
+
+ button.addActionListener(null); // CW anyJavaAWTOrSwingCalls
+
+ String myName = PointcutsCW.class.getName(); // CW anySystemClassLoadingCalls, mostThrowableReadCalls b/c of in-bytecode conversion from ClassNotFoundException to NoClassDefFoundError
+
+ Class me = Class.forName(myName); // CW anySystemClassLoadingCalls
+
+ Method m = me.getDeclaredMethod("notFound", new Class[]{}); // CW anySystemReflectiveCalls
+
+ Process p = Runtime.getRuntime().exec("ls"); // CW anySystemProcessSpawningCalls
+
+ Error e = new Error("hello");
+
+ e.getMessage(); // CW mostThrowableReadCalls
+
+ e.printStackTrace(); // CW mostThrowableReadCalls
+
+ e.getClass(); // not mostThrowableReadCalls b/c getClass() is Object
+
+ List list = new ArrayList();
+ list.add("one"); // CW anyCollectionWriteCalls
+
+ // actually not writing, but staticly might
+ list.remove("two"); // CW anyCollectionWriteCalls
+
+ list.removeAll(Collections.EMPTY_LIST); // CW anyCollectionWriteCalls, anyPublicFieldGet, anyNonPrivateFieldGet
+
+ list.retainAll(list); // CW anyCollectionWriteCalls
+
+ }
+
+}
+
+
+aspect DynamicTests {
+ DynamicTests() {
+ int i = 1; // CW anyConstructorExecution, anyNonPrivateConstructorExecution XXX shows as 190, not 189?
+ }
+ static {
+ Tester.expectEvent("mainExecution");
+ Tester.expectEvent("cflowMainExecution");
+ Tester.expectEvent("adviceCflow");
+ Tester.expectEvent("notInAdviceCflow");
+ }
+ after(MemberTests memberTests) returning : target(memberTests)
+ && Pointcuts.cflowMainExecution() && call(String toString())
+ && !within(DynamicTests) {
+ String targ = memberTests.toString();
+ Tester.event("cflowMainExecution");
+ Tester.event("adviceCflow");
+ }
+
+ after() returning : target(MemberTests)
+ && Pointcuts.notInAdviceCflow() && call(String toString()) {
+ Tester.event("notInAdviceCflow"); // should only get one of these
+ }
+
+ after() returning : within(PointcutsCW) && Pointcuts.mainExecution() {
+ Tester.event("mainExecution"); // also cflowMainExecution
+ Tester.checkAllEvents();
+ }
+
+}
+/*
+ grep -n " CW" PointcutsCW.java \
+ | sed 's|^\(.*\)\:.*\/\/*CW \(.*\)$|<message kind="warning" line="\1" text="\2"/>|' \
+ > messages.txt
+
+*/ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/trails/debugging.adoc b/docs/modules/ROOT/pages/sandbox/trails/debugging.adoc
new file mode 100644
index 000000000..944c48a23
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/trails/debugging.adoc
@@ -0,0 +1,40 @@
+= Debugging AspectJ Programs
+
+_Last updated: 2003-11-26 by wisberg_
+
+== Debugging AspectJ 1.0 Programs
+
+The AspectJ 1.0 compiler produces .class files that have the normal
+source file attribute and line information as well as the information
+specified by JSR-045 required to debug .class files composed of multiple
+source files. This permits the compiler to inline advice code into the
+.class files of the target classes; the advice code in the target class
+can have source attributes that point back to the aspect file.
+
+Support for JSR-45 varies. At the time of this writing, Sun's VM
+supports it, but not some others, which means that the Sun VM must be
+used as the runtime VM. Because the VM does all the work of associating
+the source line with the code being debugged, debuggers should be able
+to operate normally with AspectJ 1.0 source files even if they weren't
+written with that in mind, if they use the correct API's to the
+debugger. Unfortunately, some debuggers take shortcuts based on the
+default case of one file per class in order to avoid having the VM
+calculate the file suffix or package prefix. These debuggers do not
+support JSR-45 and thus AspectJ.
+
+== Debugging AspectJ 1.1 Programs
+
+The AspectJ 1.1 compiler usually implements advice as call-backs to the
+aspect, which means that most AspectJ programs do not require JSR-45
+support in order to be debugged. However, it does do a limited amount of
+advice inlining; to avoid this, use the `-XnoInline` flag.
+
+Because inlined advice can be more efficient, we plan to support JSR-45
+as soon as feasible. This will require upgrading the BCEL library we use
+to pass around the correct source attributes.
+
+Sometimes debuggers correctly get the source line information, but fail
+when they attempt to parse AspectJ source files expected to contain Java
+code. For these it might be possible to step into AspectJ code, but not
+to set breakpoints, or to work around the parse errors by using `.aj`
+rather than `.java` as a file extension.
diff --git a/docs/modules/ROOT/pages/sandbox/trails/j2ee.adoc b/docs/modules/ROOT/pages/sandbox/trails/j2ee.adoc
new file mode 100644
index 000000000..efca55e77
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/trails/j2ee.adoc
@@ -0,0 +1,59 @@
+= Using AspectJ in servlets
+
+_Last updated: 2003-09-27 by wisberg_
+
+This contains short notes on using AspectJ with various J2EE servers and
+deployment tools.
+
+== Generally
+
+AspectJ programs work if run in the same namespace and with
+aspectjrt.jar. Servlet runners and J2EE web containers should run
+AspectJ programs fine if the classes and required libraries are deployed
+as usual. As with any shared library, if more than one application is
+using AspectJ, then the aspectjrt.jar should be deployed where it will
+be loaded by a common classloader. The same is true of any shared
+aspects.
+
+== Running AspectJ servlets in Tomcat 4.x
+
+In Tomcat, you can deploy application servlets in WAR's or in exploded
+web directories and share code across applications.
+
+. Use `ajc` to compile the servlets, and deploy the classes as usual
+ into `{WebRoot}/WEB-INF/classes`.
+. If your web applications or aspects do not interact, deploy
+ `aspectjrt.jar` into `{WebRoot}/WEB-INF/lib`.
+. If your web applications or aspects might interact, deploy them to
+`${CATALINA_BASE}/shared/lib`.
+
+Tomcat 4.x uses the Jasper engine based on Ant to compile JSP's. To set
+up ajc as the compiler, do the following before starting Tomcat:
+
+. Put `aspectjtools.jar` in `${CATALINA_HOME}/common/lib` so that it can
+ be loaded by Jasper.
+
+. Update Jasper servlet parameters in `${CATALINA_HOME}/conf/web.xml` to
+ tell Ant to use `ajc` by setting the compiler property to the AspectJ
+ compiler adapter:
++
+[source, xml]
+....
+<servlet>
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+ ...
+ <init-param>
+ <param-name>compiler</param-name>
+ <param-value>org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter</param-value>
+ </init-param>
+....
+
+. The classpath is dynamically generated from the webapp deployment, so
+ `aspectjrt.jar` should be in `{webapp}/WEB-INF/lib` or some shared or
+ common directory supported by the server.
+
+. Alternatively, you can precompile JSP's using
+ xref:../scripts/precompile-jsp.build.xml[this Ant script]. That involves
+ manually updating the `web.xml` file with the `Jasper`-generated servlet
+ mappings.
diff --git a/docs/modules/ROOT/pages/sandbox/trails/links.adoc b/docs/modules/ROOT/pages/sandbox/trails/links.adoc
new file mode 100644
index 000000000..7ec1e7459
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/trails/links.adoc
@@ -0,0 +1,39 @@
+= Where to find AspectJ sample code
+
+_Last updated: 2004-04-19 by wisberg_
+
+This contains links to other instances of AspectJ sample code. It
+doesn't contain links to all articles that have AspectJ sample code, but
+arguably it should.
+
+For a list of publications about AspectJ that might contain sample code,
+see the publications link off the AspectJ web site at
+https://eclipse.org/aspectj
+
+*"AspectJ in Action"* by Ramnivas Laddad has sample code including
+four patterns: the worker object creation pattern, the exception
+introduction pattern, the participant pattern, and the wormhole pattern.
+Find the code at http://www.manning.com/laddad/.
+
+In the OOPSLA 2002 paper *"Design Pattern Implementation in Java and
+AspectJ"*, Jan Hannemann and Gregor Kiczales discuss the implementation
+in AspectJ of 23 of the traditional "gang of four" design patterns (from
+the book "Design Patterns: elements of reusable object-oriented
+software" by Gamma, Helm, Johnson, and Vlissides). Their paper and the
+code for those patterns are available from
+http://www.cs.ubc.ca/~jan/AODPs/. The code is also available from the
+AspectJ web site as ubc-design-patterns.zip. The latest version is
+checked into the CVS repository along with other sample code at
+`org.aspectj/modules/docs/sandbox/ubc-design-patterns`. For instructions
+on downloading code from the CVS repository, see the FAQ entry
+xref:../../faq/faq.adoc#buildingsource[How do I get and compile the source code for AspectJ?].
+
+The https://atrack.dev.java.net/[*aTrack project*] aims to create an open
+source bug tracking application that demonstrates use of Aspect-Oriented
+Programming (AOP) with AspectJ. It uses AOP pragmatically to provide
+systematic support for technical, middleware, and business concerns.
+
+The http://sourceforge.net/projects/cricketcage/[*CricketCage project*]
+automatically creates JUnit TestCases for repeatable bugs and test
+scenarios. Include Cricket Cage's AspectJ code to install a code
+generator, then run the program to generate the TestCase.
diff --git a/docs/modules/ROOT/pages/sandbox/trails/myeclipseide.adoc b/docs/modules/ROOT/pages/sandbox/trails/myeclipseide.adoc
new file mode 100644
index 000000000..372591131
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/trails/myeclipseide.adoc
@@ -0,0 +1,57 @@
+= MyEclipseIde
+
+_Last updated: 2003-07-08 by wisberg_
+
+MyEclipseIde (http://www.myeclipseide.com/[http://www.myeclipseide.com])
+aims to make it easy to develop J2EE applications using Eclipse. AJDT
+(https://eclipse.org/ajdt) is an Eclipse plug-in that supports AspectJ.
+
+== Getting started
+
+* To install AJDT with MyEclipseIDE, direct the Eclipse update manager
+to https://download.eclipse.org/technology/ajdt/dev/update, install the
+plug-in, and follow any post-install instructions.
+* To enable a project to use aspects, first select
+`Convert to AspectJ project` from the project's context menu (select
+project, right click). (XXX Bug: AJDT reverts perspective to Java; go
+back to MyEclipseIDE) Note that you must convert each project;
+converting the master J2EE project will not affect the child components
+(XXX RFE: option to convert child if parent).
+* To build, select the menu item `Project > Rebuild Project`. AJDT
+creates `default.lst` which lists all source files and compiles them.
+You can also recompile by clicking the AJDT build button. (XXX Bug: only
+available in the Java perspective)
+* To deploy, first add `aspectjrt.jar` to the project's library
+directory. For servlets and JSP's, that is in `{Web Root}/WEB-INF/lib`.
+For EJB's, it's XXX todo. Then deploy as usual for your application
+server.
+* If you are using AspectJ in more than one project, you might instead
+deploy `aspectjrt.jar` whereever shared libraries belong for your
+server.
+
+== Bugs in MyEclipseIDE
+
+. After refactoring to rename a servlet, have to manually update web.xml
+. Silent failure when unable to delete a duplicate resource during
+deployment.
+. Annoyingly modal UI for deployment. Use a view.
+. Need validation on saving Web.xml. E.g., servlet mapping names
+validated with declared servlet names.
+. Deployment dirty flag not working; not updated after editing web.xml
+or rebuilding project.
+. Apparantly false JSP error? using Sun page and template page, got:
+"Fatal error - The markup in the document preceding the root element
+must be well-formed." Error persisted even after replacing the entire
+contents of the file with the template which worked by default.
+. When using the exact template page, get no MyEclipseIDE error, but do
+get compile errors in Tomcat. Using Javac, get compile-failed stack
+trace with initial line number. Using ajc, just get stack trace. But
+precompiling using Ant seems to work.
+. Precompiling JSP's:
+* MyEclipseIDE has a command to compile all JSP's, but I don't see
+(where or how) the updated servlet mappings get into the deployed
+web.xml. It would be great to get this working with AJDT.
+* I adapted the Tomcat precompile script to use AspectJ's iajc. This
+works fine, but like all Jasper2 solutions required the generated
+servlet mappings be copied manually into the web.xml file. See
+xref:../scripts/precompile-jsp.build.xml[the Ant build script].
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/buildAllPatterns.bat b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/buildAllPatterns.bat
new file mode 100644
index 000000000..bb8474a8f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/buildAllPatterns.bat
@@ -0,0 +1,7 @@
+@echo Building pattern library and all sample systems...
+@echo To run individual examples, type "testPattern [patternName]",
+@echo where [patternName] is "observer", "chainOfResponsibility", etc.
+
+ajc -d bin @src/allPatterns.lst
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/default.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/default.lst
new file mode 100644
index 000000000..8b16e3479
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/default.lst
@@ -0,0 +1,253 @@
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\AbstractFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\AbstractFactoryEnhancement.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\Display.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\FramedFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\RegularFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\AbstractFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\Display.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\FramedFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\RegularFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\PrinterAdapter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\SystemOutPrinter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\Writer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\PrinterAdapter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\SystemOutPrinter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\Writer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\AbstractionImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\CrossCapitalImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\GreetingScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\InformationScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\ScreenImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\StarImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\CrossCapitalImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\GreetingScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\InformationScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\ScreenImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\StarImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\Creator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\CreatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\TextCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\XMLCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\Creator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\TextCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\XMLCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Click.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\ClickChain.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Frame.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Panel.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Click.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\ClickHandler.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Frame.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Panel.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommand.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommand2.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommanding.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Printer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\ButtonCommand.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\ButtonCommand2.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Command.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\Directory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\File.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\FileSystemComposition.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\Directory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\File.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\FileSystemComponent.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\BracketDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\ConcreteOutput.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\StarDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\BracketDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\ConcreteOutput.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\Output.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\OutputDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\StarDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\Decoration.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\OutputFacade.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\RegularScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\StringTransformer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\ButtonCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\CreatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\GUIComponentCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\LabelCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\ButtonCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\GUIComponentCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\LabelCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\CharacterFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\FlyweightImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\PrintableFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\WhitespaceFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\CharacterFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\PrintableFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\PrintableFlyweightFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\WhitespaceFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\AndExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanConstant.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanInterpretation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\ExpressionException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\NotExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\OrExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\VariableContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\VariableExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\AndExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\BooleanConstant.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\BooleanExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\ExpressionException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\NotExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\OrExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\VariableContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\VariableExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\OpenList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\OpenListIteration.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\SimpleList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\OpenList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\ReverseIterator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\SimpleList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Label.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\MediatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\GUIColleague.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\GUIMediator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Label.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\Counter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\CounterMemento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\Counter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\CounterMemento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\ColorObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\CoordinateObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Point.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\ScreenObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\ChangeObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\ChangeSubject.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Point.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypeA.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypeB.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypes.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\StringPrototypeA.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\StringPrototypeB.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\AlternateOutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\OutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestBlocking.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestCounting.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestDelegation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\OutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\OutputSubject.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\RequestBlocker.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\RequestCounter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\Printer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\PrinterSubclass.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\SingletonInstance.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\PrinterSingleton.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\PrinterSubclass.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\Queue.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueEmpty.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueFull.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueNormal.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueState.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueStateAspect.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\Queue.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueEmpty.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueFull.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueNormal.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueState.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\BubbleSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\LinearSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\Sorter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\SortingStrategy.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\BubbleSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\LinearSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\Sorter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\SortingStrategy.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\DecoratedStringGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\FancyGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\Generating.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\SimpleGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\DecoratedStringGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\FancyGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\SimpleGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\BinaryTreeLeaf.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\BinaryTreeNode.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\SummationVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\TraversalVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Visitable.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Visiting.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeLeaf.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeNode.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\SummationVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\TraversalVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\Visitable.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ChainOfResponsibilityException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ChainOfResponsibilityProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\Command.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandInvoker.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandReceiver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CompositeProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\FlyweightProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MediatorProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\Memento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MementoException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MementoProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ObserverProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\PrototypeProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ProxyProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\SingletonProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\StrategyProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\VisitorProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\testCenter\TestCenter.java
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/docs/readme.adoc b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/docs/readme.adoc
new file mode 100644
index 000000000..f485a54f0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/docs/readme.adoc
@@ -0,0 +1,59 @@
+= Implementations of GoF Design Patterns in Java and AspectJ
+
+_Code base documentation (April 2, 2004)_
+
+== Overview
+
+The goal was to provide parallel implementations in AspectJ and Java that allow for direct comparisons. It has to be noted that most patterns offer variability in the implementation approach. We choose the one that appeared to be the most general. Sometimes, the AspectJ version implements a slightly different (or additional) case(s). This is due to the fact that AJ sometimes allows for additional functionality. Please refer to the web page and our OOPSLA '02 paper for a detailed description of this work.
+
+== Example Setup
+
+All pattern examples have a class called `Main`. This class is the driver for the particular example. The Main classes are extensively documented using ajdoc, describing the experimental setup and the assignment of roles to participants. In most cases, the differences between Java and AspectJ implementations are also mentioned.
+
+== Documentation (ajdoc)
+
+While all files are extensively documented using ajdoc (the AspectJ version of javadoc), ajdoc is not yet compatible with the later AspectJ releases, so it is currently not possible to generate HTML documents from it. This will be added when ajdoc is updated.
+Within the ajdoc documentation, we tried to separate type names used in our examples from role names (as presented in GoF). We show roles names in italics and actual type names in code font.
+
+== Questions, feedback, suggestions, etc.
+
+The AODP web page is http://www.cs.ubc.ca/labs/spl/aodp.html
+
+Please send all questions, feedback, and suggestions to Jan Hannemann (jan [AT] cs.ubc.ca). We are very much interested in improving our code. Please do not hesitate to drop us a line.
+
+== Appendix
+
+This appendix outlines how to compile and run the examples provided. DOS batch files exist that automate these tasks somewhat. Note that the batch files only work in Windows environments. The following is a list of tasks and a description of what commands accomplish them. For compiling, running and generating documentation, two options are given. The first one is using a provided script; the second is the standard command-line option (longer, but will work on all operation systems).
+
+=== Using the Eclipse IDE
+
+Setting up your system and running the examples
+
+1. Install https://www.eclipse.org[Eclipse] and https://www.eclipse.org/ajdt[AJDT]. Currently, AJDT only works with release 2.1.X and not with version 3.0+ of Eclipse. Check the AJDT web page for more information and updates.
+2. Import the ZIP file with the AOP pattern examples into Eclipse
+3. Compile & run
+
+
+=== Using other AspectJ-compatible IDEs
+
+Note: The code base has not been tested with other IDEs. Chances are that this will work similar to the above, though.
+
+=== Using command-line compilation
+
+Setting up your system
+
+1. Install Java (version 1.4+) and AspectJ (version 1.1+)
+2. Extract the ZIP file into a directory of your choice
+3. Make sure your `CLASSPATH` contains the example's src directory
+4. Change to that directory
+
+Compile Java and AspectJ versions the design pattern examples. Choose one:
+
+* Use the `buildAllPatterns` batch file (just call it from the examples root directory. Needs no arguments).
+* `ajc -d bin @src/allPatterns.lst`
+
+Run a compiled example (e.g. Observer). Choose one:
+
+* Test pattern Observer (this runs both Java and AspectJ versions)
+** `java ca.ubc.cs.spl.aspectPatterns.examples.observer.java.Main` for the Java version,
+** `java ca.ubc.cs.spl.aspectPatterns.examples.observer.java.Main` for the AspectJ version
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-readme.adoc b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-readme.adoc
new file mode 100644
index 000000000..ade559c2d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-readme.adoc
@@ -0,0 +1,23 @@
+== AspectJ Patterns
+
+_Last updated: 2004-03-31 by wisberg_
+
+This directory contains Java and AspectJ implementations of the patterns
+described in the "Design Patterns" book by the so-called gang-of-four
+(Gamma, Helm, Johnson, Vlissides). Jan Hannemann from UBC contributed
+the code under the Mozilla Public License 1.0. For more details, see
+xref:docs/readme.adoc[].
+
+Build options
+
+* To build the code manually with ajc, use the corresponding build.lst
+ files, creating the aspect library first (to create lib.jar).
+* IDE support does not support options like
+ sourceroots or -outjar in the .lst files, so you'll have to create new
+ .lst files if you want to build portions of the project in an IDE.
+* To build with eclipse, there are .project and .classpath files, but
+ you will need to adjust the `aspectjrt.jar` entry after importing the
+ project.
+* To build for testing, see patterns-test.xml.
+
+Enjoy!
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-test.xml b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-test.xml
new file mode 100644
index 000000000..be5f4f4b6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/patterns-test.xml
@@ -0,0 +1,252 @@
+<!DOCTYPE suite SYSTEM "../../../tests/ajcTestSuite.dtd">
+
+<!--
+ To run with the harness, run
+
+ java org.aspectj.testing.drivers.Harness \
+ ../docs/sandbox/ubc-design-patterns/patterns-test.xml -logFail
+
+ from a project directory (tests/ docs/ or testing-drivers)
+
+ See tests/readme-writing-compiler-tests.html for more info on the harness.
+-->
+<suite>
+
+ <ajc-test dir="src"
+ title="UBC design patterns library">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary" />
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns abstractFactory">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns adapter">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns bridge">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns builder">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns chainOfResponsibility">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns command">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns composite">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns decorator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns facade">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj">
+ <message kind="warning" line="72" />
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns factoryMethod">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns flyweight">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns interpreter">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns iterator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns mediator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns memento">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns observer">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns prototype">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns proxy">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns singleton">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns state">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns strategy">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns templateMethod">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns visitor">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/patternLibrary,ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java abstractFactory">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java adapter">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/adapter/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java bridge">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/bridge/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java builder">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/builder/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java chainOfResponsibility">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java command">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/command/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java composite">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/composite/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java decorator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/decorator/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java facade">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/facade/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java factoryMethod">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java flyweight">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java interpreter">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java iterator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/iterator/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java mediator">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/mediator/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java memento">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/memento/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java observer">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/observer/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java prototype">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/prototype/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java proxy">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/proxy/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java singleton">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/singleton/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java state">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/state/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java strategy">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/strategy/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java templateMethod">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java"/>
+ </ajc-test>
+
+ <ajc-test dir="src"
+ title="UBC design patterns java visitor">
+ <compile sourceroots="ca/ubc/cs/spl/aspectPatterns/examples/visitor/java"/>
+ </ajc-test>
+
+</suite> \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/allPatterns.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/allPatterns.lst
new file mode 100644
index 000000000..3e5fafe8a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/allPatterns.lst
@@ -0,0 +1,51 @@
+ca/ubc/cs/spl/aspectPatterns/patternLibrary/*.java
+
+ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/builder/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/*.java
+
+ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/composite/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/facade/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/command/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/memento/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/observer/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/state/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/*.java
+ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/*.java
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java
new file mode 100644
index 000000000..669aa042d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java
@@ -0,0 +1,64 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JButton;
+
+/**
+ * Defines the interface for creating products. The only factory methods are
+ * <code>createLabel()</code> and <code>createButton(..)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public interface ComponentFactory {
+
+ /**
+ * Creates factory-specific <code>JLabel</code> products.
+ *
+ * @return the factory-specific <code>JLabel</code>
+ */
+
+ public JLabel createLabel();
+
+ /**
+ * Creates factory-specific <code>JButton</code> products.
+ *
+ * @return the factory-specific <code>JButton</code>
+ */
+
+ public JButton createButton(String label);
+
+
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java
new file mode 100644
index 000000000..4a983c8c7
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JButton;
+
+/**
+ * Illustrates AspectJ's inter-type declarations: a default implementation
+ * of the two factory methods declared in the <code>AbstractFactory</code>
+ * interface is provided here.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public aspect ComponentFactoryImplementation {
+
+ /**
+ * Provides a default implementation for all <code>ComponentFactories
+ * </code> for the <code>createLabel()</code> method.
+ *
+ * @return a regular <code>JLabel</code>
+ */
+
+ public JLabel ComponentFactory.createLabel() {
+ return new JLabel("This Label was created by " +getName());
+ }
+
+ /**
+ * Provides a default implementation for all <code>ComponentFactories
+ * </code> for the <code>createButton()</code> method.
+ *
+ * @param a label for the new <code>JButton</code>
+ * @return a regular <code>JButton</code>
+ */
+
+ public JButton ComponentFactory.createButton(String label) {
+ return new JButton(label);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java
new file mode 100644
index 000000000..2575cf817
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java
@@ -0,0 +1,103 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JButton;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Sets up and displays a new GUI given a concrete factory.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public class Display extends JFrame {
+
+ /**
+ * Sets up the frame with a label and a button created by the respective
+ * <i>ConcreteFactory</i>. Both button and frame receive their appropriate
+ * listeners to close the frame when either the button is clicked or
+ * the frame is closing.
+ *
+ * @param factory the concrete factory to use for creating GUI elements
+ */
+
+ Display(ComponentFactory factory) {
+ super("New GUI");
+ JLabel label = factory.createLabel();
+ JButton button = factory.createButton("OK");
+ button.addActionListener(new myActionListener(this));
+ JPanel panel = new JPanel();
+ panel.add(label);
+ panel.add(button);
+ this.getContentPane().add(panel);
+ this.pack();
+ this.setVisible(true);
+ this.addWindowListener(new myWindowListener(this));
+ }
+
+ /**
+ * Adds a window listener that closes the frame on demand
+ */
+
+ private class myWindowListener extends WindowAdapter {
+
+ Display display = null;
+
+ protected myWindowListener(Display display) {
+ super();
+ this.display = display;
+ }
+
+ public void windowClosing(WindowEvent e) {
+ display.setVisible(false);
+ }
+ }
+
+ /**
+ * Adds a button listener that closes the frame on demand
+ */
+
+ private class myActionListener implements ActionListener {
+
+ Display display;
+
+ protected myActionListener(Display display) {
+ super();
+ this.display = display;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ display.setVisible(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java
new file mode 100644
index 000000000..2666d1754
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java
@@ -0,0 +1,84 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+
+import javax.swing.JLabel;
+import javax.swing.border.Border;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+
+/**
+ * This <i>Concrete Factory</i> implements the <code>ComcreteFactory</code>
+ * interface to provide framed Swing GUI components.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public class FramedFactory implements ComponentFactory {
+
+ /**
+ * Factroy method to create framed <code>JLabel</code> objects.
+ *
+ * @return the framed <code>JLabel</code>
+ */
+
+
+ public JLabel createLabel() {
+ JLabel label = new JLabel("This Label was created by " + getName());
+ Border raisedbevel = BorderFactory.createRaisedBevelBorder();
+ Border loweredbevel = BorderFactory.createLoweredBevelBorder();
+ label.setBorder(BorderFactory.createCompoundBorder(
+ raisedbevel, loweredbevel));
+
+ return label;
+ }
+
+ /**
+ * Factory method to create framed <code>JButton</code> objects.
+ *
+ * @param the label for the new <code>JButton</code>
+ * @return the framed <code>JButton</code>
+ */
+
+ public JButton createButton(String label) {
+ JButton button = new JButton(label);
+ Border raisedbevel = BorderFactory.createRaisedBevelBorder();
+ Border loweredbevel = BorderFactory.createLoweredBevelBorder();
+ button.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel));
+ return button;
+ }
+
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName() {
+ return "Framed Factory";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java
new file mode 100644
index 000000000..8cff6d26d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java
@@ -0,0 +1,158 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JRadioButton;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.ButtonGroup;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+
+/**
+ * Implements a driver for the Abstract Factory design pattern example.
+ * The pattern intent is:
+ * <blockquote>
+ * Provide an interface for creating families of related or dependent objects
+ * without specifying their concrete classes.
+ * </blockquote>
+ *
+ * As an example scenario, our abstract factory interface defines two
+ * factory methods, <code>createLabel()</code> and
+ * <code>createButton()</code>, that create related products
+ * (here: Swing GUI elements).
+ *
+ * The driver is a GUI that allows the user to choose between the two
+ * concrete factories (<code>RegularFactory</code> and <code>FramedFactory
+ * </code>), and creates a new GUI with elements from the respective factory.
+ * <p>
+ *
+ * <code>RegularFactory</code> creates standard Swing GUI elements, while
+ * <code>FramedFactory</code> produces elements which are framed.
+ *
+ * <P><i>This is the AspectJ implementation. </i><p>
+ *
+ * We decided to implement <code>AbstractFactory</code> as an interace,
+ * not an abstract class. In the AspectJ solution, we can still define
+ * default implementations for the interface methods. This approach uses
+ * AspectJ's inter-type declaration mechanism.
+ *
+ * To illustrate this, the aspect <code>AbstratFactoryEnhancement</code>
+ * attaches a default implementation of both factory methods to all
+ * classes that implement the <code>AbstractFactory</code> interface.
+ * This default implementation creates regular Swing elements and is
+ * used by <code>RegularFactory</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+public class Main
+{
+ /**
+ * a concrete factory that creates regular GUI components
+ */
+
+ private static ComponentFactory factory1 = new RegularFactory();
+
+ /**
+ * a concrete factory that creates framed GUI components
+ */
+
+ private static ComponentFactory factory2 = new FramedFactory();
+
+ /**
+ * stores the currently selected factory
+ */
+
+ private static ComponentFactory factory = factory1;
+
+
+ /**
+ * Creates the initial GUI that allows the user to choose a factory
+ * and generate a new GUI with the elements that the respective
+ * factory provides.
+ *
+ * @return a <code>JPanel</code> containing the GUI
+ */
+
+ private static JPanel createGUI()
+ {
+ ActionListener radioListener = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("factory1")) factory = factory1;
+ else factory = factory2;
+ }
+ };
+
+ JPanel panel = new JPanel();
+ JRadioButton factoryButton1 = new JRadioButton("use Factory 1");
+ JRadioButton factoryButton2 = new JRadioButton("use Factory 2");
+ factoryButton1.setActionCommand("factory1");
+ factoryButton2.setActionCommand("factory2");
+ factoryButton1.addActionListener(radioListener);
+ factoryButton2.addActionListener(radioListener);
+ JButton create = new JButton("Create GUI");
+
+ ButtonGroup choices = new ButtonGroup();
+
+ choices.add(factoryButton1);
+ choices.add(factoryButton2);
+
+ create.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ Display display = new Display(factory);
+ }
+ });
+
+ panel.add(factoryButton1);
+ panel.add(factoryButton2);
+ panel.add(create);
+
+ return panel;
+ }
+
+ /**
+ * Implements the driver for this design pattern example. It sets up
+ * the initial GUI.
+ */
+
+ public static void main(String[] args)
+ {
+ JFrame frame = new JFrame("Abstract Factory Demo");
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ frame.getContentPane().add(createGUI());
+
+ frame.pack();
+ frame.setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java
new file mode 100644
index 000000000..573f89571
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java
@@ -0,0 +1,58 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code please see
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JButton;
+
+/**
+ * This <i>Concrete Factory</i> implements the
+ * <code>AbstractFactory</code> interface to provide
+ * regular Swing GUI components.
+ *
+ * The factroy methods <code>createLabel()</code> and <create>Button()</code>
+ * do not need to be defined here, they recieve their implementation from
+ * the inter-type declarations in aspect
+ * <code>AbstractFactroyEnhancement</code>.
+ *
+ * This is done so that future concrete factories can reuse the
+ * implementations of the factory methods and will only have to specify those
+ * that differ from the default ones.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+public class RegularFactory implements ComponentFactory {
+
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName() {
+ return ("Regular Factory");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java
new file mode 100644
index 000000000..ea2036430
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JButton;
+
+/**
+ * Defines the interface for creating products. The only factory methods are
+ * <code>createLabel()</code> and <code>createButton(..)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+public interface ComponentFactory {
+
+ /**
+ * Creates factory-specific <code>JLabel</code> products.
+ *
+ * @return the factory-specific <code>JLabel</code>
+ */
+
+ public JLabel createLabel();
+
+ /**
+ * Creates factory-specific <code>JButton</code> products.
+ *
+ * @return the factory-specific <code>JButton</code>
+ */
+
+ public JButton createButton(String label);
+
+
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java
new file mode 100644
index 000000000..40e2b5b48
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java
@@ -0,0 +1,102 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JButton;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Sets up and displays a new GUI given a concrete factory.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+public class Display extends JFrame {
+
+ /**
+ * Sets up the frame with a label and a button created by the respective
+ * concrete factories. Both button and frame receive their appropriate
+ * listeners to close the frame when either the button is clicked or
+ * the frame is closing.
+ *
+ * @param factory the factory to create GUI elements
+ */
+
+ public Display(ComponentFactory factory) {
+ super("New GUI");
+ JLabel label = factory.createLabel();
+ JButton button = factory.createButton("OK");
+ button.addActionListener(new myActionListener(this));
+ JPanel panel = new JPanel();
+ panel.add(label);
+ panel.add(button);
+ this.getContentPane().add(panel);
+ this.pack();
+ this.setVisible(true);
+ this.addWindowListener(new myWindowListener(this));
+ }
+
+ /**
+ * Adds a window listener that closes the frame on demand
+ */
+
+ private class myWindowListener extends WindowAdapter {
+
+ Display display = null;
+
+ protected myWindowListener(Display display) {
+ super();
+ this.display = display;
+ }
+
+ public void windowClosing(WindowEvent e) {
+ display.setVisible(false);
+ }
+ }
+
+ /**
+ * Adds a button listener that closes the frame on demand
+ */
+
+ private class myActionListener implements ActionListener {
+
+ Display display;
+
+ protected myActionListener(Display display) {
+ super();
+ this.display = display;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ display.setVisible(false);
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java
new file mode 100644
index 000000000..0a2f5b4b8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.border.Border;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+
+/**
+ * This <i>Concrete Factory</i> implements the
+ * <code>ComponentFactory</code> interface to provide
+ * framed Swing GUI components.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public class FramedFactory implements ComponentFactory {
+
+ /**
+ * Factory method to create framed <code>JLabel</code> objects.
+ *
+ * @return the framed <code>JLabel</code>
+ */
+
+
+ public JLabel createLabel() {
+ JLabel label = new JLabel("This Label was created by " +getName());
+ Border raisedbevel = BorderFactory.createRaisedBevelBorder();
+ Border loweredbevel = BorderFactory.createLoweredBevelBorder();
+ label.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel));
+
+ return label;
+ }
+
+ /**
+ * Factory method to create framed <code>JButton</code> objects.
+ *
+ * @param the label for the new <code>JButton</code>
+ * @return the framed <code>JButton</code>
+ */
+
+ public JButton createButton(String label) {
+ JButton button = new JButton(label);
+ Border raisedbevel = BorderFactory.createRaisedBevelBorder();
+ Border loweredbevel = BorderFactory.createLoweredBevelBorder();
+ button.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel));
+ return button;
+ }
+
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName() {
+ return "Framed Factory";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java
new file mode 100644
index 000000000..001e36a25
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java
@@ -0,0 +1,155 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code please see
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JRadioButton;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.ButtonGroup;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+
+/**
+ * Implements the driver for the Abstract Factory design pattern example.<p>
+ *
+ * Intent: <i>Provide an interface for creating families of related or
+ * dependent objects without specifying their concrete classes.</i><p>
+ *
+ * As an example scenario, our abstract factory interface defines two
+ * factory methods <code>createLabel()</code> and <code>createButton()</code>
+ * that create related products (Swing GUI elements).
+ *
+ * The driver is a swing GUI that allows the user to choose between the two
+ * concrete factories <code>RegularFactory</code> and <code>FramedFactory
+ * </code>, and creates a new GUI with elements from the respective factory.
+ * <p>
+ *
+ * <code>RegularFactory</code> creates standard Swing GUI elements, while
+ * <code>FramedFactory</code> produces elements which are framed.
+ *
+ * <P><i>This is the Java implementation. </i><p>
+ *
+ * We decided to implement <code>AbstractFactory</code> as an interace,
+ * not an abstract class. This has the following advantages and liabilities:
+ * <UL>
+ * <LI> Concrete factories do not need to be subclasses of the abstract
+ * factory. That way existing classes can be subclassed and just have
+ * to implement the interface methods. This can be more flexible if
+ * we want an existing class to become a factory (e.g. because we
+ * want to make use of its functionality.
+ * <LI> By defining the abstract factory as an interface we cannot attach
+ * any (default) implementations to its methods, nor is it possible
+ * to include fields (such as the <code>name</code> field in this
+ * example.
+ * </UL>
+ *
+ */
+
+public class Main
+{
+ /**
+ * a concrete factory that creates regular GUI components
+ */
+
+ private static ComponentFactory factory1 = new RegularFactory();
+
+ /**
+ * a concrete factory that creates framed GUI components
+ */
+
+ private static ComponentFactory factory2 = new FramedFactory();
+
+ /**
+ * stores the currently selected factory
+ */
+
+ private static ComponentFactory factory = factory1;
+
+
+ /**
+ * Creates the initial GUI that allows the user to choose a factory
+ * and generate a new GUI with the elements that the respective
+ * factory provides.
+ *
+ * @return a <code>JPanel</code> containing the GUI
+ */
+
+ private static JPanel createGUI()
+ {
+ ActionListener radioListener = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("factory1")) factory = factory1;
+ else factory = factory2;
+ }
+ };
+
+ JPanel panel = new JPanel();
+ JRadioButton factoryButton1 = new JRadioButton("use Factory 1");
+ JRadioButton factoryButton2 = new JRadioButton("use Factory 2");
+ factoryButton1.setActionCommand("factory1");
+ factoryButton2.setActionCommand("factory2");
+ factoryButton1.addActionListener(radioListener);
+ factoryButton2.addActionListener(radioListener);
+ JButton create = new JButton("Create GUI");
+
+ ButtonGroup choices = new ButtonGroup();
+
+ choices.add(factoryButton1);
+ choices.add(factoryButton2);
+
+ create.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ Display display = new Display(factory);
+ }
+ });
+
+ panel.add(factoryButton1);
+ panel.add(factoryButton2);
+ panel.add(create);
+
+ return panel;
+ }
+
+ /**
+ * Implements the driver for this design pattern example. It sets up
+ * the initial GUI.
+ */
+
+ public static void main(String[] args)
+ {
+ JFrame frame = new JFrame("Abstract Factory Demo");
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ frame.getContentPane().add(createGUI());
+
+ frame.pack();
+ frame.setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java
new file mode 100644
index 000000000..b6aa6376e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java
@@ -0,0 +1,70 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code please see
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JButton;
+
+/**
+ * This <i>Concrete Factory</i> implements the <code>ComponentFactory</code>
+ * interface to provide regular Swing GUI components.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/20/04
+ *
+ */
+
+public class RegularFactory implements ComponentFactory {
+
+ /**
+ * Factroy method to create regular <code>JLabel</code> objects.
+ *
+ * @return the regular <code>JLabel</code>
+ */
+
+ public JLabel createLabel() {
+ return new JLabel("This Label was created by " +getName());
+ }
+
+ /**
+ * Factory method to create regular <code>JButton</code> objects.
+ *
+ * @param the label for the new <code>JButton</code>
+ * @return the regular <code>JButton</code>
+ */
+
+ public JButton createButton(String label) {
+ return new JButton(label);
+ }
+ /**
+ * Returns the name of the factory.
+ *
+ * @return the name of the factory
+ */
+
+ public String getName() {
+ return ("Regular Factory");
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java
new file mode 100644
index 000000000..3ffc6a083
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java
@@ -0,0 +1,89 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Adapter design pattern example. <p>
+ *
+ * Intent: <i> Convert the interface of a class into another interface clients
+ * expect. Adapter lets classes work together that couldn't otherwise because
+ * incompatible interfaces.</i><p>
+ *
+ * Experimental setup: anloguous to the pattern structure as described on page
+ * 141 of the "Design Patterns" book:
+ *
+ * <code>Adaptee</code> can print strings to <code>System.out</code>.
+ * <code>Adapter</code> allows to access <code>Adaptee</code>'s functionality
+ * via <code>Target</code>'s interface.<p>
+ *
+ * <i>This is the AspectJ implementation.</i><p>
+ *
+ * The implementation is that of an <i>object adapter</i> (NOT class adapter),
+ * as the latter requires multiple inheritance which Java does not provide.
+ *
+ * In this implementation, the <i>Adaptee</i> is effectively made to conform
+ * with the <i>Target</i> interface directly. <code>Adapter</code> is an
+ * aspect that ensures that by using the <code>declare parents</code>
+ * construct (to ensure <i>Adaptee</i> is of type <i>Target</i>) and an
+ * inter-type declaration of the missing interface method.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Target
+ * @see Adaptee
+ * @see Adapter
+ */
+
+public class Main {
+
+ /**
+ * the Adaptee in the scenario. Note that our adaptee can be used as a
+ * Writer because of the <code>declare parents</code> statement in the
+ * aspect.
+ */
+
+ private static Writer adaptee;
+
+ /**
+ * Implements the driver.
+ *
+ * In this implementation, the <i>Adaptee</i> becomes its own
+ * <i>Adapter</i>, so only one variable is needed.
+ *
+ * @param args required for a main method, but ignored
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Creating Adaptee (which is its own Adapter)...");
+ adaptee = new SystemOutPrinter();
+
+ System.out.print ("Adapter and Adaptee are the same object: ");
+ System.out.println(adaptee == adaptee);
+
+ System.out.println("Issuing the request() to the Adapter...");
+ adaptee.write("Test successful.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java
new file mode 100644
index 000000000..86360ec43
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java
@@ -0,0 +1,62 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Adapts <code>SystemOutPrinter</code> to match the <code>Writer</code>
+ * interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Target
+ * @see Adaptee
+ */
+
+public aspect PrinterAdapter {
+
+ /**
+ * Ensures that <code>SystemOutPrinter</code> implements <code>Writer
+ * </code>. This means that the <i>Adaptee</i> effectively becomes its
+ * own <i>Adapter</i>.
+ */
+
+ declare parents: SystemOutPrinter implements Writer;
+
+ /**
+ * Defines a <code>write(String)</code> method on <code>Adaptee</code>
+ * to ensure compliance with the <i>Writer</i> interface.
+ *
+ * On the pattern level, this means that <i>Adaptee</i> now implements
+ * <i>request()</i>.
+ *
+ * @param s the string to print
+ * @see Writer#write(String)
+ * @see SystemOutPrinter#printToSystemOut(String)
+ */
+
+ public void SystemOutPrinter.write(String s) {
+ printToSystemOut(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java
new file mode 100644
index 000000000..abe34d6e8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java
@@ -0,0 +1,58 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Provides a specialized print method. Acts as the <i>Adaptee</i> in the
+ * pattern context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+/**
+ * Provides a specialized print method. Acts as the <i>Adaptee</i> in the
+ * pattern context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class SystemOutPrinter {
+
+ /**
+ * Prints the argument string to <code>System.out</code>. In the pattern
+ * context, this is the <i>specificRequest()</i> method on
+ * the <i>Adaptee</i>.
+ *
+ * @param s the string to be printed
+ * @see Writer#write(String) the adapted method
+ */
+
+
+ public void printToSystemOut(String s) {
+ System.out.println(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java
new file mode 100644
index 000000000..bd1ad3f4b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the target interface with a general output method. Acts as the
+ * <i>Target</i> in the pattern context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public interface Writer {
+
+ /**
+ * Prints the argument string. In the pattern context, this is the
+ * <i>request()</i> method on the <i>Target</i>.
+ *
+ * @param s the string to print
+ * @see PrinterAdapter
+ */
+
+ public void write(String s);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java
new file mode 100644
index 000000000..b7e01fd30
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java
@@ -0,0 +1,92 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.patterns.
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Adapter design pattern example. <p>
+ *
+ * Intent: <i> Convert the interface of a class into another interface clients
+ * expect. Adapter lets classes work together that couldn't otherwise because
+ * incompatible interfaces.</i><p>
+ *
+ * Experimental setup: anloguous to the pattern structure as described on page
+ * 141 of the "Design Patterns" book:
+ *
+ * <code>Adaptee</code> can print strings to <code>System.out</code>.
+ * <code>Adapter</code> allows to access <code>Adaptee</code>'s functionality
+ * via <code>Target</code>'s interface.<p>
+ *
+ * <i>This is the Java implementation.</i><p>
+ *
+ * Participants and their roles: <ul>
+ * <LI> Main (Client)
+ * <LI> Writer (Target)
+ * <LI> SystemOutPrinter (Adaptee)
+ * <LI> PrinterAdapter (Adapter)
+ * </ul>
+ *
+ * The implementation is that of an <i>object adapter</i> (NOT class adapter),
+ * as the latter requires multiple inheritance which Java does not provide.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Adapter
+ * @see Adaptee
+ * @see Target
+ */
+
+public class Main {
+
+ /**
+ * the Target in the scenario
+ */
+
+ private static Writer myTarget;
+
+ /**
+ * the Adaptee in the scenario
+ */
+
+ private static SystemOutPrinter adaptee;
+
+ /**
+ * Implements the driver.
+ *
+ * @param args required for a main method, but ignored
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Creating the Adaptee...");
+ adaptee = new SystemOutPrinter();
+
+ System.out.println("Creating the Adapter...");
+ myTarget = new PrinterAdapter(adaptee);
+
+ System.out.print ("Adapter and Adaptee are the same object: ");
+ System.out.println(myTarget.equals(adaptee));
+
+ System.out.println("Issuing the request() to the Adapter...");
+ myTarget.write("Test successful.");
+
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java
new file mode 100644
index 000000000..bcc5196fd
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java
@@ -0,0 +1,73 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Represents an <i>Object Adapter</i>. Implements the <i>Target</i> interface
+ * and stores a private variable of type <i>Adaptee</i> (here: <code>
+ * SystemOutWriter</code>) to which it forwards appropriate method calls. <p>
+ *
+ * It is not possible to use a class adapter in Java as it requires multiple
+ * inheritance.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Writer
+ * @see SystemOutPrinter
+ */
+
+public class PrinterAdapter implements Writer {
+
+ /**
+ * the adaptee to forward appropriate messages to.
+ */
+
+ private SystemOutPrinter adaptee = null;
+
+
+ /**
+ * Creates a new Adapter for a given Adaptee.
+ *
+ * @param screen the screen to adapt
+ */
+
+ public PrinterAdapter(SystemOutPrinter adaptee) {
+ this.adaptee = adaptee;
+ }
+
+ /**
+ * Implements the <i>Target</i> interface. This is where the actual
+ * adaption happens: calls to write(String) trigger calls
+ * to printToSystemOut(String) on the adaptee.
+ *
+ * @param s the string to print
+ * @see Writer#write(String)
+ * @see SystemOutPrinter#printToSystemOut(String)
+ */
+
+ public void write(String s) {
+ adaptee.printToSystemOut(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java
new file mode 100644
index 000000000..023ab46db
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java
@@ -0,0 +1,49 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Provides a specialized print method. Acts as the <i>Adaptee</i> in the
+ * pattern context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class SystemOutPrinter {
+
+ /**
+ * Prints the argument string to <code>System.out</code>. In the pattern
+ * context, this is the <i>specificRequest()</i> method on
+ * the <i>Adaptee</i>.
+ *
+ * @param s the string to be printed
+ * @see Writer#write(String) the adapted method
+ */
+
+
+ public void printToSystemOut(String s) {
+ System.out.println(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java
new file mode 100644
index 000000000..63f0e0978
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the target interface with a general output method. Acts as the
+ * <i>Target</i> in the pattern context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public interface Writer {
+
+ /**
+ * Prints the argument string. In the pattern context, this is the
+ * <i>request()</i> method on the <i>Target</i>.
+ *
+ * @param s the string to print
+ * @see PrinterAdapter
+ */
+
+ public void write(String s);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java
new file mode 100644
index 000000000..35f47ca16
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java
@@ -0,0 +1,96 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Represents the <i>Abstraction</i> in the scenario. <code>Screen</code>
+ * provides two methods to draw/print: <code>drawText(String)</code> and
+ * <code>drawTextBox(String)</code>. The method implementations are provided
+ * by this aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public aspect AbstractionImplementation {
+
+ /**
+ * stores the actual <i>Implementor</i> to use
+ */
+
+ private ScreenImplementation Screen.implementor;
+
+ /**
+ * Draws or prints a text to an output device determined by the
+ * current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void Screen.drawText(String text) {
+ implementor.printText(text);
+ implementor.printLine();
+ }
+
+ /**
+ * Draws or prints a text in a box to an output device determined
+ * by the current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void Screen.drawTextBox(String text) {
+
+ int length = text.length();
+
+ for(int i=0; i<length+4; i++) {
+ implementor.printDecor();
+ }
+
+ implementor.printLine();
+ implementor.printDecor();
+ implementor.printText(" "+text+" ");
+ implementor.printDecor();
+ implementor.printLine();
+
+ for(int i=0; i<length+4; i++) {
+ implementor.printDecor();
+ }
+
+ implementor.printLine();
+ }
+
+ /**
+ * Sets the current <i>Implementor</i>.
+ *
+ * @param implementor The new implementor
+ */
+
+ public void Screen.setImplementor(ScreenImplementation implementor) {
+ this.implementor = implementor;
+ }
+
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java
new file mode 100644
index 000000000..99088ed25
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java
@@ -0,0 +1,64 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints capitalized text and uses the double cross ("#") to decorate.
+ * Represents a <i>ConcreteImplementation</i> in the context of the Bridge
+ * design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class CrossCapitalImplementation implements ScreenImplementation {
+
+
+ /**
+ * Does a line feed (to <code>System.out</code>).
+ */
+
+ public void printLine() {
+ System.out.println();
+ }
+
+ /**
+ * Prints a double cross ("#") to <code>System.out</code>.
+ */
+
+ public void printDecor() {
+ System.out.print("X");
+ }
+
+ /**
+ * Prints the argument text in capitals to <code>System.out</code>.
+ *
+ * @param text the text to print
+ */
+
+ public void printText(String text) {
+ System.out.print(text.toUpperCase());
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java
new file mode 100644
index 000000000..4fb5fbc4a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java
@@ -0,0 +1,57 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints/draws a greeting in a text box. Represents a <i>RefinedAbstraction
+ * </i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class GreetingScreen implements Screen {
+
+ /**
+ * Creates a new <code>GreetingScreen</code> object with the provided
+ * <i>Implementor</i>.
+ *
+ * @param si the implementor to use
+ */
+
+ public GreetingScreen(ScreenImplementation si) {
+ setImplementor(si);
+ }
+
+ /**
+ * Draws/prints a greeting in a text box
+ */
+
+ public void drawGreeting() {
+ drawTextBox("Greetings!");
+ }
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java
new file mode 100644
index 000000000..3a4eed280
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints/draws the current system time in a text box. Represents a
+ * <i>RefinedAbstraction</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+import java.util.Date;
+
+public class InformationScreen implements Screen {
+
+
+ /**
+ * Creates a new <code>InformationScreen</code> object with the provided
+ * <i>Implementor</i>.
+ *
+ * @param si the implementor to use
+ */
+
+ public InformationScreen(ScreenImplementation si) {
+ setImplementor(si);
+ }
+
+
+ /**
+ * Draws/prints the system time in a text box
+ */
+
+ public void drawInfo() {
+ Date date = new Date();
+ drawTextBox("Current system time: "+date);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java
new file mode 100644
index 000000000..3c4a97e26
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java
@@ -0,0 +1,110 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Bridge design pattern example. <p>
+ *
+ * Intent: <i> Decouple an abstraction from its implementation so that the
+ * two can vary independently.</i><p>
+ *
+ * Scenario: Have seperate hierarchies for Abstractions (here: Screens)
+ * and Implementors (here: ScreenImplementation), so that both
+ * can change independently of each other
+ *
+ * Participants: <UL>
+ *
+ * <LI> <code>Screen</code> - <i>Abstraction</i> that defines
+ * an interface for printing text and boxedText to stdout.
+ * <LI> <code>GreetingScreen</code> - <i>RefinedAbstraction</i> that prints
+ * a boxed greeting message
+ * <LI> <code>InformationScreen</code> - <i>RefinedAbstraction</i> that prints
+ * the system time (boxed)
+ * <LI> <code>ScreenImplementation</code> - <i>Implementor</i> interface,
+ * defines basic operations to output formatted strings
+ * <LI> <code>StarImplementation</code> - <i>ConcreteImplementation</i> that
+ * creates textBoxes of stars
+ * <LI> <code>CrossCapitalImplementation</code> - <i>ConcreteImplementation
+ * </i> that creates textBoxes of double crosses (hashes) and prints all
+ * text capitalized
+ * <LI> <code>AbstractionImplementation</code> - An aspect that defines
+ * the implementation of the methods of the <i>Abstraction</i>
+ * </UL><p>
+ *
+ * <i>This is the AspectJ implementation.</i><p>
+ *
+ * The implementations for methods on the <i>Abstraction</i> are declared
+ * in the <code>AbstractImplementation</code> aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Screen
+ * @see InformationScreen
+ * @see GreetingScreen
+ * @see ScreenImplementation
+ * @see StarImplementation
+ * @see CrossCapitalImplementation
+ * @see AbstractionImplementation
+ */
+
+
+public class Main {
+
+ /**
+ * Implements the driver for this example. The two different screens
+ * and screen implementations are tested in all possible combinations.
+ *
+ * @param args required by Java, but ignored
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Creating implementations...");
+
+ ScreenImplementation i1 = new StarImplementation();
+ ScreenImplementation i2 = new CrossCapitalImplementation();
+
+ System.out.println("Creating abstraction (screens) / implementation combinations...");
+
+ GreetingScreen gs1 = new GreetingScreen(i1);
+ GreetingScreen gs2 = new GreetingScreen(i2);
+ InformationScreen is1 = new InformationScreen(i1);
+ InformationScreen is2 = new InformationScreen(i2);
+
+ System.out.println("Starting test:\n");
+
+ gs1.drawText("\nScreen 1 (Refined Abstraction 1, Implementation 1):");
+ gs1.drawGreeting();
+
+ gs2.drawText("\nScreen 2 (Refined Abstraction 1, Implementation 2):");
+ gs2.drawGreeting();
+
+ is1.drawText("\nScreen 3 (Refined Abstraction 2, Implementation 1):");
+ is1.drawInfo();
+
+ is2.drawText("\nScreen 4 (Refined Abstraction 2, Implementation 2):");
+ is2.drawInfo();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java
new file mode 100644
index 000000000..67f0a34ff
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java
@@ -0,0 +1,58 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+
+/**
+ * Represents the <i>Abstraction</i> in the scenario. <code>Screen</code>
+ * provides two methods to draw/print: <code>drawText(String)</code> and
+ * <code>drawTextBox(String)</code>. The method implementations are provided
+ * by an aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public interface Screen {
+
+ /**
+ * Draws or prints a text to an output device determined by the
+ * current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void drawText(String text);
+
+ /**
+ * Draws or prints a text in a box to an output device determined
+ * by the current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void drawTextBox(String text);
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java
new file mode 100644
index 000000000..050912c6f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints lines, decorators and text. Represents a
+ * <i>Implementor</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public interface ScreenImplementation {
+
+ /**
+ * Prints a line feed.
+ */
+
+ void printLine();
+
+ /**
+ * Prints a decorator symbol (a string of length 1).
+ */
+
+ void printDecor();
+
+ /**
+ * Prints the argument text.
+ *
+ * @param text the text to print
+ */
+
+ void printText(String text);
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java
new file mode 100644
index 000000000..eddcdebee
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java
@@ -0,0 +1,62 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints regular text and uses the star ("*") to decorate. Represents a
+ * <i>ConcreteImplementation</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class StarImplementation implements ScreenImplementation {
+
+ /**
+ * Does a line feed (to <code>System.out</code>).
+ */
+
+ public void printLine() {
+ System.out.println();
+ }
+
+ /**
+ * Prints a star ("*") to <code>System.out</code>.
+ */
+
+ public void printDecor() {
+ System.out.print("*");
+ }
+
+ /**
+ * Prints the argument text to <code>System.out</code>.
+ *
+ * @param text the text to print
+ */
+
+ public void printText(String text) {
+ System.out.print(text);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java
new file mode 100644
index 000000000..32456bda8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java
@@ -0,0 +1,64 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints capitalized text and uses double crosses ("#") to decorate.
+ * Represents a <i>ConcreteImplementation</i> in the context of the Bridge
+ * design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class CrossCapitalImplementation implements ScreenImplementation {
+
+
+ /**
+ * Does a line feed (to <code>System.out</code>).
+ */
+
+ public void printLine() {
+ System.out.println();
+ }
+
+ /**
+ * Prints a double cross ("#") to <code>System.out</code>.
+ */
+
+ public void printDecor() {
+ System.out.print("X");
+ }
+
+ /**
+ * Prints the argument text in capitals to <code>System.out</code>.
+ *
+ * @param text the text to print
+ */
+
+ public void printText(String text) {
+ System.out.print(text.toUpperCase());
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java
new file mode 100644
index 000000000..5ce3507a2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java
@@ -0,0 +1,57 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints/draws a greeting in a text box. Represents a <i>RefinedAbstraction
+ * </i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class GreetingScreen extends Screen {
+
+ /**
+ * Creates a new <code>GreetingScreen</code> object with the provided
+ * <i>Implementor</i>.
+ *
+ * @param si the implementor to use
+ */
+
+ public GreetingScreen(ScreenImplementation si) {
+ super(si);
+ }
+
+ /**
+ * Draws/prints a greeting in a text box
+ */
+
+ public void drawGreeting() {
+ drawTextBox("Greetings!");
+ }
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java
new file mode 100644
index 000000000..a15b6f562
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java
@@ -0,0 +1,62 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+
+/**
+ * Prints/draws the current system time in a text box. Represents a
+ * <i>RefinedAbstraction</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+import java.util.Date;
+
+public class InformationScreen extends Screen {
+
+
+ /**
+ * Creates a new <code>InformationScreen</code> object with the provided
+ * <i>Implementor</i>.
+ *
+ * @param si the implementor to use
+ */
+
+ public InformationScreen(ScreenImplementation si) {
+ super(si);
+ }
+
+
+ /**
+ * Draws/prints the system time in a text box
+ */
+
+ public void drawInfo() {
+ Date date = new Date();
+ drawTextBox("Current system time: "+date);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java
new file mode 100644
index 000000000..a058cffb7
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java
@@ -0,0 +1,110 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Bridge design pattern example. <p>
+ *
+ * Intent: <i> Decouple an abstraction from its implementation so that the
+ * two can vary independently.</i><p>
+ *
+ * Scenario: Have seperate hierarchies for Abstractions (here: Screens)
+ * and Implementors (here: ScreenImplementation), so that both
+ * can change independently of each other
+ *
+ * Participants: <UL>
+ *
+ * <LI> <code>Screen</code> - <i>Abstraction</i> that defines
+ * an interface for printing text and boxedText to System.out.
+ * <LI> <code>GreetingScreen</code> - <i>RefinedAbstraction</i> that prints
+ * a boxed greeting message
+ * <LI> <code>InformationScreen</code> - <i>RefinedAbstraction</i> that prints
+ * the system time (boxed)
+ * <LI> <code>ScreenImplementation</code> - <i>Implementor</i> interface,
+ * defines basic operations to output formatted strings
+ * <LI> <code>StarImplementation</code> - <i>ConcreteImplementation</i> that
+ * creates textBoxes of stars
+ * <LI> <code>CrossCapitalImplementation</code> - <i>ConcreteImplementation
+ * </i> that creates textBoxes of double crosses (hashes) and prints all
+ * text capitalized
+ * </UL><p>
+ *
+ * <i>This is the Java implementation.</i><p>
+ *
+ * Note that <i>Abstraction</i> cannot be an interface in Java, as we need to
+ * specify how <i>operation()</i> is performed using the interface of
+ * <i>Implementor</i>. As <i>Abstraction</i> is not necessarily a defining
+ * role, this is a limitation. With multiple inheritance, this would not be
+ * the case.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Screen
+ * @see InformationScreen
+ * @see GreetingScreen
+ * @see ScreenImplementation
+ * @see StarImplementation
+ * @see CrossCapitalImplementation
+ */
+
+
+public class Main {
+
+ /**
+ * Implements the driver for this example. The two different screens
+ * and screen implementations are tested in all possible combinations.
+ *
+ * @param args required by Java, but ignored
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Creating implementations...");
+
+ ScreenImplementation i1 = new StarImplementation();
+ ScreenImplementation i2 = new CrossCapitalImplementation();
+
+ System.out.println("Creating abstraction (screens) / implementation combinations...");
+
+ GreetingScreen gs1 = new GreetingScreen(i1);
+ GreetingScreen gs2 = new GreetingScreen(i2);
+ InformationScreen is1 = new InformationScreen(i1);
+ InformationScreen is2 = new InformationScreen(i2);
+
+ System.out.println("Starting test:\n");
+
+ gs1.drawText("\nScreen 1 (Refined Abstraction 1, Implementation 1):");
+ gs1.drawGreeting();
+
+ gs2.drawText("\nScreen 2 (Refined Abstraction 1, Implementation 2):");
+ gs2.drawGreeting();
+
+ is1.drawText("\nScreen 3 (Refined Abstraction 2, Implementation 1):");
+ is1.drawInfo();
+
+ is2.drawText("\nScreen 4 (Refined Abstraction 2, Implementation 2):");
+ is2.drawInfo();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java
new file mode 100644
index 000000000..5fbed961d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java
@@ -0,0 +1,103 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+
+/**
+ * Represents the <i>Abstraction</i> in the scenario. <code>Screen</code>
+ * provides two methods to draw/print: <code>drawText(String)</code> and
+ * <code>drawTextBox(String)</code>. Both methods call appropriate methods
+ * on the <code>ScreenImplementor</code> of this <code>Screen</code> object.
+ *
+ * Note that cannot be an interface, since it has implementation
+ * associated with it (otherwise it would require multiple inheritance).
+ * This restricts the flexibility of the patter somewhat as all
+ * <i>RefinedAbstractions</i> consequently can not have additional
+ * superclasses.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public abstract class Screen {
+
+ /**
+ * stores the actual <i>Implementor</i> to use
+ */
+
+ private ScreenImplementation implementor;
+
+ /**
+ * Creates a new <code>Screen</code> object given an <i>Implementor</i>
+ *
+ * @param implementor the implementor to use for calls to
+ * <i>operationImpl()</i>
+ */
+
+ public Screen(ScreenImplementation implementor) {
+ this.implementor = implementor;
+ }
+
+ /**
+ * Draws or prints a text to an output device determined by the
+ * current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void drawText(String text) {
+ implementor.printText(text);
+ implementor.printLine();
+ }
+
+ /**
+ * Draws or prints a text in a box to an output device determined
+ * by the current <i>Implementor</i>.
+ *
+ * @param text The text to be drawn/printed
+ */
+
+ public void drawTextBox(String text) {
+
+ int length = text.length();
+
+ for(int i=0; i<length+4; i++) {
+ implementor.printDecor();
+ }
+
+ implementor.printLine();
+ implementor.printDecor();
+ implementor.printText(" "+text+" ");
+ implementor.printDecor();
+ implementor.printLine();
+
+ for(int i=0; i<length+4; i++) {
+ implementor.printDecor();
+ }
+
+ implementor.printLine();
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java
new file mode 100644
index 000000000..1ea18ffd5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares methods to print lines, decorators and text. Represents an
+ * <i>Implementor</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public interface ScreenImplementation {
+
+ /**
+ * Prints a line feed.
+ */
+
+ void printLine();
+
+ /**
+ * Prints a decorator symbol (a string of length 1).
+ */
+
+ void printDecor();
+
+ /**
+ * Prints the argument text.
+ *
+ * @param text the text to print
+ */
+
+ void printText(String text);
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java
new file mode 100644
index 000000000..87c00a36f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java
@@ -0,0 +1,62 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Prints regular text and uses stars ("*") to decorate. Represents a
+ * <i>ConcreteImplementation</i> in the context of the Bridge design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ */
+
+public class StarImplementation implements ScreenImplementation {
+
+ /**
+ * Does a line feed (to <code>System.out</code>).
+ */
+
+ public void printLine() {
+ System.out.println();
+ }
+
+ /**
+ * Prints a star ("*") to <code>System.out</code>.
+ */
+
+ public void printDecor() {
+ System.out.print("*");
+ }
+
+ /**
+ * Prints the argument text to <code>System.out</code>.
+ *
+ * @param text the text to print
+ */
+
+ public void printText(String text) {
+ System.out.print(text);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java
new file mode 100644
index 000000000..a480a78a2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java
@@ -0,0 +1,70 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>Builder</i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see TextBuilder
+ * @see StructureBuilder
+ */
+
+public interface Creator {
+
+ /**
+ * Defines the <i>buildPart()</i> operation for type parts.
+ *
+ * @param type the type to process
+ */
+
+ public abstract void processType(String type);
+
+ /**
+ * Defines the <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param type the type to process
+ */
+
+ public abstract void processAttribute(String type);
+
+ /**
+ * Defines the <i>buildPart()</i> operation for value parts.
+ *
+ * @param type the type to process
+ */
+
+ public abstract void processValue(String type);
+
+ /**
+ * Defines the <i>getResult()</i> operation for <i>Builder</i>s.
+ *
+ * @param type the type to process
+ */
+
+ public String getRepresentation();
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java
new file mode 100644
index 000000000..6a2a2638f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java
@@ -0,0 +1,76 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a concrete builder design pattern instance. This aspect allows
+ * to have the <code>Creator</code> abstract class to become an interface,
+ * without losing the possibility to declare default implementations and even
+ * variables.
+ *
+ * This also illiustrates the tradeoffs: The current version of AspectJ
+ * (1.0.4) does not allow protected introduction. To achieve the same result
+ * as in the OO case, the result variable has to be introduced as public
+ * (to be inherited). To make sure that no other classes can access that
+ * variable, we define an error here that the compiler reports when other
+ * classes try to access the result variable.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Builder
+ * @see TextBuilder
+ * @see StructureBuilder
+ */
+
+public aspect CreatorImplementation {
+
+ /**
+ * Declares the result variable on the <code>Creator</code> interface.
+ */
+
+ public String Creator.representation;
+
+ /**
+ * Declares the <i>getResult()</i> method with a default implementation
+ * to the <code>Creator</code> interface.
+ *
+ * @returns the representation string for the builder.
+ */
+
+ public String Creator.getRepresentation() {
+ return representation;
+ }
+
+ /**
+ * Declares a compiler error that gets reported if other classes
+ * (except Creators or this aspect) try to access the result variable.
+ */
+
+ declare error: (set(public String Creator+.representation)
+ || get(public String Creator+.representation))
+ && ! (within(Creator+)
+ || within(CreatorImplementation)):
+ "variable result is aspect protected. Use getResult() to access it";
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java
new file mode 100644
index 000000000..e3101e89e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java
@@ -0,0 +1,97 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Builder design pattern example.<p>
+ *
+ * Intent: <i>Separate the construction of a complex object from its
+ * representation so that the same construction process can create different
+ * representations</i><p>
+ *
+ * Participating objects are <code>TextCreator</code> and
+ * <code>XMLCreator</code> as <i>Builder</i>s that implement the
+ * <code>Creator</code> interface.<p>
+ *
+ * In this example, <code>Main</code> acts as the <i>Director</i> that
+ * uses two different builders to build string representations of a
+ * person. <code>TextCreator</code> creates a text-like representation,
+ * <code>XMLCreator</code> an XML-like one.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * The abstract class is now replaced by an interface. A concrete aspect
+ * declares the instance variable and default method implementations.
+ * This frees the participants (<i>ConcreteBuilder</i>s) to be
+ * subclasses of something else.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Builder
+ * @see TextCreator
+ * @see XMLCreator
+ */
+
+public class Main {
+
+ /**
+ * Builds a string representation of a person using a given builder.
+ *
+ * @param the builder to use.
+ */
+
+ protected static void build(Creator builder) {
+ builder.processType("Person");
+ builder.processAttribute("Name");
+ builder.processValue("James Brick");
+ builder.processAttribute("Age");
+ builder.processValue("33");
+ builder.processAttribute("Occupation");
+ builder.processValue("Builder");
+ }
+
+ /**
+ * Implements the driver for the Builder design pattern example.<p>
+ *
+ * In this example, <code>Main</code> acts as the <i>Director</i> that
+ * uses two different builders to build string representations of a
+ * person. <code>TextCreator</code> creates a text-like representation,
+ * <code>XMLCreator</code> an XML-like one.
+ *
+ * @param args the command-line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+
+ Creator builder1 = new TextCreator();
+ Creator builder2 = new XMLCreator();
+
+ build(builder1);
+ build(builder2);
+
+ System.out.println(builder1.getRepresentation());
+ System.out.println(builder2.getRepresentation());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java
new file mode 100644
index 000000000..43307c021
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java
@@ -0,0 +1,66 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteBuilder</i> that builds textual descriptions
+ * of complex objects consisting of type, attributes and values. This version
+ * makes use of the default implementation of <code>getRepresentation()</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class TextCreator implements Creator {
+
+ /**
+ * Defines a <i>buildPart()</i> operation for type parts.
+ *
+ * @param newType the type to process
+ */
+
+ public void processType(String newType) {
+ representation = "This is a new "+newType+":\n";
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param newAttribute the type to process
+ */
+
+ public void processAttribute(String newAttribute) {
+ representation += ("Its " + newAttribute + " is ");
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for value parts.
+ *
+ * @param newValue the value to process
+ */
+
+ public void processValue(String newValue) {
+ representation += (newValue + ".\n");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java
new file mode 100644
index 000000000..ff66a4184
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java
@@ -0,0 +1,103 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteBuilder</i> that builds XML descriptions
+ * of complex objects consisting of type, attributes and values.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class XMLCreator implements Creator {
+
+ protected String type = null;
+ protected String attribute = null;
+
+ /**
+ * Defines a <i>buildPart()</i> operation for type parts.
+ *
+ * @param newType the type to process
+ */
+
+ public void processType(String newType) {
+ representation = "<"+newType+">\n";
+ type = newType;
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param newAttribute the attribute to process
+ */
+
+ public void processAttribute(String newAttribute) {
+ checkAttribute();
+ representation += ("\t<" + newAttribute + ">");
+ this.attribute = newAttribute;
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for value parts.
+ *
+ * @param newValue the type to process
+ */
+
+ public void processValue(String newValue) {
+ representation += newValue;
+ }
+
+ /**
+ * Checks wether the opening type tag is closed and closes it if not.
+ */
+
+ protected void checkType() {
+ if (type != null) {
+ representation += ("</" + type + ">\n");
+ type = null;
+ }
+ }
+
+ /**
+ * Checks wether the opening attribute tag is closed and closes it if not.
+ */
+
+ protected void checkAttribute() {
+ if (attribute != null) {
+ representation += ("</" + attribute + ">\n");
+ attribute = null;
+ }
+ }
+
+ /**
+ * Defines the <i>getResult()</i> operation for <i>Builder</i>s.
+ */
+
+ public String getRepresentation() {
+ checkAttribute();
+ checkType();
+ return representation;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java
new file mode 100644
index 000000000..828540806
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>Builder</i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see TextCreator
+ * @see XMLCreator
+ */
+
+public abstract class Creator {
+
+ /**
+ * An inheritable variable that carries the result of the build.
+ */
+
+ protected String representation;
+
+ /**
+ * Defines a <i>buildPart()</i> operation for type parts.
+ *
+ * @param type the type to process
+ */
+
+ public abstract void processType(String type);
+
+ /**
+ * Defines a <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param newAttribute the attribute to process
+ */
+
+ public abstract void processAttribute(String newAttribute);
+
+ /**
+ * Defines a <i>buildPart()</i> operation for value parts.
+ *
+ * @param newValue the value to process
+ */
+
+ public abstract void processValue(String newValue);
+
+ /**
+ * Defines a <i>getResult()</i> operation for <i>Builder</i>s.
+ * This is the default implementation.
+ *
+ * @return a representation of the build result
+ */
+
+ public String getRepresentation() {
+ return representation;
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java
new file mode 100644
index 000000000..217eda258
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java
@@ -0,0 +1,99 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Builder design pattern example.<p>
+ *
+ * Intent: <i>Separate the construction of a complex object from its
+ * representation so that the same construction process can create different
+ * representations</i><p>
+ *
+ * Participating objects are <code>TextCreator</code> and
+ * <code>XMLCreator</code> which act as <i>Builder</i>s that implement the
+ * <code>Creator</code> interface.<p>
+ *
+ * In this example, <code>Main</code> acts as the <i>Director</i> that
+ * uses two different builders to build string representations of a
+ * person. <code>TextCreator</code> creates a text-like representation,
+ * <code>XMLCreator</code> an XML-like one.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * In Java, the <i>Builder</i> has to be an abstract class (as opposed to
+ * an interface) to allow to define variables or default implementations.
+ * Consequently, all <i>ConcreteBuilders</i> have to have that
+ * class as their superclass, making it impossible to be part of another
+ * class hierarchy.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ *
+ * @see Builder
+ * @see TextCreator
+ * @see XMLCreator
+ */
+
+public class Main {
+
+ /**
+ * Builds a string representation of a person using a given builder.
+ *
+ * @param builder the builder to use.
+ */
+
+ protected static void build(Creator builder) {
+ builder.processType("Person");
+ builder.processAttribute("Name");
+ builder.processValue("James Brick");
+ builder.processAttribute("Age");
+ builder.processValue("33");
+ builder.processAttribute("Occupation");
+ builder.processValue("Builder");
+ }
+
+ /**
+ * Implements the driver for the Builder design pattern example.<p>
+ *
+ * In this example, <code>Main</code> acts as the <i>Director</i> that
+ * uses two different builders to build string representations of a
+ * person. <code>TextCreator</code> creates a text-like representation,
+ * <code>XMLCreator</code> an XML-like one.
+ *
+ * @param args the command-line parameters, unused.
+ *
+ */
+
+ public static void main(String[] args) {
+
+ Creator builder1 = new TextCreator();
+ Creator builder2 = new XMLCreator();
+
+ build(builder1);
+ build(builder2);
+
+ System.out.println(builder1.getRepresentation());
+ System.out.println(builder2.getRepresentation());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java
new file mode 100644
index 000000000..397144108
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java
@@ -0,0 +1,66 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteBuilder</i> that builds textual descriptions
+ * of complex objects consisting of type, attributes and values. This version
+ * makes use of the default implementation of <code>getResult()</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class TextCreator extends Creator {
+
+ /**
+ * Defines a <i>buildPart()</i> operation for type parts.
+ *
+ * @param newType the type to process
+ */
+
+ public void processType(String newType) {
+ representation = "This is a new "+newType+":\n";
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param newAttribute the attribute to process
+ */
+
+ public void processAttribute(String newAttribute) {
+ representation += ("Its " + newAttribute + " is ");
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for value parts.
+ *
+ * @param newValue the value to process
+ */
+
+ public void processValue(String newValue) {
+ representation += (newValue + ".\n");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java
new file mode 100644
index 000000000..8c678ea9c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java
@@ -0,0 +1,90 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.builder.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteBuilder</i> that builds XML descriptions
+ * of complex objects consisting of type, attributes and values.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/26/04
+ */
+
+public class XMLCreator extends Creator {
+
+ protected String type = null;
+ protected String attribute = null;
+
+ /**
+ * Defines a <i>buildPart()</i> operation for type parts.
+ *
+ * @param newType the type to process
+ */
+
+ public void processType(String newType) {
+ representation = "<"+newType+">\n";
+ type = newType;
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for attribute parts.
+ *
+ * @param newAttribute the attribute to process
+ */
+
+ public void processAttribute(String newAttribute) {
+ if (attribute != null) {
+ representation += ("</" + attribute + ">\n");
+ }
+ representation += ("\t<" + newAttribute + ">");
+ this.attribute = newAttribute;
+ }
+
+ /**
+ * Defines a <i>buildPart()</i> operation for value parts.
+ *
+ * @param newValue the value to process
+ */
+
+ public void processValue(String newValue) {
+ representation += (newValue);
+ }
+
+ /**
+ * Defines the <i>getResult()</i> operation for <i>Builder</i>s. Includes
+ * a default implementation.
+ */
+
+ public String getRepresentation() {
+ if (attribute != null) {
+ representation += ("</" + attribute + ">\n");
+ attribute = null;
+ }
+ if (type != null) {
+ representation += ("</" + type + ">\n");
+ type = null;
+ }
+ return representation;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java
new file mode 100644
index 000000000..ba0aa96f6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+
+/**
+ * A simple GUI button that implements its own ActionListener.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Button extends JButton {
+
+ /**
+ * Creates a Button widget. An ActionListener is also added that calls
+ * the <code>doClick(Click)</code> method when the button is pressed
+ *
+ * @param label the button label
+ */
+
+ public Button(String label) {
+ super(label);
+ this.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ doClick(new Click(ae));
+ }
+ });
+ }
+
+
+ /**
+ * An empty method that is called when the button is clicked. This method
+ * could also be defined in the concrete aspect.
+ *
+ * @param click the <code>Click</code> that was created when the
+ * button was clicked.
+ */
+
+ public void doClick(Click click) {}
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java
new file mode 100644
index 000000000..fc524c0eb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Represents the <i>Request</i> in the <i>Chain of Responsibility</i>
+ * pattern, which is a button click in this case. Provides methods for
+ * accessing key masks associated with the click (to find out whether
+ * the SHIFT, ALT, or CTRL keys were pressed during the click).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Click {
+
+ /**
+ * the ActionEvent that describes this Click
+ */
+
+ protected ActionEvent description;
+
+ /**
+ * Creates a <code>Click</code> described by the provided <code>
+ * ActionEvent</code>.
+ *
+ * @param description the ActionEvent that describes this Click
+ */
+
+ public Click(ActionEvent description) {
+ this.description = description;
+ }
+
+ /**
+ * Convenience method for inquiring whether SHIFT was pressed while
+ * the click occured.
+ *
+ * @return whether the SHIFT key was pressed when the click occured
+ */
+
+ public boolean hasShiftMask() {
+ return ((description.getModifiers() & ActionEvent.SHIFT_MASK) != 0 );
+ }
+
+ /**
+ * Convenience method for inquiring whether ALT was pressed while
+ * the click occured.
+ *
+ * @return whether the ALT key was pressed when the click occured
+ */
+
+ public boolean hasAltMask() {
+ return ((description.getModifiers() & ActionEvent.ALT_MASK) != 0 );
+ }
+
+ /**
+ * Convenience method for inquiring whether CTRL was pressed while
+ * the click occured.
+ *
+ * @return whether the CTRL key was pressed when the click occured
+ */
+
+ public boolean hasCtrlMask() {
+ return ((description.getModifiers() & ActionEvent.CTRL_MASK) != 0 );
+ }
+
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java
new file mode 100644
index 000000000..96223074c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java
@@ -0,0 +1,102 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.event.ActionEvent;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ChainOfResponsibilityProtocol;
+
+/**
+ * Implements an instance of the abstracted ChainOfResponsibility design
+ * pattern. Here, the a click on the button triggers an event (request)
+ * that gets passed along the widget hierarchy (button -> panel -> frame).
+ *
+ * In this implementation, the request is handled by the panel if the
+ * CTRL mask is active (i.e., if the CTRL key was pressed while the button
+ * was clicked). If the SHIFT mask is active, the frame handles the request.
+ * Otherwise, the request is unhandled.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public aspect ClickChain extends ChainOfResponsibilityProtocol {
+
+ /**
+ * Frame, Panel and Button are all Handlers
+ */
+
+ declare parents: Frame implements Handler;
+ declare parents: Panel implements Handler;
+ declare parents: Button implements Handler;
+
+ declare parents: Click implements Request;
+
+
+ protected pointcut eventTrigger(Handler handler, Request request):
+ call(void Button.doClick(Click)) && target(handler) && args(request);
+
+
+ public boolean Button.acceptRequest(Request request) {
+ System.out.println("Button is asked to accept the request...");
+ if (request instanceof Click) {
+ Click click = (Click) request;
+ return (click.hasShiftMask());
+ }
+ return false;
+ }
+
+ public void Button.handleRequest(Request request) {
+ System.out.println("Button is handling the event.\n");
+ }
+
+
+ public boolean Panel.acceptRequest(Request request) {
+ System.out.println("Panel is asked to accept the request...");
+ if (request instanceof Click) {
+ Click click = (Click) request;
+ return (click.hasCtrlMask());
+ }
+ return false;
+ }
+
+ public void Panel.handleRequest(Request event) {
+ System.out.println("Panel is handling the event.\n");
+ }
+
+
+ public boolean Frame.acceptRequest(Request request) {
+ System.out.println("Frame is asked to accept the request...");
+ if (request instanceof Click) {
+ Click click = (Click) request;
+ return (click.hasAltMask());
+ }
+ return false;
+ }
+
+ public void Frame.handleRequest(Request event) {
+ System.out.println("Frame is handling the event.\n");
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java
new file mode 100644
index 000000000..c91e12c4a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+
+import javax.swing.JFrame;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowAdapter;
+
+/**
+ * Represents a regular GUI frame. No pattern-specific modifications are
+ * needed here. A WindowListener is added.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Frame extends JFrame {
+
+ /**
+ * Creates a <code>Frame</code> with a given title that responds
+ * properly to <code>WindowClosing<code> events
+ *
+ * @param title the frame title
+ */
+
+ public Frame(String title) {
+ super(title);
+
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ }
+}
+
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java
new file mode 100644
index 000000000..28add4a5f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java
@@ -0,0 +1,108 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a GUI-motivated example for the Chain Of Rspsonsibility design
+ * pattern.<p>
+ *
+ * Intent: <i>Avoid coupling the sender of a request to its receiver by giving
+ * more than one object a chance to handle the request. Chain the receiving
+ * objects and pass the request along the chain until an object handles it.
+ * </i><p>
+ *
+ * Participatng objects are a <code>Frame</code>, a <code>Panel</code>, and
+ * <code>Button</code>
+ *
+ * A click on the button triggers an event (request) that gets passed along
+ * the widget hierarchy (button -> panel -> frame).
+ *
+ * The <code>Handler</code> interface defines the <code>handleRequest()</code>
+ * method for asking an object if it is willing to handle the request.
+ *
+ * Clicking the button will start a request, that gets passed on
+ * along the following chain: button, panel, frame. Depending on
+ * whether the ALT, SHIFT, or CTRL keys are pressed during the
+ * button click, a different object in the chain will handle the
+ * request:
+ *
+ * <ol>
+ * <li> If the SHIFT key is pressed, Button will handle the request
+ * <li> If the CTRL key is pressed, Panel will handle the request
+ * <li> If the ALT key is pressed, Frame will handle the request
+ * <li> If no keys are pressed, the request will not be handled and
+ * an exception will be raised.
+ * </ol>
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * In this implementation, the former <i>ConcreteHandlers</i> do not
+ * contain any pattern code at all. The shared logic for forwarding requests
+ * is implemented once in the reusable abstract library aspect. The current
+ * implementation does require some casts (as generally the case in AspectJ
+ * solutions that employ similar approaches), due to the lack of support for
+ * generics.
+ *
+ * For limitations of this approach, see the ChainOfResponsibilityProtocol
+ * library aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ * @see Button
+ * @see Panel
+ * @see Frame
+ * @see MyChain
+ * @see ChainOfResponsibilityProtocol
+ */
+
+public class Main {
+
+ /**
+ * Implements a GUI-motivated example for the Chain Of Responsibility design
+ * pattern.<p>
+ *
+ * In this implementation, the request is handled by the panel if the
+ * CTRL mask is active (i.e., if the CTRL key was pressed while the button
+ * was clicked). If the SHIFT mask is active, the frame handles the request.
+ * Otherwise, the request is unhandled.
+ *
+ * @param args command line parameters, unused
+ */
+
+ public static void main(String[] args) {
+ Frame frame = new Frame("Chain of Responsibility pattern example");
+ Panel panel = new Panel();
+ Button button = new Button("Click me to see the pattern in action! Use <SHIFT>, <CTRL>, and <ALT> during clicks to see different behavior");
+
+ ClickChain.aspectOf().setSuccessor(button, panel);
+ ClickChain.aspectOf().setSuccessor(panel, frame);
+
+ frame.getContentPane().add(panel);
+ panel.add(button);
+
+ frame.pack();
+ frame.setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java
new file mode 100644
index 000000000..1e268a840
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java
@@ -0,0 +1,37 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+
+/**
+ * A regular GUI JPanel with no modifications
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Panel extends JPanel {}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java
new file mode 100644
index 000000000..5513ea367
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java
@@ -0,0 +1,86 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+
+/**
+ * GUI element at the start of the responsibility chain. A click on the
+ * button starts a request. The <code>Button</code> will only handle the
+ * request if the SHIFT key was pressed when the button was clicked.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Button extends JButton implements ClickHandler {
+
+ /**
+ * the successor in the chain of responsibility
+ */
+
+ protected ClickHandler successor;
+
+ /**
+ * Creates a <code>Button</code> with a given label and successor.
+ *
+ * @param label The button label
+ * @param successor The successor in the chain of responsibility
+ */
+
+ public Button(String label, ClickHandler successor) {
+ super(label);
+ this.successor = successor;
+ this.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ handleClick(new Click(ae));
+ }
+ });
+ }
+
+ /**
+ * Implements the method to handle requests as defined by the
+ * <code>ClickHandler</code> interface. The request is only handled here
+ * if the SHIFT key was pressed.
+ *
+ * @see ClickHandler
+ */
+
+ public void handleClick(Click click) {
+ System.out.println("Button is asked to handle the request...");
+ if (click.hasShiftMask()) {
+ System.out.println("Button handles the request.");
+ } else {
+ if (successor == null) {
+ throw new RuntimeException("request unhandled (end of chain reached)");
+ } else {
+ successor.handleClick(click);
+ }
+ }
+ }
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java
new file mode 100644
index 000000000..334fbfac5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Represents the <i>Request</i> in the <i>Chain of Responsibility</i>
+ * pattern, which is a button click in this case. Provides methods for
+ * accessing key masks associated with the click (to find out whether
+ * the SHIFT, ALT, or CTRL keys were pressed during the click).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Click {
+
+ /**
+ * the ActionEvent that describes this Click
+ */
+
+ protected ActionEvent description;
+
+ /**
+ * Creates a <code>Click</code> described by the provided <code>
+ * ActionEvent</code>.
+ *
+ * @param description the ActionEvent that describes this Click
+ */
+
+ public Click(ActionEvent description) {
+ this.description = description;
+ }
+
+ /**
+ * Convenience method for inquiring whether SHIFT was pressed while
+ * the click occured.
+ *
+ * @return whether the SHIFT key was pressed when the click occured
+ */
+
+ public boolean hasShiftMask() {
+ return ((description.getModifiers() & ActionEvent.SHIFT_MASK) != 0 );
+ }
+
+ /**
+ * Convenience method for inquiring whether ALT was pressed while
+ * the click occured.
+ *
+ * @return whether the ALT key was pressed when the click occured
+ */
+
+ public boolean hasAltMask() {
+ return ((description.getModifiers() & ActionEvent.ALT_MASK) != 0 );
+ }
+
+ /**
+ * Convenience method for inquiring whether CTRL was pressed while
+ * the click occured.
+ *
+ * @return whether the CTRL key was pressed when the click occured
+ */
+
+ public boolean hasCtrlMask() {
+ return ((description.getModifiers() & ActionEvent.CTRL_MASK) != 0 );
+ }
+
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java
new file mode 100644
index 000000000..c0436fc38
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java
@@ -0,0 +1,38 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for letting <i>ConcreteHandlers</i> handle a request
+ * (here: a button click).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public interface ClickHandler {
+ public void handleClick(Click click);
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java
new file mode 100644
index 000000000..10e1ac2a5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowAdapter;
+
+
+/**
+ * Represents a regular GUI frame modified to play its role in the
+ * <i>Chain of Responisiblity</i> pattern, i.e. to handle requests and/or
+ * forward them to its successor in the chain.
+ *
+ * Requests are only handled if the ALT key is pressed during a click.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Frame extends JFrame implements ClickHandler {
+
+ /**
+ * the successor in the chain of responsibility
+ */
+
+ protected ClickHandler successor;
+
+
+ /**
+ * Creates a <code>Frame</code> with a given title that responds
+ * properly to <code>WindowClosing<code> events. The frame
+ * does not have a successor and handles request that it receives.
+ *
+ * @param title the frame title
+ */
+
+ public Frame(String title) {
+ super(title);
+
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ }
+
+ /**
+ * Implements the method to handle requests as defined by the
+ * <code>ClickHandler</code> interface. The request is only handled here
+ * if the ALT key was pressed.
+ *
+ * @see ClickHandler
+ */
+
+ public void handleClick(Click click) {
+ System.out.println("Frame is asked to handle the request...");
+ if (click.hasAltMask()) {
+ System.out.println("Frame handles the request.");
+ } else {
+ if (successor == null) {
+ throw new RuntimeException("request unhandled (end of chain reached)");
+ } else {
+ successor.handleClick(click);
+ }
+ }
+ }
+}
+
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java
new file mode 100644
index 000000000..fda1db4e3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java
@@ -0,0 +1,102 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a GUI-motivated example for the Chain Of Rspsonsibility design
+ * pattern.<p>
+ *
+ * Intent: <i>Avoid coupling the sender of a request to its receiver by giving
+ * more than one object a chance to handle the request. Chain the receiving
+ * objects and pass the request along the chain until an object handles it.
+ * </i><p>
+ *
+ * Participatng objects are a <code>Frame</code>, a <code>Panel</code>, and
+ * <code>Button</code>
+ *
+ * A click on the button triggers an event (request) that gets passed along
+ * the widget hierarchy (button -> panel -> frame).
+ *
+ * The <code>Handler</code> interface defines the <code>handleRequest()</code>
+ * method for asking an object if it is willing to handle the request.
+ *
+ * If an object chooses not to handle a click, the event gets forwarded to
+ * the the object's successor. If such a successor does not exist, an
+ * appropriate message is shown.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * In this version, it is not possible to extract the common code for
+ * the case that the object does not want to handle the click into the
+ * <code>ClickHandler</code> interface. The reason for this is that this would
+ * turn <code>ClickHandler</code> into an abstract class. Since Java
+ * does not support multiple inheritance and the individual <code>
+ * ConcreteHandlers</code> already extend other classes (GUI elements here),
+ * this would not work. The result is some code duplication in the
+ * implementation of the <code>handleClick(..)</code> methods.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ * @see Button
+ * @see Panel
+ * @see Frame
+ * @see Handler
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the chain of responisbility example.
+ * It creates a simple GUI consisting of a <code>Button</code> in a
+ * <code>Panel</code> in a <code>Frame</code>.
+ *
+ * Clicking the button will start a request, that gets passed on
+ * along the following chain: button, panel, frame. Depending on
+ * whether the ALT, SHIFT, or CTRL keys are pressed during the
+ * button click, a different object in the chain will handle the
+ * request:
+ *
+ * <ol>
+ * <li> If the SHIFT key is pressed, Button will handle the request
+ * <li> If the CTRL key is pressed, Panel will handle the request
+ * <li> If the ALT key is pressed, Frame will handle the request
+ * <li> If no keys are pressed, the request will not be handled and
+ * an exception will be raised.
+ * </ol>
+ */
+
+ public static void main(String[] args) {
+
+ Frame frame = new Frame("Chain of Responsibility");
+ Panel panel = new Panel(frame);
+ Button button = new Button("Click me to see the pattern in action! Use <SHIFT>, <CTRL>, and <ALT> during clicks to see different behavior", panel);
+
+ frame.getContentPane().add(panel);
+ panel.add(button);
+
+ frame.pack();
+ frame.setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java
new file mode 100644
index 000000000..30ed13378
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java
@@ -0,0 +1,81 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+
+/**
+ * Represents a regular GUI panel modified to play its role in the
+ * <i>Chain of Responisiblity</i> pattern, i.e. to handle requests and/or
+ * forward them to its successor in the chain.
+ *
+ * Requests are only handled if the CTRL key is pressed during a click.
+
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public class Panel extends JPanel implements ClickHandler {
+
+ /**
+ * the successor in the chain of responsibility
+ */
+
+ protected ClickHandler successor;
+
+ /**
+ * Creates a <code>Panel</code> with a given successor.
+ *
+ * @param successor The successor in the chain of responsibility
+ */
+
+ public Panel(ClickHandler successor) {
+ super();
+ this.successor = successor;
+ }
+
+
+ /**
+ * Implements the method to handle requests as defined by the
+ * <code>ClickHandler</code> interface. The request is only handled here.
+ * if the CTRL key was pressed.
+ *
+ * @see ClickHandler
+ */
+
+ public void handleClick(Click click) {
+ System.out.println("Panel is asked to handle the request...");
+ if (click.hasCtrlMask()) {
+ System.out.println("Panel handles the request.");
+ } else {
+ if (successor == null) {
+ throw new RuntimeException("request unhandled (end of chain reached)");
+ } else {
+ successor.handleClick(click);
+ }
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java
new file mode 100644
index 000000000..4bdba0936
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Implements a simple extension of JButton that supplies its own
+ * ActionListener and calls its own <code>clicked()</code> method
+ * whenever the button is pressed.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ */
+
+public class Button extends JButton {
+
+ /**
+ * Creates a new button with the provided label
+ *
+ * @param name the label of the button
+ */
+
+ public Button(String label) {
+ super(label);
+ this.setActionCommand(label);
+ this.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ clicked();
+ }
+ });
+ }
+
+ /**
+ * Stub method that is called whenever the button is pressed.
+ */
+
+ public void clicked() {}
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java
new file mode 100644
index 000000000..573bcda5e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java
@@ -0,0 +1,52 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandReceiver;
+
+/**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand executed"</quote>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public class ButtonCommand implements Command {
+
+ private Printer printer = new Printer();
+
+ /**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand executed"</quote>.
+ */
+
+ public void executeCommand(CommandReceiver receiver ) {
+ printer.println("ButtonCommand executed");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java
new file mode 100644
index 000000000..393c721eb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java
@@ -0,0 +1,40 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample class that becomes a <i>Command</i> in the pattern
+ * context. Instead of implementing the <i>Command</i> interface directly,
+ * the pattern aspect assigns that role to this class and ensures
+ * implementation of the <code>executeCommand()</code> method.<p>
+ *
+ * This illustrates that any exisiting class can be turned into a <i>Command
+ * </i> without having to change the class itself.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public class ButtonCommand2 {}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java
new file mode 100644
index 000000000..a53f98fa9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandProtocol;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandInvoker;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandReceiver;
+import java.io.PrintStream;
+
+/**
+ * Sets up the Command pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Button
+ */
+
+public aspect ButtonCommanding extends CommandProtocol {
+
+ declare parents: Button implements CommandInvoker;
+ declare parents: Printer implements CommandReceiver;
+ declare parents: ButtonCommand implements Command; // Unneccessay
+ declare parents: ButtonCommand2 implements Command; // "Making" a class
+ // a Command
+
+ /**
+ * Implements a sample <i>Command</i> for the ButtonCommand2 class.
+ * This one prints a short message to <code>System.out</code>
+ * whenever it executes. The message is
+ * <quote>"ButtonCommand number 2 executed"</quote>.
+ */
+
+ public void ButtonCommand2.executeCommand(CommandReceiver receiver) {
+ ((Printer) receiver).println("ButtonCommand number 2 executed");
+ }
+
+ /**
+ * The join points after which to execute the command.
+ * This replaces the normally scattered myCommand.execute() calls.
+ * In this example, a call to <code>Button.clicked()</code> triggers
+ * the execution of the command.
+ *
+ * @param invoker the object invoking the command
+ */
+
+ protected pointcut commandTrigger(CommandInvoker invoker):
+ call(void Button.clicked()) && target(invoker);
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java
new file mode 100644
index 000000000..e3953d23d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java
@@ -0,0 +1,104 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command;
+
+/**
+ * Implements the driver for the command design pattern example.<p>
+ *
+ * Intent: <i>Encapsulate a request as an object, thereby letting you
+ * parameterize clients with different requests, queue or log requests,
+ * and support undoable operations.</i><p>
+ *
+ * Participating objects are <code>Button</code>s as <i>Invoker</i>s,
+ * and a <code>ButtonCommand</code> and <code>ButtonCommand2</code> as
+ * two <i>ConcreteCommand</i>s.
+ *
+ * This example creates a simple GUI with three buttons. Each button has a
+ * command associated with it that is executed when the button is pressed.
+ * Button1 and button3 have the same command, button2 has a different one.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * This version of the pattern lets the developer specify what should trigger
+ * a call to <code>executeCommand()</code>, without changing the <i>Invoker
+ * </i> code.
+ *
+ * Neither <i>Commands</i> nor <i>Invoker</i> have to know of their
+ * involvement in the pattern and can actually act as both.
+ * <code>ButtonCommanding2</code> is an example of a <i>Command</i> that
+ * is unaware of its role. In such cases, the concrete pattern instance
+ * aspect assigns the role and defines the <i>Command</i>'s behavior.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Button
+ * @see ButtonCommand
+ * @see Buttoncommand2
+ */
+
+public class Main extends JFrame {
+
+ /**
+ * This example creates a simple GUI with three buttons. Each
+ * button has a <i>Command</i> associated with it that is executed when
+ * the button is pressed. Button1 and button3 have the same command,
+ * button2 has a different one.
+ */
+
+ public static void main(String[] args) {
+ Button button1 = new Button("Button1");
+ Button button2 = new Button("Button2");
+ Button button3 = new Button("Button3");
+
+ Command com1 = new ButtonCommand();
+ Command com2 = new ButtonCommand2();
+
+ JPanel pane = new JPanel();
+ pane.add(button1);
+ ButtonCommanding.aspectOf().setCommand(button1, com1);
+
+ pane.add(button2);
+ ButtonCommanding.aspectOf().setCommand(button2, com2);
+ ButtonCommanding.aspectOf().setReceiver(com2, new Printer());
+
+ pane.add(button3);
+ ButtonCommanding.aspectOf().setCommand(button3, com1);
+
+ JFrame frame = new JFrame("Command Pattern Example");
+
+ frame.getContentPane().add(pane);
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+ frame.pack();
+ frame.setVisible(true); }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java
new file mode 100644
index 000000000..edc7d9d39
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java
@@ -0,0 +1,38 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Helper class that is used as a receiver for the Command pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ */
+
+public class Printer {
+ public void println(String s) {
+ System.out.println(s);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java
new file mode 100644
index 000000000..3e5784fcd
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java
@@ -0,0 +1,87 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Implements a simple extension of JButton that supplies its own
+ * ActionListener and calls its own <code>clicked()</code> method
+ * whenever the button is pressed. This method calls the <code>
+ * executeCommand()</code> method on the button's associated <i>Command</i>
+ * object.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+
+public class Button extends JButton {
+
+ /**
+ * the command object associated with this button
+ */
+
+ protected Command command;
+
+ /**
+ * Creates a new button with the provided label
+ *
+ * @param label the label of the button
+ */
+
+ public Button(String label) {
+ super(label);
+ this.setActionCommand(label);
+ this.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ clicked();
+ }
+ });
+ }
+
+ /**
+ * Calls <code>ececuteCommand()</code> on the associated
+ * command object. This method gets called whenever the
+ * button is pressed.
+ */
+
+ public void clicked() {
+ if (command != null) {
+ command.executeCommand();
+ }
+ }
+
+ /**
+ * Sets the associated command object for this button
+ *
+ * @param command the new <i>Command</i> object.
+ */
+
+ public void setCommand(Command command) {
+ this.command = command;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java
new file mode 100644
index 000000000..9d0bb69d1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java
@@ -0,0 +1,46 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand executed"</quote>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public class ButtonCommand implements Command {
+
+/**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand executed"</quote>.
+ */
+ public void executeCommand() {
+ System.out.println("ButtonCommand executed");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java
new file mode 100644
index 000000000..3844bda1a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java
@@ -0,0 +1,47 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand number 2 executed"</quote>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public class ButtonCommand2 implements Command {
+
+/**
+ * Implements a sample command. This one prints a short message to
+ * <code>System.out</code> whenever it executes. The message is
+ * <quote>"ButtonCommand number 2 executed"</quote>.
+ */
+
+ public void executeCommand() {
+ System.out.println("ButtonCommand number 2 executed");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java
new file mode 100644
index 000000000..d441f43ab
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java
@@ -0,0 +1,40 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>Command</i> objects.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public interface Command {
+
+ /**
+ * Executes the command.
+ */
+
+ public void executeCommand();
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java
new file mode 100644
index 000000000..3a81bda07
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java
@@ -0,0 +1,98 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.command.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+/**
+ * Implements the driver for the command design pattern example.<p>
+ *
+ * Intent: <i>Encapsulate a request as an object, thereby letting you
+ * parameterize clients with different requests, queue or log requests,
+ * and support undoable operations.</i><p>
+ *
+ * Participating objects are <code>Button</code>s as <i>Invoker</i>s,
+ * and a <code>ButtonCommand</code> and <code>ButtonCommand2</code> as
+ * two <i>ConcreteCommand</i>s.
+ *
+ * This example creates a simple GUI with three buttons. Each button has a
+ * command associated with it that is executed when the button is pressed.
+ * Button1 and button3 have the same command, button2 has a different one.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Both commands and invoker have to have pattern-related code.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Button
+ * @see Command
+ * @see ButtonCommand
+ * @see Buttoncommand2
+ */
+
+public class Main {
+
+ /**
+ * This example creates a simple GUI with three buttons. Each button has a
+ * command associated with it that is executed when the button is pressed.
+ * Button1 and button3 have the same command, button2 has a different one.
+ */
+
+ public static void main(String[] args) {
+
+ Button button1 = new Button("Print Date");
+ Button button2 = new Button("Command 1");
+ Button button3 = new Button("Command 2");
+
+ Command com1 = new ButtonCommand();
+ Command com2 = new ButtonCommand2();
+
+ JPanel pane = new JPanel();
+ pane.add(button1);
+ button1.setCommand(com1);
+
+ pane.add(button2);
+ button2.setCommand(com2);
+
+ pane.add(button3);
+ button3.setCommand(com1);
+
+ // Note: Can not have two commands.
+ // That is within the pattern specification
+
+ JFrame frame = new JFrame("Command Pattern Example");
+
+ frame.getContentPane().add(pane);
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+ frame.pack();
+ frame.setVisible(true);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java
new file mode 100644
index 000000000..d40f6363b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>Composite</i>. Note that in this AspectJ version, the
+ * participants are decoupled from the pattern. Thus, this composite does
+ * not need to implement an interface or even keep track of its children.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Component
+ * @see File
+ */
+
+public class Directory {
+
+ /**
+ * stores the name of this Directory
+ */
+
+ protected String name;
+
+ /**
+ * Creates a new Directory with a given name
+ *
+ * @param name the name for the new Directory object
+ */
+
+ public Directory(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Overwrites the <code>toString()</code> method from <code>Object</code>
+ * to print information about this Directory
+ */
+
+ public String toString() {
+ return ("Directory: "+name);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java
new file mode 100644
index 000000000..6231b140b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java
@@ -0,0 +1,80 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>Leaf</i>. Note that in this AspectJ version, the
+ * participants are decoupled from the pattern. Thus, this leaf does
+ * not need to implement the <i>Component</i> interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Component
+ * @see Directory
+ */
+
+public class File {
+
+ /**
+ * stores the name for this File
+ */
+
+ protected String name;
+
+ /**
+ * stores the size for this File
+ */
+
+ protected int size;
+ /**
+ * Creates a new File with a given name and size
+ *
+ * @param name the name for the new File
+ * @param size the size for the new File
+ */
+
+ public File(String name, int size) {
+ this.name = name;
+ this.size = size;
+ }
+
+ /**
+ * Overwrites the <code>toString()</code> method from <code>Object</code>
+ * to print information about this object
+ */
+
+ public String toString() {
+ return ("File: "+name+" ("+size+" KB)");
+ }
+
+ /**
+ * Returns the size of this File
+ *
+ * @return the size of this File (on disk)
+ */
+ public int getSize() {
+ return size;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java
new file mode 100644
index 000000000..559c84d78
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java
@@ -0,0 +1,180 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.io.PrintStream;
+import java.util.Enumeration;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CompositeProtocol;
+
+/**
+ * Implements a concrete instance of the Composite design pattern.<p>
+ *
+ * It maintains the mapping between <i>Composite</i>s and their children,
+ * defines the <i>Component</i>, <i>Composite</i>, and <i>Leaf</i> roles,
+ * and provides facilities to implement methods that work on the whole
+ * aggregate structure.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * This concrete subaspect does the following things: <UL>
+ * <LI> Defines which classes are Components and Leafs
+ * <LI> Defines methods that operate on the whole aggregate
+ * structure (using visitors)
+ * </UL>
+ *
+ * Note that implementing the two visitors is just done for fun. Similar
+ * implementations are possible in the OO case of course, although that would
+ * require changing the <i>Components</i>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public aspect FileSystemComposition extends CompositeProtocol {
+
+ /**
+ * Assigns the Composite role to <code>Directory</code>
+ */
+
+ declare parents: Directory implements Composite;
+
+ /**
+ * Assigns the Leaf role to <code>File</code>
+ */
+
+ declare parents: File implements Leaf;
+
+
+
+
+ // Test 1: Printing the stucture using a visitor
+
+ /**
+ * helper variable to store recursion depth for pretty printing
+ */
+
+ private static int indent = 0;
+
+ /**
+ * Print a number of spaces according to the current recursion depth
+ */
+
+ private static void indent() {
+ for (int i=0; i<indent; i++)
+ System.out.print(" ");
+ }
+
+ /**
+ * Provides a client-accessible method that pretty-prints the
+ * structure of the aggregate structure using a Visitor
+ *
+ * @param s the PrintStream to print to
+ */
+
+ public void Component.printStructure(PrintStream s) {
+ indent();
+ s.println("<Component>"+this);
+ }
+
+ /**
+ * Implements <code>printStructure</code> for Composites: The indent
+ * is appropriately updated and the method call is forwarded to all
+ * children.
+ *
+ * @param s the PrintStream to print to
+ */
+
+ public void Composite.printStructure(final PrintStream s) {
+ indent();
+ s.println("<Composite>"+this);
+ indent +=4;
+ FileSystemComposition.aspectOf().recurseOperation(this, new Visitor() {
+ public void doOperation(Component c) { c.printStructure(s); }
+ } );
+ indent -=4;
+ }
+
+ /**
+ * Implements <code>printStructure</code> for <i>Leaf</i>s.
+ *
+ * @param s the PrintStream to print to
+ */
+
+ public void Leaf.printStructure(PrintStream s) {
+ indent();
+ s.println("<Leaf>"+this);
+ }
+
+
+
+
+
+ // Test2: Collecting statistics on the structure (aggregation)
+
+ /**
+ * Provides a client-accessible method that pretty-prints the
+ * structure of the aggregate structure using a FunctionVisitor.
+ * Calculates the sum of all File (<i>Leaf</i>) sizes in the structure.
+ *
+ * @returns the sum of <i>Leaf</i> sizes of all elements in this structure
+ */
+
+ public int Component.subSum() {
+ return 0;
+ }
+
+ /**
+ * Implements <code>subSum()</code> for Composites: The method call
+ * is forwarded to all children, then the results are summed up.
+ *
+ * @returns the sum of leaf sizes of all elements in this structure
+ */
+
+ public int Directory.subSum() {
+ Enumeration enum = FileSystemComposition.aspectOf().recurseFunction(
+ this, new FunctionVisitor() {
+ public Object doFunction(Component c) {
+ return new Integer(c.subSum());
+ }
+ });
+
+ int sum = 0;
+ while (enum.hasMoreElements()) {
+ sum += ((Integer) enum.nextElement()).intValue();
+ }
+ return sum;
+ }
+
+ /**
+ * Implements <code>subSum()</code> for <i>Leaf</i>s: Simply returns
+ * the <i>Leaf</i>'s size.
+ *
+ * @returns the leaf id
+ */
+
+ public int File.subSum() {
+ return size;
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java
new file mode 100644
index 000000000..820faa6c2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java
@@ -0,0 +1,141 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Enumeration;
+
+/**
+ * Implements the driver for the Composite design pattern example.<p>
+ *
+ * Intent: <i>Compose objects into tree structures to represent part-whole
+ * hierarchies. Composite lets clients treat individual objects and
+ * compositions of objects uniformly.</i><p>
+ *
+ * Participating classes are <code>Directory</code>s as <i>Composite</i>s,
+ * and <code>File</code>s as <i>Leaf</i>s. Both implement the
+ * <i>Component</i> interface.<p>
+ *
+ * This example creates a simple structure as follows: Composite directory1
+ * has three children: file1, directory2, and file3. directory2 has file2
+ * as a child.
+ *
+ * Compact notation: directory1(file1, directory2(file2), file3)
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * <i>Composite</i>s and <i>Leaf</i>s do not need to know about their
+ * role in the pattern.
+ *
+ * This example also illustrates how to define methods that collect
+ * information from the whole aggreagate structure (using visitors).
+ * One of them prints the composite structure, the other one collects the
+ * sum of the values of all leaves in the structure.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Directory
+ * @see File
+ */
+
+ public class Main {
+
+ /**
+ * helper variable to store recursion depth for pretty printing
+ */
+
+ static int indent = 0;
+
+ /**
+ * Print a number of spaces according to the current recursion depth
+ */
+
+ private static void indent() {
+ for (int i=0; i<indent; i++)
+ System.out.print(" ");
+ }
+
+ /**
+ * Pretty-prints a recursive composite structure
+ *
+ * @param comp the component denoting the entry point into the structure
+ */
+
+ private static void printStructure(FileSystemComposition.Component comp) {
+ indent();
+ System.out.println(comp);
+ indent +=4;
+ for (Enumeration enum =
+ FileSystemComposition.aspectOf().getAllChildren(comp);
+ enum.hasMoreElements();) {
+ printStructure(
+ (FileSystemComposition.Component) enum.nextElement());
+ }
+ indent -= 4;
+ }
+
+
+ /**
+ * This example creates a simple structure as follows: Composite directory1
+ * has three children: file1, directory2, and file3. directory2 has file2
+ * as a child.
+ *
+ * Also, this example illustrates how to define methods that collect
+ * information from the whole aggreagate structure (using visitors).
+ * One of them prints the compiste structure, the other one collects the
+ * sum of the values of all leaves in the structure.
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("\n<<< Sample AOP implementation of Composite pattern >>>\n");
+ System.out.print ("Creating Composite structure ...\n");
+
+ Directory directory1 = new Directory("Directory1");
+ Directory directory2 = new Directory("Directory2");
+ File file1 = new File("File1", 123);
+ File file2 = new File("File2", 4556);
+ File file3 = new File("File3", 16);
+
+ FileSystemComposition.aspectOf().addChild(directory1, file1);
+ FileSystemComposition.aspectOf().addChild(directory1, directory2);
+ FileSystemComposition.aspectOf().addChild(directory2, file2);
+ FileSystemComposition.aspectOf().addChild(directory1, file3);
+
+ System.out.println("done.");
+ System.out.println("This is the Structure:");
+
+ printStructure(directory1);
+
+ System.out.println("\nCalling printStructure(PrintStream) on Composition.Components ...");
+ directory1.printStructure(System.out);
+ System.out.println("... done.");
+
+ System.out.println("\nCalling subSum():int on the structure ...");
+ System.out.println("The total size of the file system is: "+directory1.subSum());
+ System.out.println("... done.");
+
+ System.out.println("\n<<< Test completed >>>\n");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java
new file mode 100644
index 000000000..dc9b300af
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java
@@ -0,0 +1,120 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.LinkedList;
+
+/**
+ * Implements a <i>Composite</i>. Children are stored in a linked list.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see File
+ */
+
+public class Directory implements FileSystemComponent {
+
+ /**
+ * stores the children for this Directory (files and subdirectories)
+ */
+
+ protected LinkedList children = new LinkedList(); // Component interface
+
+ /**
+ * stores the name of this Directory
+ */
+
+ protected String name;
+
+ /**
+ * Creates a new Directory with a given name
+ *
+ * @param name the name for the new Directory object
+ */
+
+ public Directory(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Overwrites the <code>toString()</code> method from <code>Object</code>
+ * to print information about this Directory
+ */
+
+ public String toString() {
+ return ("Directory: "+name);
+ }
+
+
+ /**
+ * Adds a child to the component
+ *
+ * @param component the child to add
+ */
+
+ public void add(FileSystemComponent component) {
+ this.children.add(component);
+ }
+
+ /**
+ * Removes a child from the component
+ *
+ * @param component the child to remove
+ */
+ public void remove(FileSystemComponent component) {
+ this.children.remove(component);
+ }
+
+ /**
+ * Returns a child of the Directory at the given position
+ *
+ * @param index the position of the child
+ */
+
+ public FileSystemComponent getChild(int index) {
+ return (FileSystemComponent) children.get(index);
+ }
+
+ /**
+ * Returns the number of chilren this Directory has
+ *
+ * @returns the number of children of this Directory
+ */
+
+ public int getChildCount() {
+ return children.size();
+ }
+
+ /**
+ * Returns the size of this Directory. For simplicity, we define that only
+ * files have a tangible size, so this method returns 0.
+ *
+ * @return the size of the component (on disk)
+ */
+ public int getSize() {
+ return 0;
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java
new file mode 100644
index 000000000..1f71cf941
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java
@@ -0,0 +1,120 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>Leaf</i>. Leafs have no children.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Directory
+ */
+
+public class File implements FileSystemComponent {
+
+ /**
+ * stores the name for this File
+ */
+
+ protected String name;
+
+ /**
+ * stores the size for this File
+ */
+
+ protected int size;
+ /**
+ * Creates a new File with a given name and size
+ *
+ * @param name the name for the new File
+ * @param size the size for the new File
+ */
+
+ public File(String name, int size) {
+ this.name = name;
+ this.size = size;
+ }
+
+ /**
+ * Overwrites the <code>toString()</code> method from <code>Object</code>
+ * to print information about this object
+ */
+
+ public String toString() {
+ return ("File: "+name+" ("+size+" KB)");
+ }
+
+
+ /**
+ * Adds a child to the Component. Since Files have no
+ * children, this method does nothing.
+ *
+ * @param component the child to add
+ */
+
+ public void add(FileSystemComponent component) {}
+
+ /**
+ * Removes a child from the Component. Since Files have no
+ * children, this method does nothing.
+ *
+ * @param component the child to add
+ */
+
+ public void remove(FileSystemComponent component) {}
+
+ /**
+ * Returns a child of the Component. Since Files are <i>Leaf</i>s, they
+ * don't have any children. Thus, this method returns null.
+ *
+ * @param index the position of the child
+ * @return always null, since Files do not have children
+ */
+
+ public FileSystemComponent getChild(int index) {
+ return null;
+ }
+
+ /**
+ * Returns the number of chilren this Component has. Since Files
+ * are <i>Leaf</i>s, they don't have any children. Thus, this method
+ * returns 0.
+ *
+ * @returns always 0, since Files do not have children
+ */
+
+ public int getChildCount() {
+ return 0;
+ }
+
+ /**
+ * Returns the size of this File
+ *
+ * @return the size of this File (on disk)
+ */
+ public int getSize() {
+ return size;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java
new file mode 100644
index 000000000..1d70078a3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java
@@ -0,0 +1,81 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the <i>Component</i> interface for the composite design pattern.<p>
+ * The implementation is anologuous to the one presented in GoF. Contemporary
+ * Java implementations would probably change the <code>getChild(int)</code>
+ * and <code>getChildCount()</code> methods to a single method that returns
+ * a <code>Collection</code>. The AspectJ version has an appropriate
+ * implementation.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Directory
+ * @see File
+ */
+
+public interface FileSystemComponent {
+
+ /**
+ * Adds a child to the component
+ *
+ * @param component the child to add
+ */
+
+ public void add(FileSystemComponent component);
+
+ /**
+ * Removes a child from the component
+ *
+ * @param component the child to remove
+ */
+
+ public void remove(FileSystemComponent component);
+
+ /**
+ * Returns the child of the component ath the given position
+ *
+ * @param index the position of the child
+ */
+
+ public FileSystemComponent getChild(int index);
+
+ /**
+ * Returns the number of chilren a component has
+ *
+ * @returns the number of children of this component
+ */
+
+ public int getChildCount();
+
+ /**
+ * Returns the size of this FileSystemComponent
+ *
+ * @return the size of the component (on disk)
+ */
+ public int getSize();
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java
new file mode 100644
index 000000000..c36597e5f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java
@@ -0,0 +1,119 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.composite.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Composite design pattern example.<p>
+ *
+ * Intent: <i>Compose objects into tree structures to represent part-whole
+ * hierarchies. Composite lets clients treat individual objects and
+ * compositions of objects uniformly.</i><p>
+ *
+ * Participating classes are <code>Directory</code>s as <i>Composite</i>s,
+ * and <code>File</code>s as <i>Leaf</i>s. Both implement the
+ * <i>Component</i> interface.<p>
+ *
+ * This example creates a simple structure as follows: Composite directory1
+ * has three children: file1, directory2, and file3. directory2 has file2
+ * as a child.
+ *
+ * Compact notation: directory1(file1, directory2(file2), file3)
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Every <i>Component</i> and every <i>Leaf</i> needs to know about the
+ * pattern and their in the pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ *
+ * @see Component
+ * @see Directory
+ * @see File
+ */
+
+public class Main {
+
+ /**
+ * helper variable to store recursion depth for pretty printing
+ */
+
+ private static int indent = 0;
+
+ /**
+ * Prints a number of spaces according to the current recursion depth
+ */
+
+ private static void indent() {
+ for (int i=0; i<indent; i++)
+ System.out.print(" ");
+ }
+
+ /**
+ * Pretty-prints a recursive composite structure
+ *
+ * @param comp the component denoting the entry point into the structure
+ */
+
+ private static void printStructure(FileSystemComponent comp) {
+ indent();
+ System.out.println(comp);
+ indent +=4;
+ for (int i=0; i<comp.getChildCount(); i++) {
+ printStructure(comp.getChild(i));
+ }
+ indent -= 4;
+ }
+
+
+ /**
+ * This example creates a simple structure as follows: Composite directory1
+ * has three children: file1, directory2, and file3. directory2 has file2
+ * as a child.
+ */
+
+
+ public static void main(String[] args) {
+ System.out.println("\n<<< Sample OOP implementation of Composite pattern >>>\n");
+ System.out.print ("Creating Composite structure ...\n");
+
+ Directory directory1 = new Directory("Directory1");
+ Directory directory2 = new Directory("Directory2");
+ File file1 = new File("File1", 123);
+ File file2 = new File("File2", 4556);
+ File file3 = new File("File3", 16);
+
+ directory1.add(file1);
+ directory1.add(directory2);
+ directory2.add(file2);
+ directory1.add(file3);
+
+ System.out.println("done.");
+ System.out.println("This is the Structure:");
+
+ printStructure(directory1);
+
+ System.out.println("\n<<< Test completed >>>\n");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java
new file mode 100644
index 000000000..1f60876f9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Adds brackets ("[", "]") before and after the string to decorate.
+ * Acts as a <i>ConcreteDecorator</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+
+public aspect BracketDecorator {
+
+ /**
+ * Identifies the execution points of interest: all calls to
+ * <code>ConcreteOutput.print(String)</code>.
+ */
+
+ protected pointcut printCall(String s):
+ call(public void ConcreteOutput.print(String)) && args(s);
+
+ /**
+ * Adds brackets before and after the argument string before passing
+ * the call on to the component this decorator aspect decorates.
+ *
+ * @param s the string to be decorated.
+ */
+
+ void around(String s): printCall(s) {
+ s = "[" + s + "]"; // Decorates the string
+ proceed(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java
new file mode 100644
index 000000000..851830647
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java
@@ -0,0 +1,47 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a simple class that provides a <code>print(String)</code>
+ * method. In this AspectJ implementation, there is no need for a
+ * <i>Component</i> interface; this class is autonomous and does not need
+ * to have pattern-related code.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class ConcreteOutput {
+
+ /**
+ * Prints the argument string to <code>System.out</code>.
+ *
+ * @param s the string to be printed.
+ */
+
+ public void print(String s) {
+ System.out.print(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java
new file mode 100644
index 000000000..0cec41d93
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java
@@ -0,0 +1,78 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Decorator design pattern example.<p>
+ *
+ * Intent: <i>Attach additional responsibilities to an object dynamically.
+ * Decorators provide a flexible alternative to subclassing for extending
+ * functionality.</i><p>
+ *
+ * Participating classes are <code>Output</code>s as <i>Component</i>s,
+ * <code>ConcreteOutput</code> as <i>ConcreteComponent</i>. The decorators
+ * are <code>OutputDecorator</code> as <i>Decorator</i>, and <code>
+ * StarDecorator</code> and <code>BracketDecorator</code> as <i>
+ * ConcreteDecorator</i>s.<p>
+ *
+ * Experimental setup: The concrete decorator (ConcreteOutput) prints a
+ * string, Decorators (StarDecorator and BracketDecorator) wrap other
+ * output around it. Output should be: "[ *** <String> *** ]"
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * This version does not allow for dynamic composition of decorators.
+ * However, this version decouples <i>ConcreteComponent</i>s, clients
+ * and <i>Decorators</i>. Neither clients nor <i>ConcreteComponents</i>
+ * need to have pattern code in them.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see ConcreteOutput
+ * @see StarDecorator
+ * @see BracketDecorator
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Decorator design pattern example.<p>
+ *
+ * Experimental setup: Concrete decorator (ConcreteOutput) prints a
+ * string, Decorators (StarDecorator and BracketDecorator) wrap other
+ * output around it. Output should be: "[ *** <String> *** ]"
+ *
+ * @param args command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ ConcreteOutput original = new ConcreteOutput();
+
+ original.print("<String>");
+
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java
new file mode 100644
index 000000000..f7c85a768
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a decorator that adds stars (" *** ") before and after the
+ * string to decorate. This aspect has precedence over BracketDecorator.
+ * The <code>precedence</code> keyword allows to describe the application
+ * order of decorator aspects.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+
+public aspect StarDecorator {
+
+ declare precedence: StarDecorator, BracketDecorator;
+
+ /**
+ * Identifies the execution points of interest: all calls to
+ * <code>ConcreteOutput.print(String)</code>.
+ */
+
+ protected pointcut printCall(String s):
+ call(public void ConcreteOutput.print(String)) && args(s);
+
+ /**
+ * Adds stars before and after the argument string before passing
+ * the call on to the component this decorator aspect decorates.
+ *
+ * @param s the string to be decorated.
+ */
+
+ void around(String s): printCall(s) {
+ s = " *** " + s + " *** "; // Decorates the string
+ proceed(s);
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java
new file mode 100644
index 000000000..4b381865e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a decorator that adds brackets ("[", "]") before and after the
+ * string to decorate.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class BracketDecorator extends OutputDecorator {
+
+ /**
+ * Adds brackets before and after the argument string before passing
+ * the call on to the component this decorator decorates.
+ *
+ * @param s the string to be decorated.
+ */
+
+ public void print(String s) {
+ outputComponent.print("["+s+"]");
+ }
+
+ /**
+ * Creates a BracketDecorator for the given output component
+ *
+ * @param output the component to decorate.
+ */
+
+ public BracketDecorator(Output output) {
+ super(output);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java
new file mode 100644
index 000000000..90d82b5be
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>Component</i> interface to print strings to <code>
+ * System.out</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class ConcreteOutput implements Output {
+
+ /**
+ * Prints the argument string to <code>System.out</code>.
+ *
+ * @param s the string to be printed.
+ */
+
+ public void print(String s) {
+ System.out.print(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java
new file mode 100644
index 000000000..fd0601599
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java
@@ -0,0 +1,73 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Decorator design pattern example.<p>
+ *
+ * Intent: <i>Attach additional responsibilities to an object dynamically.
+ * Decorators provide a flexible alternative to subclassing for extending
+ * functionality.</i><p>
+ *
+ * Participating classes are <code>Output</code>s as <i>Component</i>s,
+ * <code>ConcreteOutput</code> as <i>ConcreteComponent</i>. The decorators
+ * are <code>OutputDecorator</code> as <i>Decorator</i>, and <code>
+ * StarDecorator</code> and <code>BracketDecorator</code> as <i>
+ * ConcreteDecorator</i>s.<p>
+ *
+ * Experimental setup: The concrete decorator (ConcreteOutput) prints a
+ * string, Decorators (StarDecorator and BracketDecorator) wrap other
+ * output around it. Output should be: "[ *** <String> *** ]"
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * This version allows for dynamic composition of decorators.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Decorator design pattern example.<p>
+ *
+ * Experimental setup: Concrete decorator (ConcreteOutput) prints a
+ * string, Decorators (StarDecorator and BracketDecorator) wrap other
+ * output around it. Output should be: "[ *** <String> *** ]"
+ *
+ * @param args command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ Output original = new ConcreteOutput();
+ Output bracketed= new BracketDecorator(original);
+ Output stared = new StarDecorator(bracketed);
+
+ stared.print("<String>");
+
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java
new file mode 100644
index 000000000..49df113d4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java
@@ -0,0 +1,43 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines an interface for printing Strings. Acts as <i>Component</i>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public interface Output {
+
+ /**
+ * Prints the argument string to <code>System.out</code>.
+ *
+ * @param s the string to be printed.
+ */
+
+ public void print(String s);
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java
new file mode 100644
index 000000000..2966d1f20
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the <i>Decorator</i> interface. This is realized as an abstract
+ * class to allow for default implementations (set varible "output",
+ * provide default implementation for <code>print(String)</code>).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public abstract class OutputDecorator implements Output {
+
+ /**
+ * the <i>Component</i> to decorate
+ */
+
+ protected Output outputComponent;
+
+ /**
+ * Prints the argument string to <code>System.out</code>. This method is
+ * overwritten by concrete decorators. The default implementation
+ * forwards the method call to the decorated <i>Component</i>.
+ *
+ * @param s the string to be printed.
+ */
+
+ public void print(String s) {
+ outputComponent.print(s);
+ }
+
+ /**
+ * Defines the constructor signature. Also provides a default
+ * implementation so that concrete decorators don't have to
+ * re-implement it. Subclasses (<i>ConcreteDecorator</i>s) can just
+ * call <code>super(..)</code> and don't have
+ * to deal with setting the variable themselves.
+ *
+ * @param output the <i>Component</i> to decorate.
+ */
+
+ public OutputDecorator(Output output) {
+ this.outputComponent = output;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java
new file mode 100644
index 000000000..1e7cb393b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java
@@ -0,0 +1,59 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a decorator that adds stars (" *** ") before and after the
+ * string to decorate.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+
+public class StarDecorator extends OutputDecorator {
+
+ /**
+ * Adds three stars before and after the argument string before passing
+ * the call on to the component this decorator decorates.
+ *
+ * @param s the string to be decorated.
+ */
+
+ public void print(String s) {
+ outputComponent.print(" *** " + s + " *** ");
+ }
+
+ /**
+ * Creates a StarDecorator for the given output component
+ *
+ * @param output the <i>Component</i> to decorate.
+ */
+
+ public StarDecorator(Output output) {
+ super(output);
+ }
+
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java
new file mode 100644
index 000000000..c6d59e657
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java
@@ -0,0 +1,44 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a static method that returns a decorator string.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public class Decoration {
+
+ /**
+ * Provides a decorator string consisting of stars ("*").
+ *
+ * @returns a decorator string made up of stars
+ */
+
+ public static String getDecoration() {
+ return "*******************************************";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java
new file mode 100644
index 000000000..815793fd5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java
@@ -0,0 +1,65 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/**
+ * Enforces the encapsulation of the Facade by declaring a compile-time
+ * warning if the <i>subsystem</i> is accessed from any other class but the
+ * facade. We use <code>declare warning</code> here, but <code>declare error
+ * </code> can also be used.
+ *
+ * Instead of protecting the encapsulated subsystem against (only) mehod
+ * calls, other pointcut types (or combinations) could be used to achieve
+ * different effects.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public aspect FacadePolicyEnforcement {
+
+ /**
+ * Enumerates all calls to encapsulated methods. It is of course easier
+ * to define this pointcut if the encapsulated subsystem is in a separate
+ * package, and the protected classes do not have to be enumerated.
+ */
+
+ pointcut callsToEncapsulatedMethods():
+ call(* (Decoration || RegularScreen || StringTransformer).*(..));
+
+ /**
+ * Defines what constitutes legal accesses to the protected subsystem.
+ */
+
+ pointcut facade(): within(OutputFacade);
+
+ /**
+ * Whenever a method in the encapsulated susbsystem is called, a compile
+ * time warning gets created - except if the method call comes from the
+ * <i>Facade</i>
+ */
+
+ declare warning: callsToEncapsulatedMethods() && !facade():
+ "Calling encapsulated method directly - use Facade methods instead";
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java
new file mode 100644
index 000000000..06e5ce34c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java
@@ -0,0 +1,76 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Facade design pattern example.<p>
+ *
+ * Intent: <i>Provide a unified interface to a set of interfaces in a
+ * subsystem. Facade defines a higher-level interface that makes the
+ * subsystem easier to use.</i><p>
+ *
+ * The <i>subsystem</i> consists of three classes that provide low-level
+ * string manipulation and output functionality: <code>RegularScreen</code>,
+ * <code>Decoration</code>, and <code>StringTransformer</code>. The <i>Facade
+ * </i> class <code>OutputFacade</code> procides a higher-level interface
+ * to output strings. This class calls methods on that higer-level interface.
+ *
+ * * <p><i>This is the AspectJ version.</i><p>
+ *
+ * For this pattern, both Java and AspectJ implementations are identical.
+ * The pattern introduces no crosscutting and is not abstractable. However,
+ * this example illustrates that AspectJ can be used to enforce the facade's
+ * encapsulation of the subsystem in question. Both <code>declare warning
+ * </code> and <code>declare error</code> can be used to that effect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public class Main {
+
+ /**
+ * Tests the higher-level interface of <code>OutputFacade</code>.
+ *
+ * @param args Command-line parameters, ignored here
+ */
+
+ public static void main(String[] args) {
+ OutputFacade facade = new OutputFacade();
+
+ System.out.println("Testing regular Facade access...");
+ facade.printDecoration();
+
+ facade.printNormal("Facade: this is normal printing");
+ facade.printFancy ("Facade: this is fancy printing");
+
+ System.out.println("\nCircumventing Facade encapsulation...");
+
+ // Note that the compiler warning caused by the next line is
+ // intentional. See FacadePolicyEnforcement for details.
+ RegularScreen.print("It works, but should create a compiler warning");
+
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java
new file mode 100644
index 000000000..676e9e27b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>Facade</i> role in the pattern by providing a
+ * higher-level interface to the operations provided by
+ * <code>RegularScreen</code>, <code>Decoration</code>,
+ * and <code>StringTransformer</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public class OutputFacade {
+
+ /**
+ * Prints a string using <code>RegularScreen</code>.
+ *
+ * @param s the string to print
+ */
+
+ public void printNormal(String s) {
+ RegularScreen.print(s);
+ RegularScreen.newline();
+ }
+
+ /**
+ * Prints a two versions of string with decorations
+ * using <code>RegularScreen</code> and <code>Decoration</code>.
+ *
+ * @param s the string to print
+ */
+
+ public void printFancy(String s) {
+ printDecoration();
+
+ RegularScreen.print(StringTransformer.transformToUpper(s+" (uppercase)"));
+ RegularScreen.newline();
+
+ printDecoration();
+
+ RegularScreen.print(StringTransformer.transformToLower(s+" (lowercase)"));
+ RegularScreen.newline();
+
+ printDecoration();
+ }
+
+ /**
+ * Prints a decorator string.
+ */
+
+ public void printDecoration() {
+ RegularScreen.print(Decoration.getDecoration());
+ RegularScreen.newline();
+ RegularScreen.newline();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java
new file mode 100644
index 000000000..bbd623afe
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java
@@ -0,0 +1,52 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a low-level interface for printing to System.out.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public class RegularScreen {
+
+ /**
+ * Prints a string to System.out.
+ *
+ * @param s the string to print
+ */
+
+ public static void print(String s) {
+ System.out.print(s);
+ }
+
+ /**
+ * Prints a newline to System.out.
+ */
+
+ public static void newline() {
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java
new file mode 100644
index 000000000..a1f5eafba
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements basic string manipulation facilities.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 03/29/04
+ */
+
+public class StringTransformer {
+
+ /**
+ * Transforms a string to upper case
+ *
+ * @param s the string to transform
+ * @returns the transformed string
+ */
+
+ public static String transformToUpper(String s) {
+ return s.toUpperCase();
+ }
+
+ /**
+ * Transforms a string to lower case
+ *
+ * @param s the string to transform
+ * @returns the transformed string
+ */
+
+ public static String transformToLower(String s) {
+ return s.toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java
new file mode 100644
index 000000000..8425bc762
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java
@@ -0,0 +1,44 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a static method that returns a decorator string.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class Decoration {
+
+ /**
+ * Provides a decorator string consisting of stars ("*").
+ *
+ * @returns a decorator string made up of stars
+ */
+
+ public static String getDecoration() {
+ return "*******************************************";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java
new file mode 100644
index 000000000..36d7c0b4c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Facade design pattern example.<p>
+ *
+ * Intent: <i>Provide a unified interface to a set of interfaces in a
+ * subsystem. Facade defines a higher-level interface that makes the
+ * subsystem easier to use.</i><p>
+ *
+ * The <i>subsystem</i> consists of three classes that provide low-level
+ * string manipulation and output functionality: <code>RegularScreen</code>,
+ * <code>Decoration</code>, and <code>StringTransformer</code>. The <i>Facade
+ * </i> class <code>OutputFacade</code> procides a higher-level interface
+ * to output strings. This class calls methods on that higer-level interface.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/29/04
+ */
+
+public class Main {
+
+ /**
+ * Tests the higher-level interface of <code>OutputFacade</code>.
+ *
+ * @param args Command-line parameters, ignored here
+ */
+
+ public static void main(String[] args) {
+ OutputFacade facade = new OutputFacade();
+
+ System.out.println("Testing Facade...");
+ facade.printDecoration();
+
+ facade.printNormal("Facade: this is normal printing");
+ facade.printFancy ("Facade: this is fancy printing");
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java
new file mode 100644
index 000000000..30c1bd8b5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>Facade</i> role in the pattern by providing a
+ * higher-level interface to the operations provided by
+ * <code>RegularScreen</code>, <code>Decoration</code>,
+ * and <code>StringTransformer</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class OutputFacade {
+
+ /**
+ * Prints a string using <code>RegularScreen</code>.
+ *
+ * @param s the string to print
+ */
+
+ public void printNormal(String s) {
+ RegularScreen.print(s);
+ RegularScreen.newline();
+ }
+
+ /**
+ * Prints a two versions of string with decorations
+ * using <code>RegularScreen</code> and <code>Decoration</code>.
+ *
+ * @param s the string to print
+ */
+
+ public void printFancy(String s) {
+ printDecoration();
+
+ RegularScreen.print(StringTransformer.transformToUpper(s+" (uppercase)"));
+ RegularScreen.newline();
+
+ printDecoration();
+
+ RegularScreen.print(StringTransformer.transformToLower(s+" (lowercase)"));
+ RegularScreen.newline();
+
+ printDecoration();
+ }
+
+ /**
+ * Prints a decorator string.
+ */
+
+ public void printDecoration() {
+ RegularScreen.print(Decoration.getDecoration());
+ RegularScreen.newline();
+ RegularScreen.newline();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java
new file mode 100644
index 000000000..acd753598
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java
@@ -0,0 +1,52 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a low-level interface for printing to System.out.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class RegularScreen {
+
+ /**
+ * Prints a string to System.out.
+ *
+ * @param s the string to print
+ */
+
+ public static void print(String s) {
+ System.out.print(s);
+ }
+
+ /**
+ * Prints a newline to System.out.
+ */
+
+ public static void newline() {
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java
new file mode 100644
index 000000000..1353cfaa4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java
@@ -0,0 +1,56 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.facade.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements basic string manipulation facilities.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class StringTransformer {
+
+ /**
+ * Transforms a string to upper case
+ *
+ * @param s the string to transform
+ * @returns the transformed string
+ */
+
+ public static String transformToUpper(String s) {
+ return s.toUpperCase();
+ }
+
+ /**
+ * Transforms a string to lower case
+ *
+ * @param s the string to transform
+ * @returns the transformed string
+ */
+
+ public static String transformToLower(String s) {
+ return s.toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java
new file mode 100644
index 000000000..d8966e882
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java
@@ -0,0 +1,62 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JComponent;
+/**
+ * This aspect changes the behavior of a <i>Factory Method</i> using
+ * <code>around</code> advice. With this approach it is possible to
+ * have the factories create different products depending on the
+ * aspects woven into the project. For example, this could be used
+ * as a very basic approach to software configuration management.
+ *
+ * In this case, two slightly different label products are produced,
+ * depending on whether this aspect is woven into the system or not.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public aspect AlternateLabelCreatorImplementation {
+
+ /**
+ * Describes the factory method for which we want to
+ * modify the product
+ */
+
+ pointcut labelCreation():
+ execution(JComponent LabelCreator.createComponent());
+
+ /**
+ * Creates the product, modifies it and passes the
+ * modified product on.
+ */
+
+ JComponent around(): labelCreation() {
+ JLabel label = (JLabel) proceed();
+ label.setText("This is an alternate JLabel");
+ return label;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java
new file mode 100644
index 000000000..673023831
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Implements a <i>ConcreteCreator</i> that creates buttons.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see LabelCreator
+ */
+
+public class ButtonCreator implements GUIComponentCreator {
+
+ /**
+ * Factory method that creates a button with label and <code>
+ * ActionListener</code>.
+ *
+ * @returns the created button
+ */
+
+ public JComponent createComponent() {
+ final JButton button = new JButton("Click me!");
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ button.setText("Thank you!");
+ }
+ });
+ return button;
+ }
+
+ /**
+ * Returns a title explaining this example.
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public String getTitle() {
+ return "Example 1: A JButton";
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java
new file mode 100644
index 000000000..0b8669cfc
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java
@@ -0,0 +1,77 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JComponent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.Point;
+
+/**
+ * Provides a default implementation for the <i>anOperation()</i>
+ * method <code>showFrame()</code>. The implementation is attached to the
+ * <code>GUIComponentCreator</code> interface. With this approach,
+ * <i>GUIComponentCreator</i> does not have to be an abstract class.
+ *
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see GUIComponentCreator
+ */
+
+public aspect CreatorImplementation {
+
+ /**
+ * the position for the next frame to be created (on the screen)
+ */
+
+ private static Point lastFrameLocation = new Point(0, 0);
+
+ /**
+ * Creates a <code>JFrame</code>, puts the <code>JComponent</code> that
+ * is created by the factory method into it and displays the frame. This
+ * Method also provides a <code>WindowListener</code>.
+ */
+
+ public final void GUIComponentCreator.showFrame() {
+ JFrame frame = new JFrame(getTitle());
+
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ JPanel panel = new JPanel();
+
+ panel.add(createComponent());
+
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setLocation(lastFrameLocation);
+ lastFrameLocation.translate(75, 75);
+ frame.setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java
new file mode 100644
index 000000000..a2287ef6a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java
@@ -0,0 +1,66 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JComponent;
+
+/**
+ * Defines the <i>GUIComponentCreator</i> interface with the
+ * <i>factoryMethod()</i> method signature and the <i>anOperation()</i>
+ * method that uses it. For details, see GoF, page 108.<p>
+ *
+ * The factory method is <code>createComponent</code> and it creates
+ * A JComponent (a button and a label, repsectively). The <i>anOperation()</i>
+ * method is implemented by the aspect, allowing this type to be an interface,
+ * not an abstract class
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see ButtonCreator
+ * @see LabelCreator
+ */
+
+public interface GUIComponentCreator {
+
+ /**
+ * The factory method to create <code>JComponent</code>s, to be
+ * concretized by subclasses.
+ *
+ * @returns the created product
+ */
+
+ public JComponent createComponent();
+
+ /**
+ * Another factory method to create a title that explains the created
+ * component
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public String getTitle();
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java
new file mode 100644
index 000000000..200ec456d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java
@@ -0,0 +1,60 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JComponent;
+
+/**
+ * Implements a <i>ConcreteCreator</i> that creates labels.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see ButtonCreator
+ */
+
+public class LabelCreator implements GUIComponentCreator {
+
+ /**
+ * Factory method that creates a label
+ *
+ * @returns the created label
+ */
+
+ public JComponent createComponent() {
+ JLabel label = new JLabel("This is a JLabel.");
+ return label;
+ }
+
+ /**
+ * Returns a title explaining this example.
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public String getTitle() {
+ return "Example 2: A JLabel";
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java
new file mode 100644
index 000000000..8ae2a2f3a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the FactoryMethod design pattern example.<p>
+ *
+ * Intent: <i>Define an interface for creating an object, but let subclasses
+ * decide which class to instantiate. Factory Method lets a class defer
+ * instantiation to subclasses.</i><p>
+ *
+ * Participating objects are <code>ButtonCreator</code> and
+ * <code>LabelCreator</code> as <i>ConcreteCreator</i>s. Both implement
+ * the <code>GUIComponentCreator</code> interface.<p>
+ *
+ * In this example, the factory method <code>createComponent</code> creates
+ * A JComponent (a button and a label, respectively). The <i>anOperation()</i>
+ * method <code>showFrame()</code> uses the factory method to show a little
+ * GUI. In one case, the created frame contains a button, in the other a
+ * simple label.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Since the implementation of the <i>anOperation()</i> method <code>
+ * showFrame()</code> is now realized by an aspect,
+ * <code>GUIComponentCreator</code> can now be an interface, allowing
+ * the <i>ConcreteCreator</i>s to be part of a different inheritance
+ * hierarchy.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see GUIComponentCreator
+ * @see ButtonCreator
+ * @see LabelCreator
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the FactoryMethod design pattern example.<p>
+ *
+ * In this example, the factory method <code>createComponent</code>
+ * creates a JComponent (a button and a label, repsectively). The
+ * <i>anOperation()</i> method <code>showFrame()</code> uses the factory
+ * methods to show a little GUI. In one case, the created frame contains
+ * a button, in the other a simple label.
+ */
+
+ public static void main(String[] args) {
+
+ GUIComponentCreator creator1 = new ButtonCreator();
+ GUIComponentCreator creator2 = new LabelCreator();
+
+ creator1.showFrame();
+ creator2.showFrame();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java
new file mode 100644
index 000000000..7346fdb09
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Implements a <i>ConcreteCreator</i> that creates buttons.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see LabelCreator
+ */
+
+public class ButtonCreator extends GUIComponentCreator {
+
+ /**
+ * Factory method that creates a button with label and <code>
+ * ActionListener</code>.
+ *
+ * @returns the created button
+ */
+
+ public JComponent createComponent() {
+ final JButton button = new JButton("Click me!");
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ button.setText("Thank you!");
+ }
+ });
+ return button;
+ }
+
+ /**
+ * Returns a title explaining this example.
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public String getTitle() {
+ return "Example 1: A JButton";
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java
new file mode 100644
index 000000000..9a4b0101d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java
@@ -0,0 +1,102 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JComponent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.Point;
+
+/**
+ * Defines the <i>GUIComponentCreator</i> interface with the
+ * <i>factoryMethod()</i> method signature and the <i>anOperation()</i>
+ * method that uses it. For details, see GoF, page 108.<p>
+ *
+ * The factory method is <code>createComponent</code> and it creates
+ * A JComponent (a button or a label, in this case). The <i>anOperation()</i>
+ * method <code>showFrame()</code> uses the factory method to show a small
+ * GUI.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see ButtonCreator
+ * @see LabelCreator
+ */
+
+public abstract class GUIComponentCreator {
+
+ /**
+ * The factory method to be concretized by subclasses.
+ *
+ * @returns the created <i>ConcreteProduct</i>
+ */
+
+ public abstract JComponent createComponent();
+
+ /**
+ * Another factory method to create a title for the GUI frame created
+ * by this class.
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public abstract String getTitle();
+
+ /**
+ * the position for the next frame to be created (on the screen). This
+ * variable is used to make sure new frames appear staggered and don't
+ * entirely overlap with existing frames.
+ */
+
+ private static Point lastFrameLocation = new Point(0, 0);
+
+ /**
+ * Creates a <code>JFrame</code>, puts the <code>JComponent</code> that
+ * is created by the factory method into it and displays the frame. This
+ * Method also provides a <code>WindowListener</code>.
+ */
+
+ public final void showFrame() {
+ JFrame frame = new JFrame(getTitle());
+
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ JPanel panel = new JPanel();
+
+ panel.add(createComponent());
+
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setLocation(lastFrameLocation);
+ lastFrameLocation.translate(75, 75);
+ frame.setVisible(true);
+ }
+}
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java
new file mode 100644
index 000000000..40bbd8b8c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java
@@ -0,0 +1,60 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JLabel;
+import javax.swing.JComponent;
+
+/**
+ * Implements a <i>ConcreteCreator</i> that creates labels.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see ButtonCreator
+ */
+
+public class LabelCreator extends GUIComponentCreator {
+
+ /**
+ * Factory method that creates a label.
+ *
+ * @returns the created label
+ */
+
+ public JComponent createComponent() {
+ JLabel label = new JLabel("This is a JLabel.");
+ return label;
+ }
+
+ /**
+ * Returns a title explaining this example.
+ *
+ * @returns the title for the GUI frame
+ */
+
+ public String getTitle() {
+ return "Example 2: A JLabel";
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java
new file mode 100644
index 000000000..a068f8f7d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the FactoryMethod design pattern example.<p>
+ *
+ * Intent: <i>Define an interface for creating an object, but let subclasses
+ * decide which class to instantiate. Factory Method lets a class defer
+ * instantiation to subclasses.</i><p>
+ *
+ * Participating objects are <code>ButtonCreator</code> and
+ * <code>LabelCreator</code> as <i>ConcreteCreator</i>s. Both implement
+ * the <code>GUIComponentCreator</code> interface.<p>
+ *
+ * In this example, the factory method <code>createComponent</code> creates
+ * A JComponent (a button and a label, respectively). The <i>anOperation()</i>
+ * method <code>showFrame()</code> uses the factory method to show a little
+ * GUI. In one case, the created frame contains a button, in the other a
+ * simple label.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Since the <i>anOperation()</i> method requires an implementation, <i>
+ * GUIComponentCreator</i> has to be an abstract class (as opposed to an
+ * interface). Consequently, all <i>ConcreteCreator</i>s have to be
+ * subclasses of that class and cannot belong to a different inheritance
+ * hierarchy.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see GUIComponentCreator
+ * @see ButtonCreator
+ * @see LabelCreator
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the FactoryMethod design pattern example.<p>
+ *
+ * In this example, the factory method <code>createComponent</code>
+ * creates a JComponent (a button and a label, repsectively). The
+ * <i>anOperation()</i> method <code>showFrame()</code> uses the factory
+ * methods to show a little GUI. In one case, the created frame contains
+ * a button, in the other a simple label.
+ */
+
+ public static void main(String[] args) {
+
+ GUIComponentCreator creator1 = new ButtonCreator();
+ GUIComponentCreator creator2 = new LabelCreator();
+
+ creator1.showFrame();
+ creator2.showFrame();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java
new file mode 100644
index 000000000..7e024edf8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java
@@ -0,0 +1,64 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+/**
+ * A <i>ConcreteFlyweight</i> storing a single regular character
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class CharacterFlyweight implements PrintableFlyweight {
+
+ /**
+ * The character this <i>ConcreteFlyweight</i> represents
+ */
+
+ private char c;
+
+
+ /**
+ * Creates a new <i>ConcreteFlyweight</i> and sets it to represent a
+ * particular regular character
+ *
+ * @param c the character to represent
+ */
+
+ public CharacterFlyweight(char c) {
+ this.c = c;
+ }
+
+ /**
+ * Prints the stored character
+ *
+ * @param uppercase whether the character should be printed in
+ * uppercase
+ */
+
+ public void print(boolean uppercase) {
+ System.out.print(uppercase ? Character.toUpperCase(c) : c);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java
new file mode 100644
index 000000000..f3ecc43a0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java
@@ -0,0 +1,89 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.FlyweightProtocol;
+
+/**
+ * Implements a concrete instance of the flyweight pattern using the
+ * abstract implementation found in <code>FlyweightProtocol</code>.
+ *
+ * It assigns the <i>Flyweight</i> pattern role to the participants and
+ * provides the implementation for creating <i>Flyweight</i>s.
+ *
+ * A concenience method is provided to utilize the abstract aspect's
+ * <i>getFlyweight(...)</i> implementation with an appropriate return type.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+
+public aspect FlyweightImplementation extends FlyweightProtocol {
+
+ /**
+ * Assigns the <i>Flyweight</i> role to CharacterFlyweight.
+ */
+
+ declare parents: CharacterFlyweight implements Flyweight;
+
+ /**
+ * Assigns the <i>Flyweight</i> role to WhitespaceFlyweight.
+ */
+
+ declare parents: WhitespaceFlyweight implements Flyweight;
+
+ /**
+ * Actually creates the <i>Flyweight</i> for a given <i>Key</i>. This
+ * method is called by <code>getFlyweight(Object)</code> if the
+ * flyweight does not already exist.
+ *
+ * @param key the key identifying the particular <i>Flyweight</i>
+ * @return the <i>Flyweight</i> representing the key
+ */
+
+ protected Flyweight createFlyweight(Object key) {
+ char c = ((Character) key).charValue();
+ Flyweight flyweight = null;
+ if (Character.isWhitespace(c)) {
+ flyweight = new WhitespaceFlyweight(c);
+ } else {
+ flyweight = new CharacterFlyweight(c);
+ }
+ return flyweight;
+ }
+
+ /**
+ * Provides a custom interface to access the <i>Flyweights</i>.
+ * Refers to the general <code>getFlyweight(Object)</code> method
+ * defined on the abstract aspect.
+ *
+ * @param c the character identifying the particular flyweight
+ * @return the flyweight representing the character
+ */
+
+ public PrintableFlyweight getPrintableFlyweight(char c) {
+ return (PrintableFlyweight) getFlyweight(new Character(c));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java
new file mode 100644
index 000000000..dce3cd0dd
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java
@@ -0,0 +1,114 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Flyweight design pattern example.<p>
+ *
+ * Intent: <i>Use sharing to support large numbers of fine-grained objects
+ * efficiently.</i><p>
+ *
+ * Participating <i>Flyweight</i> classes are <code>CharacterFlyweight</code>
+ * and <code>WhitespaceFlyweight</code>. Both implement the <code>
+ * PrintableFlyweight</code> interface. Flyweights are generated via the
+ * <code>PrintableFlyweightFactory</code>. <P>
+ *
+ * Intrinsic state: The character to print,
+ * Extrinsic state: Whether the char is upper case or lower case
+ *
+ * This example creates a sentence out of <code>PrintableFlyweight</i>s
+ * (characters and whitespaces).
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * The creation-on-demand functionality is performed by the abstract
+ * pattern aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweight
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Flyweight design pattern example.<p>
+ *
+ * This example creates a sentence out of <code>PrintableFlyweight</i>s
+ * (characters and whitespaces).
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("This is a test for the AspectJ version of the "
+ + "Flyweight pattern implementation.");
+ System.out.println("The client will use char flyweights to print "
+ + "the phrase");
+ System.out.println("\"This Is A Test\".\n");
+ System.out.println("Testing Pattern: Flyweight - STARTING\n");
+
+ PrintableFlyweight T =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('t');
+ PrintableFlyweight H =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('h');
+ PrintableFlyweight I =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('i');
+ PrintableFlyweight S =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('s');
+ PrintableFlyweight A =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('a');
+ PrintableFlyweight E =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight('e');
+ PrintableFlyweight Empty =
+ FlyweightImplementation.aspectOf().getPrintableFlyweight(' ');
+
+ // Printing: "This Is A Test"
+
+ T.print(true);
+ H.print(false);
+ I.print(false);
+ S.print(false);
+
+ Empty.print(true);
+
+ I.print(true);
+ S.print(false);
+
+ Empty.print(true);
+
+ A.print(true);
+
+ Empty.print(true);
+
+ T.print(true);
+ E.print(false);
+ S.print(false);
+ T.print(false);
+
+ System.out.println();
+
+ System.out.println("\nTesting Pattern: State - FINISHED");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java
new file mode 100644
index 000000000..35aba15e1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java
@@ -0,0 +1,44 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the <i>Flyweight</i> interface. Here, the flyweights are
+ * characters that offer a single method: <code>print(boolean)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public interface PrintableFlyweight {
+
+ /**
+ * Defines the method signature for <i>Flyweights</i>'
+ * <code>print()</code> method
+ *
+ * @param uppercase whether the character is to be printed as uppercase
+ */
+
+ public void print(boolean uppercase);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java
new file mode 100644
index 000000000..0c4066223
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java
@@ -0,0 +1,66 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * A <i>ConcreteFlyweight</i> storing a single whitespace
+ * character
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweightFactory
+ */
+
+public class WhitespaceFlyweight implements PrintableFlyweight {
+
+
+ /**
+ * The character this flyweight represents
+ */
+
+ private char c;
+
+ /**
+ * Creates a new flyweight and sets it to represent a particular
+ * whitespace character
+ *
+ * @param c the character to represent
+ */
+
+ public WhitespaceFlyweight(char c) {
+ this.c = c;
+ }
+
+ /**
+ * Prints the stored character
+ *
+ * @param uppercase whether the character should be printed in
+ * uppercase
+ */
+
+ public void print(boolean uppercase) {
+ System.out.print(uppercase ? Character.toUpperCase(c) : c);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java
new file mode 100644
index 000000000..6c61d4fd6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * A <i>ConcreteFlyweight</i> storing a single regular character
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweightFactory
+ */
+
+public class CharacterFlyweight implements PrintableFlyweight {
+
+ /**
+ * The character this <i>ConcreteFlyweight</i> represents
+ */
+
+ private char c;
+
+
+ /**
+ * Creates a new CharacterFlyweight and sets it to represent a
+ * particular character
+ *
+ * @param c the character to represent
+ */
+
+ public CharacterFlyweight(char c) {
+ this.c = c;
+ }
+
+ /**
+ * Prints the stored character.
+ *
+ * @param uppercase whether the character should be printed in
+ * uppercase
+ */
+
+ public void print(boolean uppercase) {
+ System.out.print(uppercase ? Character.toUpperCase(c) : c);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java
new file mode 100644
index 000000000..23be7e85e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java
@@ -0,0 +1,122 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Flyweight design pattern example.<p>
+ *
+ * Intent: <i>Use sharing to support large numbers of fine-grained objects
+ * efficiently.</i><p>
+ *
+ * Participating <i>Flyweight</i> classes are <code>CharacterFlyweight</code>
+ * and <code>WhitespaceFlyweight</code>. Both implement the <code>
+ * PrintableFlyweight</code> interface. Flyweights are generated via the
+ * <code>PrintableFlyweightFactory</code>. <P>
+ *
+ * These are the pattern roles: <UL>
+ *
+ * <LI> CharacterFlyweightFactory: FlyweightFactory
+ * <LI> PritableFlyweight: Flyweight
+ * <LI> CharacterFlyweight: ConcreteFlyweight
+ * <LI> WhitespaceFlyweight: ConcreteFlyweight
+ * <LI> Main: Client
+ * </UL>
+ *
+ * Intrinsic state: The character to print,
+ * Extrinsic state: Whether the char is upper case or lower case
+ *
+ * This example creates a sentence out of <code>PrintableFlyweight</i>s
+ * (characters and whitespaces).
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * This implementation is analoguous to the GoF book's description.
+ * For this version, we only use two classes for the flyweights,
+ * CharacterFlyweight and WhitespaceFlyweight. Plus, this implementation
+ * uses an optimized factory that keeps a hashtable of created Flyweights
+ * and employs creation of demand.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweight
+ * @see PrintableFlyweightFactory
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Flyweight design pattern example.<p>
+ *
+ * This example creates a sentence out of <code>PrintableFlyweight</i>s
+ * (characters and whitespaces).
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("This is a test for the java Flyweight pattern "
+ + "implementation.");
+ System.out.println("The client will use char flyweights to print the "
+ + "phrase");
+ System.out.println("\"This Is A Test\".\n");
+ System.out.println("Testing Pattern: Flyweight - STARTING\n");
+
+ PrintableFlyweightFactory pff = new PrintableFlyweightFactory();
+
+ PrintableFlyweight T = pff.getPrintableFlyweight('t');
+ PrintableFlyweight H = pff.getPrintableFlyweight('h');
+ PrintableFlyweight I = pff.getPrintableFlyweight('i');
+ PrintableFlyweight S = pff.getPrintableFlyweight('s');
+ PrintableFlyweight A = pff.getPrintableFlyweight('a');
+ PrintableFlyweight E = pff.getPrintableFlyweight('e');
+ PrintableFlyweight Empty = pff.getPrintableFlyweight(' ');
+
+ // Printing: "This Is A Test"
+
+ T.print(true);
+ H.print(false);
+ I.print(false);
+ S.print(false);
+
+ Empty.print(true);
+
+ I.print(true);
+ S.print(false);
+
+ Empty.print(true);
+
+ A.print(true);
+
+ Empty.print(true);
+
+ T.print(true);
+ E.print(false);
+ S.print(false);
+ T.print(false);
+
+ System.out.println();
+
+ System.out.println("\nTesting Pattern: State - FINISHED");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java
new file mode 100644
index 000000000..89e8b8e8c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java
@@ -0,0 +1,46 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the <i>Flyweight</i> interface. Here, the flyweights are
+ * characters that offer a single method: <code>print(boolean)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweightFactory
+ */
+
+public interface PrintableFlyweight {
+
+ /**
+ * Defines the method signature for <i>Flyweights</i>'
+ * <code>print()</code> method
+ *
+ * @param uppercase whether the character is to be printed as uppercase
+ */
+
+ public void print(boolean uppercase);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java
new file mode 100644
index 000000000..56bfe74cc
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Implements a <i>FlyweightFactory</i> that employs a creation-on-demand
+ * policy.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweight
+ */
+
+public class PrintableFlyweightFactory {
+
+ /**
+ * stores the existing flyweights by character they represent
+ */
+
+ private Hashtable printables = new Hashtable();
+
+ /**
+ * Returns the flyweight representing the argument character.
+ * If the appropriate flyweight does not yet exist, it is created
+ * on demand.
+ *
+ * @param c the character for which the the flyweight is returned
+ * @return the <i>Flyweight</i> representing the argument character
+ */
+
+ public PrintableFlyweight getPrintableFlyweight(char c) {
+
+ Character ch = new Character(c);
+
+ if (printables.containsKey(ch)) {
+ return (PrintableFlyweight) printables.get(ch);
+ } else {
+ PrintableFlyweight flyweight = null;
+ if (Character.isWhitespace(c)) {
+ flyweight = new WhitespaceFlyweight(c);
+ } else {
+ flyweight = new CharacterFlyweight(c);
+ }
+ printables.put(ch, flyweight);
+ return flyweight;
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java
new file mode 100644
index 000000000..dfc1d4484
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java
@@ -0,0 +1,66 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * A <i>ConcreteFlyweight</i> storing a single whitespace
+ * character
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see PrintableFlyweightFactory
+ */
+
+public class WhitespaceFlyweight implements PrintableFlyweight {
+
+
+ /**
+ * The character this flyweight represents
+ */
+
+ private char c;
+
+ /**
+ * Creates a new flyweight and sets it to represent a particular
+ * whitespace character
+ *
+ * @param c the character to represent
+ */
+
+ public WhitespaceFlyweight(char c) {
+ this.c = c;
+ }
+
+ /**
+ * Prints the stored character.
+ *
+ * @param uppercase whether the character should be printed in
+ * uppercase
+ */
+
+ public void print(boolean uppercase) {
+ System.out.print(uppercase ? Character.toUpperCase(c) : c);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java
new file mode 100644
index 000000000..5ddb4fcf2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java
@@ -0,0 +1,70 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements AND expressions for booleans. This is a concrete boolean
+ * <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class AndExpression implements BooleanExpression {
+
+ /**
+ * stores the first part of this AND <i>Expression</i>
+ */
+
+ protected BooleanExpression expression1;
+
+ /**
+ * stores the second part of this AND <i>Expression</i>
+ */
+
+ protected BooleanExpression expression2;
+
+ /**
+ * Creates a new AND <i>Expression</i> with the given parts
+ *
+ * @param op1 the first <i>Expression</i>
+ * @param op1 the second <i>Expression</i>
+ */
+
+ public AndExpression(BooleanExpression op1, BooleanExpression op2) {
+ this.expression1 = op1;
+ this.expression2 = op2;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (expression1.evaluate(c) && expression2.evaluate(c));
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java
new file mode 100644
index 000000000..685595dba
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements boolean constants, a concrete boolean <i>TerminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class BooleanConstant implements BooleanExpression {
+
+ /**
+ * the value of this constant
+ */
+
+ protected boolean value;
+
+ /**
+ * Creates a new constant with the given value
+ *
+ * @param value the value this constant should represent
+ */
+
+ public BooleanConstant(boolean value) {
+ this.value = value;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>.
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return value;
+ }
+
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java
new file mode 100644
index 000000000..3ec0fbf54
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the <i>AbstractExpression</i> interface for boolean expressions.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public abstract interface BooleanExpression {
+
+ /**
+ * Evaluates this expression in the given <i>VariableContext</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c);
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp);
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java
new file mode 100644
index 000000000..a3e5b809e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java
@@ -0,0 +1,185 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements <code>replace(String, BooleanExpression)<code> and
+ * <code>copy()</code> methods for all concrete
+ * <code>BooleanExpression</code>s.
+ *
+ * The very nature of the interpreter pattern introduces coupling between all
+ * participants. Unfortunately, removing the pattern code from the
+ * participants does not work as nicely here as with other patterns. The
+ * reason is that the roles are defining, i.e., each participant's
+ * functionality is determined (only) by its role. If aspects were used
+ * to implement the entire pattern functionality, it would leave
+ * the <i>Expressions</i> etc. empty and would make the aspect a
+ * monolithic module. <p>
+ *
+ * However, it is still possible to augment or change the behaviour of the
+ * system without changing all participant classes. To show this, we
+ * assumed that <code>BooleanExpression.replace(String, BooleanExpression)
+ * </code> and <code>BooleanExpression.copy()</code> were added later.
+ * An aspect is used to implement those methods, so that other
+ * classes do not have to change (we only changed the interface, but
+ * even that was not necessary).<p>
+ *
+ * In general, however, this pattern does not lend itself nicely to
+ * aspectification.<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see BooleanExpression
+ */
+
+public aspect BooleanInterpretation {
+
+ // AndExpressionression
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression AndExpression.replace(String name, BooleanExpression exp) {
+ return new AndExpression(expression1.replace(name, exp), expression2.replace(name,exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression AndExpression.copy() {
+ return new AndExpression(expression1.copy(), expression2.copy());
+ }
+
+ // BooleanConstant
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ * Has no effect on constants.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return the unchanged expression
+ */
+
+ public BooleanExpression BooleanConstant.replace(String name, BooleanExpression exp) {
+ return this;
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression BooleanConstant.copy() {
+ return new BooleanConstant(value);
+ }
+
+ // OrExpression
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression OrExpression.replace(String name, BooleanExpression exp) {
+ return new OrExpression(expression1.replace(name, exp), expression2.replace(name,exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression OrExpression.copy() {
+ return new OrExpression(expression1.copy(), expression2.copy());
+ }
+
+ // VariableExpression
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression VariableExpression.replace(String name, BooleanExpression exp) {
+ if (name.equals(this.name)) {
+ return exp.copy();
+ } else {
+ return new VariableExpression(this.name);
+ }
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression VariableExpression.copy() {
+ return new VariableExpression(name);
+ }
+
+ // NotExpressionressionressionression
+
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression NotExpression.replace(String name, BooleanExpression exp) {
+ return new NotExpression(this.exp.replace(name, exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression NotExpression.copy() {
+ return new NotExpression(exp.copy());
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java
new file mode 100644
index 000000000..61cda48ad
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an exception that gets raised when the interpreter
+ * runs into errors.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class ExpressionException extends RuntimeException {
+
+ /**
+ * Creates a new ExpressionException with the given message
+ *
+ * @param s the exception message
+ */
+
+ public ExpressionException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java
new file mode 100644
index 000000000..3a0c6f232
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java
@@ -0,0 +1,131 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Intepreter design pattern example.<p>
+ *
+ * Intent: <i>Given a language, defeine a representation fro its grammar along
+ * with an interpreter that uses the representation to interpret sentences
+ * in the language.</i><p>
+ *
+ * Participating objects are <code>BooleanContant</code>, <code>VariableExpression
+ * </code>, <code>OrExpression</code>, <code>AndExpression</code>, and <code>NotExpression</code>
+ * as <i>Expressions</i>. The <i>AbstractExpression</i> interface is defined
+ * in <code>BooelanExp</i>.<p>
+ *
+ * This example implements an interpreter for a language of boolean
+ * expressions. As a sample expression, "((true & x) | (y & !x))" is
+ * interpreted for all possible boolean values for x and y. After that,
+ * y is replaced by another expression and the whole expression is
+ * evaluated again.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * The very nature of this pattern introduces coupling between all
+ * participants. Unfortunately, removing the pattern code from the
+ * participants does not work as nicely here as with other patterns. The
+ * reason is that the roles are defining, i.e., each participant's
+ * functionality is determined (only) by its role. Removing pattern
+ * specific code into an aspect would leave the <i>Expressions</i> etc.
+ * empty and would make the aspect a monolithic module. <p>
+ *
+ * However, it is still possible to augment or change the behaviour of the
+ * system without changing all participant classes. To show this, we
+ * assumed that <code>BooleanExpression.replace(String, BooleanExpression)</code> and
+ * <code>BooleanExpression.copy()</code> were added later. The methods are
+ * defined in an aspect, so that other classes did not have to change.<p>
+ *
+ * In general, however, this pattern does not lend itself nicely to
+ * aspectification.<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see BooleanExpression
+ */
+
+public class Main {
+
+ /**
+ * Assigns boolean values to two <code>VariableExpression</code>s and evaluates
+ * an expression in the given context.
+ *
+ * @param x a boolean variable expression
+ * @param xValue the value to assign to x
+ * @param y another boolean variable expression
+ * @param yValue the value to assign to y
+ * @param context the context to evaluate the expression in
+ * @param exp the expression to evaluate
+ */
+
+ private static void assignAndEvaluate( VariableExpression x, boolean xValue,
+ VariableExpression y, boolean yValue,
+ VariableContext context, BooleanExpression exp) {
+ context.assign(x, xValue);
+ context.assign(y, yValue);
+ boolean result = exp.evaluate(context);
+ System.out.println("The result for (x="+xValue+", y="+yValue+") is: "+result);
+ }
+
+ /**
+ * Implements the driver for the Intepreter design pattern example.<p>
+ *
+ * This example implements an interpreter for a language of boolean
+ * expressions. As a sample expression, "((true & x) | (y & !x))" is
+ * interpreted for all possible boolean values for x and y. After that,
+ * y is replaced by another expression and the whole expression is
+ * evaluated again.
+ *
+ * @args command-line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+ BooleanExpression exp = null;
+ VariableContext context = new VariableContext();
+
+ VariableExpression x = new VariableExpression("X");
+ VariableExpression y = new VariableExpression("Y");
+
+ exp = new OrExpression(new AndExpression(new BooleanConstant(true), x),
+ new AndExpression(y, new NotExpression(x)));
+
+ System.out.println("Testing Expr: ((true & x) | (y & !x))");
+
+ assignAndEvaluate(x, false, y, false, context, exp);
+ assignAndEvaluate(x, false, y, true, context, exp);
+ assignAndEvaluate(x, true, y, false, context, exp);
+ assignAndEvaluate(x, true, y, true, context, exp);
+
+ VariableExpression z = new VariableExpression("Z");
+ NotExpression notZ = new NotExpression(z);
+
+ BooleanExpression replacement = exp.replace("Y", notZ);
+ context.assign(z, false);
+ boolean result = replacement.evaluate(context);
+
+ System.out.println("The result for the replacement is: "+result);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java
new file mode 100644
index 000000000..817fd85f7
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements negation for booleans expressions. This is a concrete boolean
+ * <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class NotExpression implements BooleanExpression {
+
+ /**
+ * the <i>Expression</i> this <i>Expression</i> negates
+ */
+
+ protected BooleanExpression exp = null;
+
+ /**
+ * Creates a new NOT <i>Expression</i> negating the argument expression
+ *
+ * @param exp the <i>Expression</i> to negate
+ */
+
+ public NotExpression(BooleanExpression exp) {
+ this.exp = exp;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given
+ * <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (! exp.evaluate(c));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java
new file mode 100644
index 000000000..e8b7b6e0a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java
@@ -0,0 +1,70 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an OR <i>Expression</i> for booleans.
+ * This is a concrete boolean <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class OrExpression implements BooleanExpression {
+
+ /**
+ * stores the first part of this OR <i>Expression</i>
+ */
+
+ protected BooleanExpression expression1;
+
+ /**
+ * stores the second part of this OR <i>Expression</i>
+ */
+
+ protected BooleanExpression expression2;
+
+ /**
+ * Creates a new OR <i>Expression</i> with the given parts
+ *
+ * @param op1 the first <i>Expression</i>
+ * @param op1 the second <i>Expression</i>
+ */
+
+ public OrExpression(BooleanExpression op1, BooleanExpression op2) {
+ this.expression1 = op1;
+ this.expression2 = op2;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (expression1.evaluate(c) || expression2.evaluate(c));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java
new file mode 100644
index 000000000..51c2a3f54
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java
@@ -0,0 +1,71 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Implements a <i>VariableContext</i> for the interpretation of boolean
+ * expressions<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see BooleanExpression
+ */
+
+public class VariableContext {
+
+ /**
+ * stores the mapping between variable names and values
+ */
+
+ protected Hashtable assignments = new Hashtable();
+
+ /**
+ * Returns the current value for a variable
+ *
+ * @param name the name of the variable
+ * @returns the value of the variable
+ */
+
+ public boolean lookup(String name) {
+ Boolean value = (Boolean) assignments.get(name);
+ if (value == null) {
+ throw new ExpressionException("No variable \""+name+"\" declared.");
+ }
+ return value.booleanValue();
+ }
+
+ /**
+ * Assigns a boolean value to a <code>VariableExpression</code>
+ *
+ * @param varExp the varaible expression to assign a value to
+ * @param bool the boolean value to assign
+ */
+
+ public void assign(VariableExpression varExp, boolean bool) {
+ assignments.put(varExp.getName(), new Boolean(bool));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java
new file mode 100644
index 000000000..48668bb6b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java
@@ -0,0 +1,73 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a variable expression for booleans. This is a concrete
+ * boolean <i>NonterminalExpression</i>
+ * expression
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class VariableExpression implements BooleanExpression {
+
+ /**
+ * the name of the variable this object represents
+ */
+
+ protected String name = null;
+
+ /**
+ * Creates a new variable <i>Expression</i> with a given name
+ *
+ * @param name the name of the new variable
+ */
+
+ public VariableExpression(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Accessor for the variable's name
+ *
+ * @return the name of the variable
+ */
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return c.lookup(name);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java
new file mode 100644
index 000000000..89b5243e6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements AND expressions for booleans. This is a concrete boolean
+ * <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class AndExpression implements BooleanExpression {
+
+ /**
+ * stores the first part of this AND <i>Expression</i>
+ */
+
+ protected BooleanExpression expression1;
+
+ /**
+ * stores the second part of this AND <i>Expression</i>
+ */
+
+ protected BooleanExpression expression2;
+
+ /**
+ * Creates a new AND <i>Expression</i> with the given parts
+ *
+ * @param expression1 the first <i>Expression</i>
+ * @param expression1 the second <i>Expression</i>
+ */
+
+ public AndExpression(BooleanExpression op1, BooleanExpression op2) {
+ this.expression1 = op1;
+ this.expression2 = op2;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given
+ * <code>VariableContext</code>
+ *
+ * @param c the <i>Context</i> to evaluate the <i>Expression</i> in
+ * @return the boolean value of this AND <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (expression1.evaluate(c) && expression2.evaluate(c));
+ }
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp) {
+ return new AndExpression(expression1.replace(name, exp), expression2.replace(name,exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @returns the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy() {
+ return new AndExpression(expression1.copy(), expression2.copy());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java
new file mode 100644
index 000000000..8d6c13ab0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java
@@ -0,0 +1,84 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements boolean constants, a concrete boolean <i>TerminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class BooleanConstant implements BooleanExpression {
+
+ /**
+ * the value of this constant
+ */
+
+ protected boolean value;
+
+ /**
+ * Creates a new constant with the given value
+ *
+ * @param value the value this constant should represent
+ */
+
+ public BooleanConstant(boolean value) {
+ this.value = value;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>.
+ *
+ * @param c the <i>Context</i> to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return value;
+ }
+
+ /**
+ * Replaces a variable with an <i>Expression</i>.
+ * Has no effect on constants.
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return the unchanged constant
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp) {
+ return this;
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy() {
+ return new BooleanConstant(value);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java
new file mode 100644
index 000000000..502be4c75
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the <i>AbstractExpression</i> interface for boolean expressions.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public interface BooleanExpression {
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>VariableContext</i>
+ *
+ * @param c the <i>Context</i> to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c);
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp);
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java
new file mode 100644
index 000000000..faeeb984c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an exception that gets raised when the interpreter
+ * runs into errors.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class ExpressionException extends RuntimeException {
+
+ /**
+ * Creates a new ExpressionException with the given message
+ *
+ * @param s the exception message
+ */
+
+ public ExpressionException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java
new file mode 100644
index 000000000..5cc790967
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java
@@ -0,0 +1,115 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Intepreter design pattern example.<p>
+ *
+ * Intent: <i>Given a language, define a representation for its grammar along
+ * with an interpreter that uses the representation to interpret sentences
+ * in the language.</i><p>
+ *
+ * Participating objects are: <code>BooleanContant</code> as
+ * <i>TerminalExpression</i>; <code>VariableExpression</code>,
+ * <code>OrExpression</code>, <code>AndExpression</code>, and
+ * <code>NotExpression</code> as <i>NonterminalExpressions</i>.
+ *
+ * The <i>AbstractExpression</i> interface is defined
+ * in <code>BooelanExp</i>.<p>
+ *
+ * This example implements an interpreter for a language of boolean
+ * expressions. As a sample expression, "((true & x) | (y & !x))" is
+ * interpreted for all possible boolean values for x and y. After that,
+ * y is replaced by another expression and the whole expression is
+ * evaluated again.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ *
+ * @see BooleanExpression
+ */
+
+public class Main {
+
+ /**
+ * Assigns boolean values to two <code>VariableExpression</code>s
+ * and evaluates an expression in the given context.
+ *
+ * @param x a boolean variable expression
+ * @param xValue the value to assign to x
+ * @param y another boolean variable expression
+ * @param yValue the value to assign to y
+ * @param context the context to evaluate the expression in
+ * @param exp the expression to evaluate
+ */
+
+ private static void assignAndEvaluate(
+ VariableExpression x,
+ boolean xValue,
+ VariableExpression y,
+ boolean yValue,
+ VariableContext context,
+ BooleanExpression exp) {
+ context.assign(x, xValue);
+ context.assign(y, yValue);
+ boolean result = exp.evaluate(context);
+ System.out.println("The result for (x="+xValue+", y="+yValue+") is: "+result);
+ }
+
+ /**
+ * Implements the driver for the Intepreter design pattern example.<p>
+ *
+ * @param command-line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+ BooleanExpression exp = null;
+ VariableContext context = new VariableContext();
+
+ VariableExpression x = new VariableExpression("X");
+ VariableExpression y = new VariableExpression("Y");
+
+ exp = new OrExpression(new AndExpression(new BooleanConstant(true), x),
+ new AndExpression(y, new NotExpression(x)));
+
+ System.out.println("Testing Expression: ((true & x) | (y & !x))");
+
+ assignAndEvaluate(x, false, y, false, context, exp);
+ assignAndEvaluate(x, false, y, true, context, exp);
+ assignAndEvaluate(x, true, y, false, context, exp);
+ assignAndEvaluate(x, true, y, true, context, exp);
+
+ VariableExpression z = new VariableExpression("Z");
+ NotExpression notZ = new NotExpression(z);
+
+ BooleanExpression replacement = exp.replace("Y", notZ);
+ context.assign(z, false);
+ boolean result = replacement.evaluate(context);
+
+ System.out.println("The result for the replacement is: "+result);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java
new file mode 100644
index 000000000..298d4e2ee
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java
@@ -0,0 +1,85 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements negation for booleans expressions. This is a concrete boolean
+ * <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class NotExpression implements BooleanExpression {
+
+ /**
+ * the <i>Expression</i> this <i>Expression</i> negates
+ */
+
+ protected BooleanExpression exp = null;
+
+ /**
+ * Creates a new NOT <i>Expression</i> negating the
+ * argument <i>Expression</i>
+ *
+ * @param exp the <i>Expression</i> to negate
+ */
+
+ public NotExpression(BooleanExpression exp) {
+ this.exp = exp;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (! exp.evaluate(c));
+ }
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp) {
+ return new NotExpression(this.exp.replace(name, exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @returns the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy() {
+ return new NotExpression(exp.copy());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java
new file mode 100644
index 000000000..c2a3f2485
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java
@@ -0,0 +1,92 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an OR <i>Expression</i> for booleans.
+ * This is a concrete boolean <i>NonterminalExpression</i>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class OrExpression implements BooleanExpression {
+
+ /**
+ * stores the first part of this OR <i>Expression</i>
+ */
+
+ protected BooleanExpression expression1;
+
+ /**
+ * stores the second part of this OR <i>Expression</i>
+ */
+
+ protected BooleanExpression expression2;
+
+ /**
+ * Creates a new OR <i>Expression</i> with the given parts
+ *
+ * @param expression1 the first <i>Expression</i>
+ * @param expression1 the second <i>Expression</i>
+ */
+
+ public OrExpression(BooleanExpression op1, BooleanExpression op2) {
+ this.expression1 = op1;
+ this.expression2 = op2;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @returns the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return (expression1.evaluate(c) || expression2.evaluate(c));
+ }
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @returns a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp) {
+ return new OrExpression(expression1.replace(name, exp), expression2.replace(name,exp));
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @returns the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy() {
+ return new OrExpression(expression1.copy(), expression2.copy());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java
new file mode 100644
index 000000000..c9f59d0e4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java
@@ -0,0 +1,69 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Implements a <i>Context</i> for the interpretation of boolean
+ * expressions<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class VariableContext {
+
+ /**
+ * stores the mapping between variable names and values
+ */
+
+ protected Hashtable assignments = new Hashtable();
+
+ /**
+ * Returns the current value for a variable
+ *
+ * @param name the name of the variable
+ * @return the value of the variable
+ */
+
+ public boolean lookup(String name) {
+ Boolean value = (Boolean) assignments.get(name);
+ if (value == null) {
+ throw new ExpressionException("No variable \""+name+"\" known.");
+ }
+ return value.booleanValue();
+ }
+
+ /**
+ * Assigns a boolean value to a <code>VariableExpression</code>
+ *
+ * @param varExp the varaible <i>Expression</i> to assign a value to
+ * @param bool the boolean value to assign
+ */
+
+ public void assign(VariableExpression varExp, boolean bool) {
+ assignments.put(varExp.getName(), new Boolean(bool));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java
new file mode 100644
index 000000000..caa429898
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java
@@ -0,0 +1,99 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a variable expression for booleans. This is a concrete
+ * boolean <i>NonterminalExpression</i>
+ * expression
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public class VariableExpression implements BooleanExpression {
+
+ /**
+ * the name of the variable this object represents
+ */
+
+ protected String name = null;
+
+ /**
+ * Creates a new <code>VariableExpression</code> with the given name
+ *
+ * @param name the name of the new variable
+ */
+
+ public VariableExpression(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Accessor for the variable's name
+ *
+ * @return the name of the variable
+ */
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Evaluates this <i>Expression</i> in the given <i>Context</i>
+ *
+ * @param c the context to evaluate the <i>Expression</i> in
+ * @return the boolean value of the <i>Expression</i>
+ */
+
+ public boolean evaluate(VariableContext c) {
+ return c.lookup(name);
+ }
+
+ /**
+ * Replaces a variable with an <i>Expression</i>
+ *
+ * @param name the name of the variable
+ * @param exp the <i>Expression</i> to replace the variable
+ * @return a copy of this <i>Expression</i> with the variable replaced
+ */
+
+ public BooleanExpression replace(String name, BooleanExpression exp) {
+ if (name.equals(this.name)) {
+ return exp.copy();
+ } else {
+ return new VariableExpression(this.name);
+ }
+ }
+
+ /**
+ * Copies this <i>Expression</i>
+ *
+ * @return the copied <i>Expression</i>
+ */
+
+ public BooleanExpression copy() {
+ return new VariableExpression(name);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java
new file mode 100644
index 000000000..5afe1bc77
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java
@@ -0,0 +1,98 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Iterator;
+
+/**
+ * Implements the driver for the Iterator design pattern example.<p>
+ *
+ * Intent: <i>Provide a way to access the elements of an aggregate object
+ * sequentially without exposing its underlying representation.</i><p>
+ *
+ * Participating objects are <code>SimpleList</code> as <i>Aggregate</i>,
+ * <code>OpenList</code> as <i>ConcreteAggregate</i>, <code>
+ * java.util.Iterator</code> as <i>Iterator</i>, and <code>ReverseIterator
+ * </code> as <i>ConcreteIterator</i>.
+ *
+ * In this example, the concrete aggregate is a list that gets filled with
+ * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is
+ * created and used to print all elements in reverse order.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see SimpleList
+ * @see OpenList
+ * @see java.util.Iterator
+ * @see OpenListIteration
+ */
+
+
+public class Main {
+
+ /**
+ * Prints all elements in the iterator to <code>System.out</code>.
+ *
+ * @param iter the iterator which elements are to be printed
+ */
+
+ private static void print(Iterator iter) {
+ while(iter.hasNext()) {
+ System.out.println(iter.next());
+ }
+ }
+
+ /**
+ * Implements the driver for the Iterator design pattern example.<p>
+ *
+ * In this example, the concrete aggregate is a list that gets filled with
+ * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is
+ * created and used to print all elements in reverse order.
+ *
+ * @param args command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ OpenList openList = new OpenList();
+ openList.append(new Integer(1));
+ openList.append(new Integer(2));
+ openList.append(new Integer(3));
+ openList.append(new Integer(4));
+ openList.append(new Integer(5));
+
+ System.out.println("List created, containing int objects 1, 2, 3, 4, 5.");
+
+ Iterator iter = OpenListIteration.aspectOf().createIteratorFor(openList);
+
+ System.out.println("Using ReverseIterator to print list elements in reverse order...");
+
+ print(iter);
+
+ System.out.println("done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java
new file mode 100644
index 000000000..7eb5d04a1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java
@@ -0,0 +1,88 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Iterator;
+
+/**
+ * Implements a basic open list. This implementation is based on
+ * <code>java.util.LinkedList</code>. In essence, this class acts as an
+ * adapter for the Java class. <p>
+ *
+ * In this version, it is no longer necessary to implement the factory
+ * method here to create the iterator.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class OpenList implements SimpleList {
+
+ java.util.LinkedList list = new java.util.LinkedList();
+
+ /**
+ * Returns the number of elements in the list
+ *
+ * @return the number of elements in the list
+ */
+
+ public int count() {
+ return list.size();
+ }
+
+ /**
+ * Appends an object to the list. Since this is an open list, inserting
+ * elements is assumed to succeed.
+ *
+ * @param o the object to append
+ * @return true if successful, false otherwise
+ */
+
+ public boolean append(Object o) {
+ list.addLast(o);
+ return true;
+ }
+
+ /**
+ * Removes an object from the list
+ *
+ * @param o the object to remove
+ * @return true if successful, false otherwise
+ */
+
+ public boolean remove(Object o) {
+ return list.remove(o);
+ }
+
+ /**
+ * Returns an object from the list
+ *
+ * @param index the position of the object
+ * @return the object at position index
+ */
+
+ public Object get(int index) {
+ return list.get(index);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java
new file mode 100644
index 000000000..0fc2b1724
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java
@@ -0,0 +1,130 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.NoSuchElementException;
+import java.util.Iterator;
+
+/**
+ * Implements a concrete instance of the Iterator design pattern. This
+ * concrete aspect attaches a factory method to the <i>Aggregate</i> class
+ * and provides an implementation for the Iterator via an inner class.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see SimpleList
+ * @see OpenList
+ */
+
+public aspect OpenListIteration {
+
+ /**
+ * Implements the factory method to create the reverse iterator for the
+ * OpenList class using the open classes mechanism.
+ */
+
+ Iterator OpenList.createReverseIterator() {
+ return new ReverseIterator(this);
+ }
+
+ /**
+ * Another possibility to define the factory method here. If we
+ * have the factory method on the aspect, multiple instances of the
+ * same pattern will not be confused an can use the same aggregate
+ * (multiple factory methods won't conflict that way, even if they
+ * have the same signature). This is the preferable implementation.
+ */
+
+ Iterator createIteratorFor(OpenList list) {
+ return new ReverseIterator(list);
+ }
+
+ /**
+ * Provides the implementation of the reverse iterator. Instead
+ * of defining an inner class, one could also instantiate
+ * <code>java.util.Iterator</code> as an anonymous class and overwrite
+ * the appropriate methods.
+ */
+
+ static class ReverseIterator implements Iterator {
+
+ /**
+ * the positition of the current element
+ */
+
+ protected int current;
+
+ /**
+ * the list this iterator operates on
+ */
+
+ protected SimpleList list;
+
+ /**
+ * Returns true if the iteration has more elements.
+ *
+ * @return true if the iteration has more elements
+ */
+
+ public boolean hasNext() {
+ return (current > 0);
+ }
+
+ /**
+ * This opional method is not implemented for this iterator.
+ */
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() not supported");
+ }
+
+ /**
+ * Returns the next element in the iteration.
+ *
+ * @return the next element in the iteration.
+ */
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds");
+ } else {
+ return list.get(--current);
+ }
+ }
+
+ /**
+ * Creates a new ReverseIterator from the given list.
+ *
+ * @param list the list to generate an iterator from
+ */
+
+ public ReverseIterator(SimpleList list) {
+ super();
+ this.list = list;
+ current = list.count();
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java
new file mode 100644
index 000000000..c8b7384c8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines an interface for a basic list.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see OpenList
+ */
+
+public interface SimpleList {
+
+ /**
+ * Returns the number of elements in the list
+ *
+ * @return the number of elements in the list
+ */
+
+ public int count();
+
+ /**
+ * Appends an object to the list
+ *
+ * @param o the object to append
+ * @return true if successful, false otherwise
+ */
+
+ public boolean append(Object o);
+
+ /**
+ * Removes an object from the list
+ *
+ * @param o the object to remove
+ * @return true if successful, false otherwise
+ */
+
+ public boolean remove(Object o);
+
+ /**
+ * Returns an object from the list
+ *
+ * @param index the position of the object
+ * @return the object at position index
+ */
+
+ public Object get(int index);
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java
new file mode 100644
index 000000000..03d378c91
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java
@@ -0,0 +1,97 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Iterator;
+
+/**
+ * Implements the driver for the Iterator design pattern example.<p>
+ *
+ * Intent: <i>Provide a way to access the elements of an aggregate object
+ * sequentially without exposing its underlying representation.</i><p>
+ *
+ * Participating objects are <code>SimpleList</code> as <i>Aggregate</i>,
+ * <code>OpenList</code> as <i>ConcreteAggregate</i>, <code>
+ * java.util.Iterator</code> as <i>Iterator</i>, and <code>ReverseIterator
+ * </code> as <i>ConcreteIterator</i>.
+ *
+ * In this example, the concrete aggregate is a list that gets filled with
+ * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is
+ * created and used to print all elements in reverse order.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see SimpleList
+ * @see OpenList
+ * @see java.util.Iterator
+ * @see ReverseIterator
+ */
+
+public class Main {
+
+ /**
+ * Prints all elements in the iterator to <code>System.out</code>.
+ *
+ * @param iter the iterator which elements are to be printed
+ */
+
+ private static void print(Iterator iter) {
+ while(iter.hasNext()) {
+ System.out.println(iter.next());
+ }
+ }
+
+ /**
+ * Implements the driver for the Iterator design pattern example.<p>
+ *
+ * In this example, the concrete aggregate is a list that gets filled with
+ * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is
+ * created and used to print all elements in reverse order.
+ *
+ * @param args command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ OpenList openList = new OpenList();
+ openList.append(new Integer(1));
+ openList.append(new Integer(2));
+ openList.append(new Integer(3));
+ openList.append(new Integer(4));
+ openList.append(new Integer(5));
+
+ System.out.println("List created, containing int objects 1, 2, 3, 4, 5.");
+
+ Iterator iter = openList.createReverseIterator();
+
+ System.out.println("Using ReverseIterator to print list elements in reverse order...");
+
+ print(iter);
+
+ System.out.println("done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java
new file mode 100644
index 000000000..31fcf7b6d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java
@@ -0,0 +1,95 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Iterator;
+
+/**
+ * Implements a basic open list. This implementation is based on
+ * <code>java.util.LinkedList</code>. In essence, this class acts as an
+ * adapter for the Java class.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class OpenList implements SimpleList {
+
+ java.util.LinkedList list = new java.util.LinkedList();
+
+ /**
+ * Returns the number of elements in the list
+ *
+ * @return the number of elements in the list
+ */
+
+ public int count() {
+ return list.size();
+ }
+
+ /**
+ * Appends an object to the list. Since this is an open list, inserting
+ * elements is assumed to succeed.
+ *
+ * @param o the object to append
+ * @return true if successful, false otherwise
+ */
+
+ public boolean append(Object o) {
+ list.addLast(o);
+ return true;
+ }
+
+ /**
+ * Removes an object from the list
+ *
+ * @param o the object to remove
+ * @return true if successful, false otherwise
+ */
+
+ public boolean remove(Object o) {
+ return list.remove(o);
+ }
+
+ /**
+ * Returns an object from the list
+ *
+ * @param index the position of the object
+ * @return the object at the specified index
+ */
+
+ public Object get(int index) {
+ return list.get(index);
+ }
+
+ /**
+ * Returns a reverse iterator for this list.
+ *
+ * @return the a reverse iterator for this list
+ */
+
+ public Iterator createReverseIterator() {
+ return new ReverseIterator(this);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java
new file mode 100644
index 000000000..160f8c77b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java
@@ -0,0 +1,94 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Iterator;
+
+/**
+ * Implements a reverse iterator. This means that it will return elements in
+ * reverse order. We chose not to define our own <i>Iterator</i>, but to use
+ * Java's <code>java.util.Iterator</code> interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class ReverseIterator implements Iterator {
+
+ /**
+ * the positition of the current element
+ */
+
+ protected int current;
+
+ /**
+ * the list this iterator operates on
+ */
+
+ protected SimpleList list;
+
+ /**
+ * Returns true if the iteration has more elements.
+ *
+ * @return true if the iteration has more elements
+ */
+
+ public boolean hasNext() {
+ return (current > 0);
+ }
+
+ /**
+ * This opional method is not implemented for this iterator.
+ */
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() not supported");
+ }
+
+ /**
+ * Returns the next element in the iteration.
+ *
+ * @return the next element in the iteration.
+ */
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds");
+ } else {
+ return list.get(--current);
+ }
+ }
+
+ /**
+ * Creates a new ReverseIterator from the given list.
+ *
+ * @param list the list to generate an iterator from
+ */
+
+ public ReverseIterator(SimpleList list) {
+ super();
+ this.list = list;
+ current = list.count();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java
new file mode 100644
index 000000000..9fa573282
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines an interface for a basic list.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see OpenList
+ */
+
+public interface SimpleList {
+
+ /**
+ * Returns the number of elements in the list
+ *
+ * @return the number of elements in the list
+ */
+
+ public int count();
+
+ /**
+ * Appends an object to the list
+ *
+ * @param o the object to append
+ * @return true if successful, false otherwise
+ */
+
+ public boolean append(Object o);
+
+ /**
+ * Removes an object from the list
+ *
+ * @param o the object to remove
+ * @return true if successful, false otherwise
+ */
+
+ public boolean remove(Object o);
+
+ /**
+ * Returns an object from the list at a given index
+ *
+ * @param index the position of the object
+ * @return the object at position index
+ */
+
+ public Object get(int index);
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java
new file mode 100644
index 000000000..3ba0ee59f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java
@@ -0,0 +1,57 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Basically a <code>JButton</code> with an <code>ActionListener</code>.
+ * The listener calls <code>clicked()</code> when the button gets pressed.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Button extends JButton {
+
+ /**
+ * Creates a new <code>Button</code> object with the provided label.
+ *
+ * @param name the label for the new <code>Button</code> object
+ */
+
+ public Button(String name) {
+ super(name);
+ this.setActionCommand(name);
+ this.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ clicked();
+ }
+ });
+ }
+
+ public void clicked() {}
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java
new file mode 100644
index 000000000..d19f6bef2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java
@@ -0,0 +1,46 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+
+/**
+ * Basically a JLabel. Acts as <i>Mediator</i>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Label extends JLabel {
+
+ /**
+ * Creates a new <code>Label</code> object with the provided name.
+ *
+ * @param s the tag for the new <code>Label</code> object
+ */
+
+ public Label(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java
new file mode 100644
index 000000000..605b6ed3f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java
@@ -0,0 +1,89 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+
+/**
+ * Implements the driver for the mediator design pattern example.<p>
+ *
+ * Intent: <i>Define an object that encapsulates how a set of objects
+ * interact. Mediator promotes loose coupling by keeping objects from
+ * referring to each other explicitly, and it lets you vary their interaction
+ * independently.</i><p>
+ *
+ * Participating objects are <code>Button</code>s as <i>Colleague</i>s,
+ * and a <code>Label</code> as <i>Mediator</i>.
+ *
+ * Every time an event of interest (a button click) occurs, the mediating
+ * <code>Label</code> is updated and it updates the calling button.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see Button
+ * @see Label
+ */
+
+public class Main {
+
+
+ static JFrame frame = new JFrame("Mediator Demo");
+ static Button button1 = new Button("Button1");
+ static Button button2 = new Button("Button2");
+ static Label label = new Label ("Click a button!");
+
+ /**
+ * Implements the driver for the mediator example. It creates a small
+ * GUI with a label and two buttons. The buttons are <i>Colleague</i>s,
+ * the label is the <i>Mediator</i>.
+ *
+ * Each button click causes the mediator to update itself and the
+ * calling button.
+ */
+
+ public static void main(String[] args) {;
+
+
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ JPanel panel = new JPanel();
+
+ panel.add(label);
+ panel.add(button1);
+ panel.add(button2);
+
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setVisible(true);
+
+ MediatorImplementation.aspectOf().setMediator(button1, label);
+ MediatorImplementation.aspectOf().setMediator(button2, label);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java
new file mode 100644
index 000000000..8a3a9e31b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.MediatorProtocol;
+
+/**
+ * Concretizes the mediation relationship for <code>Button</code>
+ * (as <i>Colleague</i>) and <code>Label</code> (as <i>Mediator</i>).
+ * <code>Button</code> clicks trigger <code>Label</code> updates.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public aspect MediatorImplementation extends MediatorProtocol {
+
+ /**
+ * Assings the <i>Colleague</i> role to the <code>Button</code>
+ * class. Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Button implements Colleague;
+
+ /**
+ * Assings the <i>Mediator</i> role to the <code>Label</code>
+ * class. Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Label implements Mediator;
+
+ /**
+ * Defines what changes on Colleagues cause their <i>Mediator</i> to be
+ * notified (here: Button clicks)
+ *
+ * @param cs the colleague on which the change occured
+ */
+
+ protected pointcut change(Colleague c):
+ (call(void Button.clicked()) && target(c));
+
+ /**
+ * Defines how the <i>Mediator</i> is to be updated when a change
+ * to a <i>Colleague</i> occurs. Here, the label's text is set
+ * depending on which button was clicked. The appropriate button's label
+ * is also updated.
+ *
+ * @param c the colleague on which a change of interest occured
+ * @param m the mediator to be notifed of the change
+ */
+
+ protected void notifyMediator(Colleague c, Mediator m) {
+ Button button = (Button) c;
+ Label label = (Label) m;
+ if (button == Main.button1) {
+ label.setText("Button1 clicked");
+ } else if (button == Main.button2) {
+ label.setText("Button2 clicked");
+ }
+ button.setText("(Done)");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java
new file mode 100644
index 000000000..6c6854033
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java
@@ -0,0 +1,71 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.JButton;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * Basically a <code>JButton</code> with an <code>ActionListener</code>.
+ * The listener calls <code>clicked()</code> when the button gets pressed.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Button extends JButton implements GUIColleague {
+
+ private GUIMediator mediator;
+
+ /**
+ * Creates a new <code>Button</code> object with the provided label.
+ *
+ * @param name the label for the new <code>Button</code> object
+ */
+
+ public Button(String name) {
+ super(name);
+ this.setActionCommand(name);
+ this.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ clicked();
+ }
+ });
+ }
+
+ public void clicked() {
+ mediator.colleagueChanged(this);
+ }
+
+ /**
+ * Allows to set the <i>Mediator</i> for this <i>Colleague</i>
+ *
+ * @param mediator the new mediator
+ */
+
+ public void setMediator(GUIMediator mediator) {
+ this.mediator = mediator;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java
new file mode 100644
index 000000000..69c281432
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java
@@ -0,0 +1,44 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This interface is implemented by all types that the <i>Mediator</i>
+ * interacts with.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public interface GUIColleague {
+
+ /**
+ * Defines the method signature for setting a <i>Colleague</i>'s
+ * <i>Mediator</i>.
+ *
+ * @param mediator the new mediator
+ */
+
+ public void setMediator(GUIMediator mediator);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java
new file mode 100644
index 000000000..61efcfc84
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java
@@ -0,0 +1,45 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This is the <i>Mediator</i> interface. It defines a method for dealing
+ * with changes in <i>Colleague</i>s that require updates.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public interface GUIMediator {
+
+ /**
+ * Defines the method signature for notifying <i>Mediator</i>s of changes
+ * to <i>Colleague</i>s. This method is called by colleagues who
+ * pass themselves as an argument (push model).
+ *
+ * @param colleague the changing colleage
+ */
+
+ public void colleagueChanged(GUIColleague colleague);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java
new file mode 100644
index 000000000..2146ff340
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+
+/**
+ * Basically a JLabel. Acts as <i>Mediator</i>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Label extends JLabel implements GUIMediator {
+
+ /**
+ * Creates a new <code>Label</code> object with the provided name.
+ *
+ * @param s the tag for the new <code>Label</code> object
+ */
+
+ public Label(String s) {
+ super(s);
+ }
+
+ /**
+ * Handles the event that a <i>colleague</i> chanbged.
+ *
+ * @param colleague the <i>Colleague</i> that caused the notification
+ */
+
+ public void colleagueChanged(GUIColleague colleague) {
+ Button button = (Button) colleague;
+
+ if (button == Main.button1) {
+ this.setText("Button1 clicked");
+ } else if (button == Main.button2) {
+ this.setText("Button2 clicked");
+ }
+ button.setText("(Done)");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java
new file mode 100644
index 000000000..7fcf668f1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+
+/**
+ * Implements the driver for the Mediator design pattern example.<p>
+ *
+ * Intent: <i>Define an object that encapsulates how a set of objects
+ * interact. Mediator promotes loose coupling by keeping objects from
+ * referring to each other explicitly, and it lets you vary their interaction
+ * independently.</i><p>
+ *
+ * Participating objects are <code>Button</code>s as <i>Colleague</i>s,
+ * and a <code>Label</code> as <i>Mediator</i>.
+ *
+ * Every time an event of interest (a button click) occurs, the mediating
+ * <code>Label</code> is updated and it in turn updates the respective
+ * calling button.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Both <i>Mediator</i> and <i>Colleague</i>s have to be aware of their role
+ * within the pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see Button
+ * @see Label
+ */
+
+public class Main {
+
+
+ static JFrame frame = new JFrame("Mediator Demo");
+ static Button button1 = new Button("Button1");
+ static Button button2 = new Button("Button2");
+ static Label label = new Label ("Click a button!");
+
+ /**
+ * Implements the driver for the mediator example. It creates a small
+ * GUI with a label and two buttons. The buttons are <i>Colleague</i>s,
+ * the label is the <i>Mediator</i>.
+ *
+ * Each button click causes the mediator to update itself and the
+ * calling button.
+ */
+
+ public static void main(String[] args) {;
+
+
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {System.exit(0);}
+ });
+
+ JPanel panel = new JPanel();
+
+ panel.add(label);
+ panel.add(button1);
+ panel.add(button2);
+
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setVisible(true);
+
+ button1.setMediator(label);
+ button2.setMediator(label);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java
new file mode 100644
index 000000000..f3f395338
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java
@@ -0,0 +1,58 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Originator</i> class. Objects of this particular
+ * <i>Originator</i> have state, an int representing the number of time
+ * the <code>increment()</code> method was called.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Counter {
+
+ /**
+ * the number of times <code>increment()</code> was called on this object
+ */
+
+ protected int currentValue = 0;
+
+ /**
+ * increments the counter (this <i>Originator</i>'s state) by one
+ */
+
+ public void increment() {
+ currentValue++;
+ }
+
+ /**
+ * Displays the state of this <i>Originator</i>
+ */
+
+ public void show() {
+ System.out.println("Originator value is " + currentValue);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java
new file mode 100644
index 000000000..48fd6aa3b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java
@@ -0,0 +1,92 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.MementoException;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.MementoProtocol;
+
+/**
+ * Implements an instance of the Memento design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see MyOriginator
+ */
+
+
+public aspect CounterMemento extends MementoProtocol {
+
+ /**
+ * Assigns the <i>Originator</i> role to <code>Counter</code>
+ */
+
+ declare parents: Counter implements Originator;
+
+ /**
+ * Creates a <i>Memento</i> object for an <i>Originator</i>. An anonymous
+ * class is used to realize the Memento
+ *
+ * @param o the originator to create a memento for
+ * @return the <i>Memento</i> storing the originator's state
+ */
+
+ public Memento createMementoFor(Originator o) {
+ if (o instanceof Counter) {
+ Memento m = new Memento() {
+ private Integer state;
+
+ public void setState(Object state) {
+ this.state = (Integer) state;
+ }
+
+ public Object getState() {
+ return state;
+ }
+ };
+ m.setState(new Integer(((Counter)o).currentValue));
+ return m;
+ } else {
+ throw new MementoException("Invalid originator");
+ }
+ }
+
+ /**
+ * Restores this <i>Originator</i> to former state using the
+ * <i>Memento</i> passed
+ *
+ * @param o the originator to restore
+ * @param m the memento that stores the prior state
+ */
+
+ public void setMemento(Originator o, Memento m) {
+ if (o instanceof Counter) {
+ Integer integer = (Integer) m.getState();
+ ((Counter)o).currentValue = integer.intValue();
+ } else {
+ throw new MementoException("Invalid originator");
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java
new file mode 100644
index 000000000..ee2e2a85d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java
@@ -0,0 +1,85 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento;
+
+/**
+ * Implements the driver for the Memento design pattern example.<p>
+ *
+ * Intent: <i>Without violating encapsulation, capture and externalize an
+ * object's internal state so that the object can be restored to this state
+ * later</i><p>
+ *
+ * Participating objects are <code>Memento</code> and <code>Originator</code>
+ * <p>
+ *
+ * This example changes the state of the <i>Originator</i> five times, but
+ * creates a <i>Memento</i> of it after the third change. After the 5 changes
+ * are done, the <i>Memento</i> is used to restore the <i>Originator</i>'s
+ * state.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Memento and Originator are decoupled.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see StateMemento
+ * @see MyOriginator
+ */
+
+
+
+public class Main {
+
+ /**
+ * This example changes the state of the <i>Originator</i> five times, but
+ * creates a <i>Memento</i> of it after the third change. After the 5
+ * changes are done, the <i>Memento</i> is used to restore the
+ * <i>Originator</i>'s state.
+ *
+ * @param args command line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+
+ Memento storedState = null;
+ Counter counter = new Counter();
+
+ for (int i=1; i<=5; i++) {
+ counter.increment();
+ counter.show();
+ if (i==3) {
+ storedState =
+ CounterMemento.aspectOf().createMementoFor(counter);
+ }
+ }
+
+ System.out.println("\nTrying to reinstate state (3)...");
+ CounterMemento.aspectOf().setMemento(counter, storedState);
+ counter.show();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java
new file mode 100644
index 000000000..83aca53fe
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java
@@ -0,0 +1,78 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Originator</i> class. Objects of this particular
+ * <i>Originator</i> have state, an int representing the number of time
+ * the <code>increment()</code> method was called.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Counter {
+
+ /**
+ * the number of times <code>increment()</code> was called on this object
+ */
+
+ protected int currentValue = 0;
+
+ /**
+ * increments the counter (this <i>Originator</i>'s state) by one
+ */
+
+ public void increment() {
+ currentValue++;
+ }
+
+ /**
+ * Displays the state of this <i>Originator</i>
+ */
+
+ public void show() {
+ System.out.println("Originator value is " + currentValue);
+ }
+
+ /**
+ * Creates a <i>Memento</i> from this <i>Originator</i>, storing the
+ * current state
+ */
+
+ public CounterMemento createMemento() {
+ return new CounterMemento(currentValue);
+ }
+
+ /**
+ * Restores this <i>Originator</i> to former state stored by the
+ * memento passed
+ *
+ * @param memento the <i>Memento</i> that stores the prior state
+ */
+
+ public void setMemento(CounterMemento memento) {
+ currentValue = memento.getState();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java
new file mode 100644
index 000000000..f2b6dba23
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Memento</i> class. This particular one stores
+ * the counter of its <i>Originator</i> (an int value), and returns it
+ * upon request.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see Originator
+ */
+
+public class CounterMemento {
+
+ /**
+ * stores the <i>Originator</i>'s state
+ */
+
+ private int state;
+
+ /**
+ * Captures the <i>Originator</i>'s state and stores it
+ *
+ * @param newState the state to store
+ */
+
+ public void setState(int newState) {
+ state = newState;
+ }
+
+ /**
+ * Returns the stored <i>Originator</i> state
+ *
+ * @return the stored state
+ */
+
+ public int getState() {
+ return state;
+ }
+
+ /**
+ * Creates a <i>Memento</i> object with the give state
+ *
+ * @param init the initial state to store
+ */
+
+ public CounterMemento(int init) {
+ state = init;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java
new file mode 100644
index 000000000..0827c6972
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java
@@ -0,0 +1,75 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.memento.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the memento design pattern example.<p>
+ *
+ * Intent: <i>Without violating encapsulation, capture and externalize an
+ * object's internal state so that the object can be restored to this state
+ * later</i><p>
+ *
+ * Participating objects are <code>Memento</code> and <code>Originator</code>
+ * <p>
+ *
+ * This example changes the state of the <i>Originator</i> five times, but
+ * creates a <i>Memento</i> of it after the third change. After the 5 changes
+ * are done, the <i>Memento</i> is used to restore the <i>Originator</i>'s
+ * state.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Memento and Originator are tightly coupled.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public class Main {
+
+ /**
+ * This example changes the state of the <i>Originator</i> five times, but
+ * creates a <i>Memento</i> of it after the third change. After the 5
+ * changes are done, the <i>Memento</i> is used to restore the
+ * <i>Originator</i>'s state.
+ */
+
+ public static void main(String[] args) {
+
+ CounterMemento storedState = null;
+ Counter counter = new Counter();
+
+ for (int i=1; i<=5; i++) {
+ counter.increment();
+ counter.show();
+ if (i==3) {
+ storedState = counter.createMemento();
+ }
+ }
+
+ System.out.println("\nTrying to reinstate state (3)...");
+ counter.setMemento(storedState);
+ counter.show();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java
new file mode 100644
index 000000000..44af56c27
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.Color;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ObserverProtocol;
+
+/**
+ * Concretizes the observing relationship for <code>Point</code> (subject)
+ * and <code>Screen</code> (observer). Color changes trigger updates.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public aspect ColorObserver extends ObserverProtocol{
+
+ /**
+ * Assings the <i>Subject</i> role to the <code>Point</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Point implements Subject;
+
+ /**
+ * Assings the <i>Observer</i> role to the <code>Screen</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Screen implements Observer;
+
+ /**
+ * Specifies the join points that represent a change to the
+ * <i>Subject</i>. Captures calls to <code>Point.setColor(Color)
+ * </code>.
+ * @param subject the <code>Point</code> acting as <i>Subject</i>
+ */
+
+ protected pointcut subjectChange(Subject subject):
+ call(void Point.setColor(Color)) && target(subject);
+
+ /**
+ * Defines how <i>Observer</i>s are to be updated when a change
+ * to a <i>Subject</i> occurs.
+ * @param subject the <i>Subject</i> on which a change of interest occured
+ * @param observer the <i>bserver</i> to be notifed of the change
+ */
+
+ protected void updateObserver(Subject subject, Observer observer) {
+ ((Screen)observer).display("Screen updated "+
+ "(point subject changed color).");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java
new file mode 100644
index 000000000..ea5c9635c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java
@@ -0,0 +1,76 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ObserverProtocol;
+
+/**
+ * Concretizes the observing relationship for <code>Point</code> (subject)
+ * and <code>Screen</code> (observer). Coordinate changes trigger updates.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public aspect CoordinateObserver extends ObserverProtocol{
+
+
+ /**
+ * Assings the <i>Subject</i> role to the <code>Point</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Point implements Subject;
+
+ /**
+ * Assings the <i>Observer</i> role to the <code>Screen</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Screen implements Observer;
+
+ /**
+ * Specifies the join points that represent a change to the
+ * <i>Subject</i>. Captures calls to <code>Point.setX(int)
+ * </code> and <code>Point.setY(int)</code>.
+ * @param subject the <code>Point</code> acting as <i>Subject</i>
+ */
+
+ protected pointcut subjectChange(Subject subject):
+ (call(void Point.setX(int)) ||
+ call(void Point.setY(int)) ) && target(subject);
+
+ /**
+ * Defines how <i>Observer</i>s are to be updated when a change
+ * to a <i>Subject</i> occurs.
+ *
+ * @param subject the <i>Subject</i> on which a change of interest occured
+ * @param observer the <i>bserver</i> to be notifed of the change
+ */
+
+ protected void updateObserver(Subject subject, Observer observer) {
+ ((Screen)observer).display("Screen updated "+
+ "(point subject changed coordinates).");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java
new file mode 100644
index 000000000..1e57db172
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java
@@ -0,0 +1,112 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.Color;
+
+/**
+ * Implements the driver for the Observer design pattern example.<p>
+ *
+ * Intent: <i>Define a one-to-many dependency between objects so that when one
+ * object changes state, all its dependents are notified and updated
+ * automatically</i><p>
+ *
+ * Participating objects are <code>Point</code> p and <code>Screen</code>
+ * s1, s2, s3, s4, and s5.<p>
+ *
+ * Three different kinds of observing relationships are realized: <UL>
+ * <LI> <code>Screen</code> s1 and s2 observe color changes of <code>Point
+ * </code> p.
+ * <LI> <code>Screen</code> s3 and s4 observe coordinate changes of <code>
+ * Point</code> p.
+ * <LI> <code>Screen</code> s5 observes the <code>display(String)</code>
+ * methods of <code>Screen</code> s2 and s4.
+ * </UL>
+ *
+ * Every time an event of interest occurs, the observing <code>Screen</code>
+ * prints an appropriate message to stdout. <p>
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Observer example. It creates five
+ * <code>Screen</code> objects and one <code>Point</code> object
+ * and sets the appropriate observing relationships (see above).
+ * After the setup, the color of the point is changed, then it's
+ * x-coordinate. <p>
+ * The following results should be expected: <OL>
+ * <LI> The color change should trigger s1 and s2 to each print an
+ * appropriate message.
+ * <LI> s2's message should trigger it's observer s5 to print
+ * a message.
+ * <LI> The coordinate change should trigger s3 and s4.
+ * <LI> s4's message should trigger it's observer s5 again.
+ * </OL>
+ */
+
+ public static void main(String argv[]) {
+
+ Point p = new Point(5, 5, Color.blue);
+
+ System.out.println("Creating Screen s1,s2,s3,s4,s5 and Point p");
+
+ Screen s1 = new Screen("s1");
+ Screen s2 = new Screen("s2");
+
+ Screen s3 = new Screen("s3");
+ Screen s4 = new Screen("s4");
+
+ Screen s5 = new Screen("s5");
+
+ System.out.println("Creating observing relationships:");
+ System.out.println("- s1 and s2 observe color changes to p");
+ System.out.println("- s3 and s4 observe coordinate changes to p");
+ System.out.println("- s5 observes s2's and s4's display() method");
+
+ ColorObserver.aspectOf().addObserver(p, s1);
+ ColorObserver.aspectOf().addObserver(p, s2);
+
+ CoordinateObserver.aspectOf().addObserver(p, s3);
+ CoordinateObserver.aspectOf().addObserver(p, s4);
+
+ ScreenObserver.aspectOf().addObserver(s2, s5);
+ ScreenObserver.aspectOf().addObserver(s4, s5);
+
+ System.out.println("Changing p's color:");
+
+ p.setColor(Color.red);
+
+ System.out.println("Changing p's x-coordinate:");
+
+ p.setX(4);
+
+ System.out.println("done.");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java
new file mode 100644
index 000000000..0709e59e5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java
@@ -0,0 +1,124 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.Color;
+
+/**
+ * Represents a point with x and y coordinates and a color.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Point {
+
+ /**
+ * the point's x-coordinate
+ */
+
+ private int x;
+
+ /**
+ * the point's y-coordinate
+ */
+
+ private int y;
+
+ /**
+ * the point's current color
+ */
+
+ private Color color;
+
+ /**
+ * Creates a new point object based on x and y coordinates and color.
+ */
+
+ public Point(int x, int y, Color color) {
+ this.x=x;
+ this.y=y;
+ this.color=color;
+ }
+
+ /**
+ * Returns the point's current x-coordinate.
+ *
+ * @return the current x-coordinate
+ */
+
+ public int getX() {
+ return x;
+ }
+
+ /**
+ * Returns the point's current y-coordinate.
+ *
+ * @return the current y-coordinate
+ */
+
+ public int getY() {
+ return y;
+ }
+
+ /**
+ * Sets the current x-coordinate.
+ *
+ * @param x the new x-coordinate
+ */
+
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ /**
+ * Sets the current y-coordinate.
+ *
+ * @param y the new y-coordinate
+ */
+
+ public void setY(int y) {
+ this.y = y;
+ }
+
+ /**
+ * Returns the point's current color.
+ *
+ * @return the current color
+ */
+
+ public Color getColor() {
+ return color;
+ }
+
+ /**
+ * Sets the current color.
+ *
+ * @param color the new color
+ */
+
+ public void setColor(Color color) {
+ this.color=color;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java
new file mode 100644
index 000000000..13c1bd9bc
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java
@@ -0,0 +1,63 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Provides a means to output messages. Objects of this class act as
+ * output devices.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Screen {
+
+ /**
+ * the individual name of this screen object
+ */
+
+ private String name;
+
+ /**
+ * creates a new <code>Screen</code> object with the provided name.
+ *
+ * @param name the name for the new <code>Screen</code> object
+ */
+
+ public Screen(String s) {
+ this.name = s;
+ }
+
+
+ /**
+ * Prints the name of the <code>Screen</code> object and the argument
+ * string to stdout.
+ *
+ * @param s the string to print
+ */
+
+ public void display (String s) {
+ System.out.println(name + ": " + s);
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java
new file mode 100644
index 000000000..1ee361928
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java
@@ -0,0 +1,77 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ObserverProtocol;
+
+/**
+ * Concretizes the observing relationship for <code>Screen</code> (subject)
+ * and <code>Screen</code> (observer). Calls of <code>Screen.display(String)
+ * </code> trigger updates.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public aspect ScreenObserver extends ObserverProtocol{
+
+ /**
+ * Assings the <i>Subject</i> role to the <code>Screen</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Screen implements Subject;
+
+ /**
+ * Assings the <i>Observer</i> role to the <code>Screen</code> class.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ declare parents: Screen implements Observer;
+
+ /**
+ * Specifies the join points that represent a change to the
+ * <i>Subject</i>. Captures calls to <code>Screen.display(String)
+ * </code>.
+ *
+ * @param subject the <code>Point</code> acting as <i>Subject</i>
+ */
+
+ protected pointcut subjectChange(Subject subject):
+ call(void Screen.display(String)) && target(subject);
+
+ /**
+ * Defines how <i>Observer</i>s are to be updated when a change
+ * to a <i>Subject</i> occurs.
+ *
+ * @param subject the <i>Subject</i> on which a change of interest occured
+ * @param observer the <i>bserver</i> to be notifed of the change
+ */
+
+ protected void updateObserver(Subject subject, Observer observer) {
+ ((Screen)observer).display("Screen updated " +
+ "(screen subject displayed message).");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java
new file mode 100644
index 000000000..21a7d58ff
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java
@@ -0,0 +1,43 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the method used to update <i>Observer<i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public interface ChangeObserver {
+
+ /**
+ * Updates an <i>Observer</i>. Uses the <i>push</i> strategy (i.e. the
+ * subject triggering the update passes itself as an argument).
+ *
+ * @param s the <i>Subject</i> triggering the update
+ */
+
+ public void refresh(ChangeSubject s);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java
new file mode 100644
index 000000000..221cb53a0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java
@@ -0,0 +1,57 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares methods to attach and detach <i>Observer<i>s to/from
+ * <i>Subject</i>s, and the <code>notifyObservers()</code> method.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public interface ChangeSubject {
+
+ /**
+ * Attaches an <i>Observer</i> to this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to add
+ */
+
+ public void addObserver(ChangeObserver o);
+
+ /**
+ * Detaches an <i>Observer</i> from this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to remove
+ */
+
+ public void removeObserver(ChangeObserver o);
+
+ /**
+ * Notifies all <i>Observer</i>s.
+ */
+
+ public void notifyObservers();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java
new file mode 100644
index 000000000..8cfac7b4b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java
@@ -0,0 +1,136 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.Color;
+
+/**
+ * Implements the driver for the Observer design pattern example.<p>
+ *
+ * Intent: <i>Define a one-to-many dependency between objects so that when one
+ * object changes state, all its dependents are notified and updated
+ * automatically</i><p>
+ *
+ * Participating objects are <code>Point</code> p and <code>Screen</code>
+ * s1, s2, s3, s4, and s5.<p>
+ *
+ * Three different kinds of observing relationships are realized: <UL>
+ * <LI> <code>Screen</code> s1 and s2 observe color changes of <code>Point
+ * </code> p.
+ * <LI> <code>Screen</code> s3 and s4 observe coordinate changes of <code>
+ * Point</code> p.
+ * <LI> <code>Screen</code> s5 observes the <code>display(String)</code>
+ * methods of <code>Screen</code> s2 and s4.
+ * </UL>
+ *
+ * Every time an event of interest occurs, the observing <code>Screen</code>
+ * prints an appropriate message to stdout. <p>
+ *
+ * <p>This is the Java version.</i><p>
+ *
+ * The example illustrates that it is hard to
+ * cleanly modularize the different observing relationships. The following
+ * implementation issues have to be considered for the Java version:
+ * <UL>
+ * <LI> Observer and Subject can only be interfaces (as opposed to abstract
+ * classes) if we do not want to restrict inhertance and thus code
+ * reuse of existing classes completely.
+ * <LI> As interfaces, we cannot attach default implementations for methods
+ * like <i>attach(Observer)</i>, <i>notify()</i>, etc. Note that
+ * these two problems only apply because Java does not offer multiple
+ * inheritance.
+ * <LI> Some implementation constraints are made implicit and are thus not
+ * enforced: I.e., each <i>Subject</i> needs a field to store its
+ * <i>Observer</i>s
+ * <LI> The classes that become <i>Subject</i> and <i>Observer</i> in the
+ * pattern context need to be modified. In particular, <i>Subject</i>s
+ * need to store the mapping, implement the appropriate procedures.
+ * <i>Observer</i>s need to
+ * implement <i>update()</i>
+ * <LI> If a particular class takes part in more than one observing
+ * relationship (as in this example), it is difficult to have both
+ * notify/update mechanisms go through the same interface and yet
+ * separate them cleanly.
+ * </UL>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Observer example. It creates five
+ * <code>Screen</code> objects and one <code>Point</code> object
+ * and sets the appropriate observing relationships (see above).
+ * After the setup, the color of the point is changed, then it's
+ * x-coordinate. <p>
+ * The following results should be expected: <OL>
+ * <LI> The color change should trigger s1 and s2 to each print an
+ * appropriate message.
+ * <LI> s2's message should trigger it's observer s5 to print
+ * a message.
+ * <LI> The coordinate change should trigger s3 and s4.
+ * <LI> s4's message should trigger it's observer s5 again.
+ */
+
+ public static void main(String argv[]) {
+
+ Point p = new Point(5, 5, Color.blue);
+
+ System.out.println("Creating Screen s1,s2,s3,s4,s5 and Point p");
+
+ Screen s1 = new Screen("s1");
+ Screen s2 = new Screen("s2");
+
+ Screen s3 = new Screen("s3");
+ Screen s4 = new Screen("s4");
+
+ Screen s5 = new Screen("s5");
+
+ System.out.println("Creating observing relationships:");
+ System.out.println("- s1 and s2 observe color changes to p");
+ System.out.println("- s3 and s4 observe coordinate changes to p");
+ System.out.println("- s5 observes s2's and s4's display() method");
+
+ p.addObserver(s1);
+ p.addObserver(s2);
+
+ p.addObserver(s3);
+ p.addObserver(s4);
+
+ s2.addObserver(s5);
+ s4.addObserver(s5);
+
+ System.out.println("Changing p's color:");
+
+ p.setColor(Color.red);
+
+ System.out.println("Changing p's x-coordinate:");
+
+ p.setX(4);
+
+ System.out.println("done.");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java
new file mode 100644
index 000000000..2a4322bb3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java
@@ -0,0 +1,165 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.awt.Color;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Represents a point with x and y coordinates and a color.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Point implements ChangeSubject {
+
+ /**
+ * stores the <i>Observer</i>s for this point (<i>Subject</i>)
+ */
+
+ private HashSet observers;
+
+ /**
+ * the point's x-coordinate
+ */
+
+ private int x;
+
+ /**
+ * the point's y-coordinate
+ */
+
+ private int y;
+
+ /**
+ * the point's current color
+ */
+
+ private Color color;
+
+ /**
+ * Creates a new point object based on x and y coordinates and color.
+ */
+
+ public Point(int x, int y, Color color) {
+ this.x = x;
+ this.y = y;
+ this.color=color;
+ this.observers = new HashSet();
+ }
+
+ /**
+ * Returns the point's current x-coordinate.
+ *
+ * @return the current x-coordinate
+ */
+
+ public int getX() {
+ return x;
+ }
+
+ /**
+ * Returns the point's current y-coordinate.
+ *
+ * @return the current y-coordinate
+ */
+
+ public int getY() {
+ return y;
+ }
+
+ /**
+ * Sets the current x-coordinate.
+ *
+ * @param x the new x-coordinate
+ */
+
+ public void setX(int x) {
+ this.x = x;
+ notifyObservers();
+ }
+
+ /**
+ * Sets the current y-coordinate.
+ *
+ * @param y the new y-coordinate
+ */
+
+ public void setY(int y) {
+ this.y = y;
+ notifyObservers();
+ }
+
+ /**
+ * Returns the point's current color.
+ *
+ * @return the current color
+ */
+
+ public Color getColor() { return color; }
+
+ /**
+ * Sets the current color.
+ *
+ * @param color the new color
+ */
+
+ public void setColor(Color color) {
+ this.color = color;
+ notifyObservers();
+ }
+
+
+ /**
+ * Attaches an <i>Observer</i> to this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to attach
+ */
+
+ public void addObserver(ChangeObserver o) {
+ this.observers.add(o);
+ }
+
+ /**
+ * Detaches an <i>Observer</i> from this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to detach
+ */
+
+ public void removeObserver(ChangeObserver o) {
+ this.observers.remove(o);
+ }
+
+ /**
+ * Notifies all <i>Observer</i>s.
+ */
+
+ public void notifyObservers() {
+ for (Iterator e = observers.iterator() ; e.hasNext() ;) {
+ ((ChangeObserver)e.next()).refresh(this);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java
new file mode 100644
index 000000000..1860b477b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java
@@ -0,0 +1,123 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.observer.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Provides a means to output messages. Objects of this class act as
+ * output devices.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.11, 04/01/04
+ */
+
+public class Screen implements ChangeSubject, ChangeObserver {
+
+ /**
+ * stores the <i>Observer</i>s for this screen (<i>Subject</i>)
+ */
+
+ private HashSet observers;
+
+
+ /**
+ * the individual name of this screen object
+ */
+
+ private String name;
+
+ /**
+ * creates a new <code>Screen</code> object with the provided name.
+ *
+ * @param name the name for the new <code>Screen</code> object
+ */
+
+ public Screen(String s) {
+ this.name = s;
+ observers = new HashSet();
+ }
+
+
+ /**
+ * Prints the name of the <code>Screen</code> object and the argument
+ * string to stdout.
+ *
+ * @param s the string to print
+ */
+
+ public void display (String s) {
+ System.out.println(name + ": " + s);
+ notifyObservers();
+ }
+
+ /**
+ * Attaches an <i>Observer</i> to this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to attach
+ */
+
+ public void addObserver(ChangeObserver o) {
+ this.observers.add(o);
+ }
+
+ /**
+ * Detaches an <i>Observer</i> from this <i>Subject</i>.
+ *
+ * @param o the <i>Observer</i> to detach
+ */
+
+ public void removeObserver(ChangeObserver o) {
+ this.observers.remove(o);
+ }
+
+ /**
+ * Notifies all <i>Observer</i>s.
+ */
+
+ public void notifyObservers() {
+ for (Iterator e = observers.iterator() ; e.hasNext() ;) {
+ ((ChangeObserver)e.next()).refresh(this);
+ }
+ }
+
+ /**
+ * Updates an <i>Observer</i>. Uses the <i>push</i> strategy (i.e. the
+ * subject triggering the update passes itself as an argument).
+ *
+ * This particular method prints a message showing what object caused
+ * the update
+ *
+ * @param s the <i>Subject</i> triggering the update
+ */
+
+ public void refresh(ChangeSubject s) {
+ String subjectTypeName = s.getClass().getName();
+ subjectTypeName = subjectTypeName.substring(
+ subjectTypeName.lastIndexOf(".")+1, subjectTypeName.length());
+ display("update received from a "+subjectTypeName+" object");
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java
new file mode 100644
index 000000000..81c4584a9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java
@@ -0,0 +1,105 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Prototype design pattern example.<p>
+ *
+ * Intent: <i>Specify the kinds of objects to create using a prototypical
+ * instance, and create new objects by copying this prototype.</i><p>
+ *
+ * Participatng objects are <code>StringPrototypeA</code> and
+ * <code>StringPrototypeB</code> as <i>Prototype</i>s.<p>
+ *
+ * In this example, both StringPrototypeA and StringPrototypeB implement cloneable
+ * classes emulating limited String behavior. This driver creates an
+ * object of each class and clones it. Both originals and clones are
+ * manipulated to show that they are different objects.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Java's <code>Cloneable</code> interface is used internally. In this
+ * version, a standard implementation for <code>createClone()</code> is
+ * provided by the abstract pattern aspect. Each concrete pattern instance
+ * aspect can define special behavior by overwriting the appropriate
+ * methods. Consequently, the participants are freed of the pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeA
+ * @see StringPrototypeB
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Prototype design pattern example.<p>
+ *
+ * In this example, both StringPrototypeA and StringPrototypeB implement cloneable
+ * classes emulating limited String behavior. This driver creates an
+ * object of each class and clones it. Both originals and clones are
+ * manipulated to show that they are different objects.
+ *
+ * @param args the command line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Testing the Prototype design pattern implementation...");
+
+ StringPrototypeA originalA;
+ StringPrototypeB originalB;
+ StringPrototypeA copyA1, copyA2;
+ StringPrototypeB copyB1;
+
+ originalA = new StringPrototypeA(" This is Prototype 1");
+ originalB = new StringPrototypeB(" This is Prototype 2");
+
+ System.out.println("These are the two prototypes:");
+ System.out.println(originalA);
+ System.out.println(originalB);
+
+ copyA1 = (StringPrototypeA) StringPrototypes.aspectOf().cloneObject(originalA);
+ copyB1 = (StringPrototypeB) StringPrototypes.aspectOf().cloneObject(originalB);
+
+ System.out.println("These are copies of the prototypes:");
+ System.out.println(copyA1);
+ System.out.println(copyB1);
+
+ System.out.println("Now prototype 1 is changed. Here are prototype 1 and its former copy:");
+ originalA.setText(" This is Prototype 1 (changed)");
+ System.out.println(originalA);
+ System.out.println(copyA1);
+
+ System.out.println("This is a clone of the changed prototype 1 and a changed copy of prototype 2:");
+ copyA2 = (StringPrototypeA) StringPrototypes.aspectOf().cloneObject(originalA);
+ copyB1.setText(" This is a changed copy of prototype 2");
+ System.out.println(copyA2);
+ System.out.println(copyB1);
+
+
+ System.out.println("... done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java
new file mode 100644
index 000000000..a0ac669f1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Prototype</i> that imitates a simple String
+ * class. The clone method is now implemented by the aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeB
+ */
+
+public class StringPrototypeA implements Cloneable {
+
+ /**
+ * the string that this object encapsulates
+ */
+
+ protected String text;
+
+ /**
+ * Creates a new StringPrototypeA object with the given string
+ *
+ * @param init the initial String for this object
+ */
+
+ public StringPrototypeA(String init) {
+ text = init;
+ }
+
+ /**
+ * Changes the string this object encapsulates
+ *
+ * @param newText the new text for this object.
+ */
+
+ public void setText(String newText) {
+ text = newText;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return a string representation of this object.
+ */
+
+ public String toString() {
+ return "MyString: "+ text;
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java
new file mode 100644
index 000000000..600d0b901
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java
@@ -0,0 +1,73 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Prototype</i> that imitates a simple String
+ * class. The clone method is now implemented by the aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeA
+ */
+
+public class StringPrototypeB implements Cloneable {
+
+ /**
+ * the string that this object encapsulates
+ */
+
+ protected String text;
+
+ /**
+ * Creates a new StringPrototypeA object with the given string
+ *
+ * @param init the initial String for this object
+ */
+
+ public StringPrototypeB(String init) {
+ text = init;
+ }
+
+ /**
+ * Changes the string this object encapsulates
+ *
+ * @param newText the new text for this object.
+ */
+
+ public void setText(String newText) {
+ text = newText;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return a string representation of this object.
+ */
+
+ public String toString() {
+ return "AnotherString: " + text;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java
new file mode 100644
index 000000000..00bbe30f4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.PrototypeProtocol;
+
+/**
+ * Concretizes the abstract Prototype design pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ */
+
+public aspect StringPrototypes extends PrototypeProtocol {
+
+ /**
+ * Assigns the <i>Prototype</i> role to </code>StringPrototypeA</code>
+ */
+
+ declare parents: StringPrototypeA implements Prototype;
+
+ /**
+ * Assigns the <code>Prototype</code> role to </code>StringPrototypeB</code>
+ */
+
+ declare parents: StringPrototypeB implements Prototype;
+
+ /**
+ * Provides an alternative method for cases when the default
+ * <code>clone()</code> method fails: Clones objects "by hand".
+ *
+ * @param object the prototype object to clone
+ * @return a copy of the object
+ */
+
+ protected Object createCloneFor(Prototype object) {
+ if (object instanceof StringPrototypeB) {
+ return new StringPrototypeB(((StringPrototypeB)object).toString());
+ } else {
+ return null;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/tut-source-compile-error.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/tut-source-compile-error.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/tut-source-compile-error.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java
new file mode 100644
index 000000000..3552ac567
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java
@@ -0,0 +1,108 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Prototype design pattern example.<p>
+ *
+ * Intent: <i>Specify the kinds of objects to create using a prototypical
+ * instance, and create new objects by copying this prototype.</i><p>
+ *
+ * Participating objects are <code>StringPrototypeA</code> and
+ * <code>StringPrototypeB</code> as <i>Prototype</i>s.<p>
+ *
+ * In this example, both StringPrototypeA and StringPrototypeB
+ * implement cloneable classes emulating limited String behavior.
+ * This driver creates an object of each class and clones it.
+ * Both originals and clones are manipulated to show that they are
+ * different objects.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Java's <code>Cloneable</code> interface is used.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeA
+ * @see StringPrototypeB
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Prototype design pattern example.<p>
+ *
+ * In this example, both StringPrototypeA and StringPrototypeB implement cloneable
+ * classes emulating limited String behavior. This driver creates an
+ * object of each class and clones it. Both originals and clones are
+ * manipulated to show that they are different objects.
+ *
+ * @param args the command line parameters, unused.
+ */
+
+ public static void main(String[] args) {
+
+ try {
+
+ System.out.println("Testing the Prototype design pattern implementation...");
+
+ StringPrototypeA originalA;
+ StringPrototypeB originalB;
+ StringPrototypeA copyA1, copyA2;
+ StringPrototypeB copyB1;
+
+ originalA = new StringPrototypeA(" This is Prototype 1");
+ originalB = new StringPrototypeB(" This is Prototype 2");
+
+ System.out.println("These are the two prototypes:");
+ System.out.println(originalA);
+ System.out.println(originalB);
+
+ copyA1 = (StringPrototypeA) originalA.clone();
+ copyB1 = (StringPrototypeB) originalB.clone();
+
+ System.out.println("These are copies of the prototypes:");
+ System.out.println(copyA1);
+ System.out.println(copyB1);
+
+ System.out.println("Now prototype 1 is changed. Here are prototype 1 and its former copy:");
+ originalA.setText(" This is Prototype 1 (changed)");
+ System.out.println(originalA);
+ System.out.println(copyA1);
+
+ System.out.println("This is a clone of the changed prototype 1 and a changed copy of prototype 2:");
+ copyA2 = (StringPrototypeA) originalA.clone();
+ copyB1.setText(" This is a changed copy of prototype 2");
+ System.out.println(copyA2);
+ System.out.println(copyB1);
+
+
+ System.out.println("... done.");
+
+ } catch (CloneNotSupportedException ex) {
+ System.err.println("Can't clone prototype objects"+ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java
new file mode 100644
index 000000000..6019d416d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Prototype</i> that imitates a simple String
+ * class.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeB
+ */
+
+public class StringPrototypeA implements Cloneable {
+
+ /**
+ * the string that this object encapsulates
+ */
+
+ protected String text;
+
+ /**
+ * Creates a new StringPrototypeA object with the given string
+ *
+ * @param init the initial String for this object
+ */
+
+ public StringPrototypeA(String init) {
+ text = init;
+ }
+
+ /**
+ * Changes the string this object encapsulates
+ *
+ * @param newText the new text for this object.
+ */
+
+ public void setText(String newText) {
+ text = newText;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @returns a string representation of this object.
+ */
+
+ public String toString() {
+ return "StringPrototypeA: "+ text;
+ }
+
+ /**
+ * Returns a copy of this object. Does only work this way if the
+ * superclass implements <code>clone()</code>.
+ */
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java
new file mode 100644
index 000000000..2c6f23954
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java
@@ -0,0 +1,82 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Prototype</i> that imitates a simple String
+ * class.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ *
+ * @see StringPrototypeA
+ */
+
+public class StringPrototypeB implements Cloneable {
+
+ /**
+ * the string that this object encapsulates
+ */
+
+ protected String text;
+
+ /**
+ * Creates a new StringPrototypeA object with the given string
+ *
+ * @param init the initial String for this object
+ */
+
+ public StringPrototypeB(String init) {
+ text = init;
+ }
+
+ /**
+ * Changes the string this object encapsulates
+ *
+ * @param newText the new text for this object.
+ */
+
+ public void setText(String newText) {
+ text = newText;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return a string representation of this object.
+ */
+
+ public String toString() {
+ return "StringPrototypeB: " + text;
+ }
+
+ /**
+ * Returns a copy of this object. Does only work this way if the
+ * superclass implements <code>clone()</code>.
+ */
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java
new file mode 100644
index 000000000..89ecd27d8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java
@@ -0,0 +1,47 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This class will serve as a Delegate for OutputImplementation. Note that no
+ * interfaces need to be implemented. This is not a <i>Subject</i> and does in
+ * fact play no role in the pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class AlternateOutputImplementation {
+
+ /**
+ * Prints the argument string to
+ * <code>System.out</code>
+ *
+ * @param s the string to print
+ */
+
+ public void alternateRequest(String s) {
+ System.out.println("[AlternateSubject.safeRequest()]: "+s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java
new file mode 100644
index 000000000..3081d8b01
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java
@@ -0,0 +1,99 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Proxy design pattern example.<p>
+ *
+ * Intent: <i>Provide a surrogate or placeholder for another object to control
+ * access to it.</i><p>
+ *
+ * Participating objects are <code>OutputImplementation</code>s and
+ * <code>AlternateOutputImplementation</code>.
+ *
+ * The former acts as a <i>RealSubject</i>.
+ *
+ * Experimental setup:
+ * <code>Main</code> issues three different kinds of requests to
+ * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice.
+ * <UL>
+ * <LI> SAFE requests are delegated to a different object
+ * (delegation proxy)
+ * <LI> REGULAR request are counted
+ * <LI> UNSAFE requests are blocked entirely.
+ * </UL>
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Each concrete aspect defines exactly what requests it is interested
+ * in. For those requests, it declares how to deal with the request.
+ *
+ * The proxy implementation is localized. Even clients need not set
+ * or remove proxies.
+ *
+ * Please note that the AspectJ version includes an additional proxy
+ * that delegates safe request to a different object. An OO implementation
+ * would be similar to the other OO proxies.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Creates a new Main object and runs the test suite.
+ */
+
+ public Main() {
+
+ /**
+ * The <i>RealSubject</i> that the client sends all requests to
+ */
+
+ OutputImplementation real = new OutputImplementation();
+
+ System.out.println("\n===> Issuing SAFE request...");
+ real.safeRequest ("Safe Reqeust");
+ System.out.println("\n===> Issuing REGULAR request...");
+ real.regularRequest("Normal Request");
+ System.out.println("\n===> Issuing UNSAFE request...");
+ real.unsafeRequest ("Unsafe Request");
+
+ System.out.println("\n===> Issuing SAFE request...");
+ real.safeRequest ("Safe Reqeust");
+ System.out.println("\n===> Issuing REGULAR request...");
+ real.regularRequest("Normal Request");
+ System.out.println("\n===> Issuing UNSAFE request...");
+ real.unsafeRequest ("Unsafe Request");
+ }
+
+ /**
+ * Implements the driver for the proxy design pattern example.
+ */
+
+ public static void main (String[] args) {
+ Main main = new Main();
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java
new file mode 100644
index 000000000..2023025d0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Represents a <i>RealSubject</i> according to GoF.
+ * Note that it does not have to implement any interface in the AspectJ
+ * version.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class OutputImplementation {
+
+ /**
+ * A type of <i>request(..)</i>. Prints the argument string to
+ * <code>System.out</code>
+ *
+ * @param s the string to print
+ */
+
+ public void safeRequest(String s) {
+ System.out.println("[OutputImplementation.safeRequest()]: "+s);
+ }
+
+ /**
+ * A type of <i>request(..)</i>.
+ * <code>System.out</code>
+ *
+ * @param s the string to print
+ */
+
+ public void regularRequest(String s) {
+ System.out.println("[OutputImplementation.regularRequest()]: "+s);
+ }
+
+ /**
+ * A type of <i>request(..)</i>.
+ *
+ * @param s the string to print
+ */
+
+ public void unsafeRequest(String s) {
+ System.out.println("[OutputImplementation.unsafeRequest()]: "+s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java
new file mode 100644
index 000000000..d157d44eb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java
@@ -0,0 +1,78 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol;
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Implements a concrete Proxy pattern instance. Here, all unsafe requests
+ * from <code>Main</code> <code>OutputImplementation</code>
+ * are blocked.<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public aspect RequestBlocking extends ProxyProtocol {
+
+ /**
+ * Assigns the <i>Subject</i> role to <code>OutputImplementation</code>.
+ */
+
+ declare parents: OutputImplementation implements Subject;
+
+ /**
+ * Captures all accesses to the <i>Subject</i> that should be protected by
+ * this proxy. Here: All calls to <code>
+ * OutputImplementation.unsafeRequest(..)</code>.
+ */
+
+ protected pointcut requests():
+ call(* OutputImplementation.unsafeRequest(..));
+
+ /**
+ * Checks whether the access needs to be handled by the proxy or not.
+ * Here: All accesses that come from <code>Main</code> objects are
+ * denied.
+ *
+ * @param caller the object responsible for the protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the protected access
+ *
+ * @return true if the access is from a Main object, false otherwise
+ */
+
+ protected boolean isProxyProtected(Object caller,
+ Subject subject,
+ JoinPoint joinPoint) {
+ if (joinPoint.getThis() instanceof Main) {
+ System.out.println("[RequestBlocking] intercepting unsafe " +
+ "requests from Main");
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java
new file mode 100644
index 000000000..da91e003a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol;
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Implements a concrete proxy pattern instance. Here, all method calls from
+ * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public aspect RequestCounting extends ProxyProtocol {
+
+ /**
+ * An internal counter for the number of calls to <code>
+ * print(String)</code>.
+ */
+
+ private int regularRequests = 0;
+
+
+ /**
+ * Assigns the <i>OutputSubject</i> role to <code>OutputImplementation</code>.
+ */
+
+ declare parents: OutputImplementation implements Subject;
+
+ /**
+ * Captures all accesses to the subject that should be protected by
+ * this pattern instance. Here: All calls to <code>
+ * OutputImplementation.print(..)</code>.
+ */
+
+ protected pointcut requests():
+ call(* OutputImplementation.regularRequest(..));
+
+ /**
+ * Checks whether the access should be denied or not. Here: All accesses
+ * that come from <code>Main</code> objects are denied.
+ *
+ * @param caller the object responsible for the protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the protected access
+ *
+ * @return true if the access is from a Main object, false otherwise
+ */
+
+ protected boolean isProxyProtected(Object caller,
+ Subject subject,
+ JoinPoint joinPoint) {
+ if (joinPoint.getThis() instanceof Main) {
+ regularRequests++;
+ System.out.println("[RequestCounter:] That was regular request nr. " +
+ regularRequests);
+ }
+ return false;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java
new file mode 100644
index 000000000..053c5564a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java
@@ -0,0 +1,105 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol;
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Implements a concrete proxy pattern instance. Here, all method calls from
+ * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public aspect RequestDelegation extends ProxyProtocol {
+
+ /**
+ * Assigns the <i>Subject</i> role to <code>OutputImplementation
+ * </code>.
+ */
+
+ declare parents: OutputImplementation implements Subject;
+
+ private AlternateOutputImplementation alternateSubject =
+ new AlternateOutputImplementation();
+
+ /**
+ * Captures all accesses to the subject that should be protected by
+ * this pattern instance. Here: All calls to <code>
+ * OutputImplementation.safeRequest(..)</code>.
+ */
+
+ protected pointcut requests():
+ call(* OutputImplementation.safeRequest(..));
+
+
+ /**
+ * Checks whether the request should be handled by the Proxy or not.
+ * Here: All accesses matched by the <code>protectedAccesses()</code>
+ * joinpoint.
+ *
+ * @param caller the object responsible for the protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the protected access
+ *
+ * @return true if the access is covered by the proxy, false otherwise
+ */
+
+ protected boolean isProxyProtected(Object caller,
+ Subject subject,
+ JoinPoint joinPoint) {
+ System.out.println("[RequestDelegation] delegating a safe request " +
+ "to a different type of object");
+ return true;
+ }
+
+ /**
+ * For delegation: Provides an alternative return value if access
+ * is proxy protected. A default implementation is supplied so that
+ * concrete subaspects are not forced to implement the method.
+ * Here, it also calls an appropriate method on a delegate
+ * (to illustrate how delegation would work).
+ *
+ * @param caller the object responsible for the proxy protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the proxy protected
+ * access
+ *
+ * @return an alternative return value
+ */
+
+ protected Object handleProxyProtection(Object caller,
+ Subject subject,
+ JoinPoint joinPoint) {
+ Object[] args = joinPoint.getArgs();
+ if (args != null) {
+ alternateSubject.alternateRequest((String)args[0]);
+ } else {
+ alternateSubject.alternateRequest("");
+ }
+ return null;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java
new file mode 100644
index 000000000..e4e91283b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the RequestCounter design pattern example.<p>
+ *
+ * Intent: <i>Provide a surrogate or placeholder for another object to control
+ * access to it.</i><p>
+ *
+ * Participating objects are <code>OutputImplementation</code> and
+ * <code>RequestCounter</code> as <i>RealSubject</i> and <i>Proxy</i>,
+ * respectively.
+ *
+ * Both implement the <code>OutputSubject</code> interface, which represents
+ * the <i>Subject</i> interface.
+ *
+ * Experimental setup:
+ * <code>Main</code> issues three different kinds of requests to
+ * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice.
+ * <UL>
+ * <LI> SAFE requests are not affected
+ * <LI> REGULAR request are counted
+ * <LI> UNSAFE requests are blocked entirely.
+ * </UL>
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * <i>Proxy</i>s needs to implement all methods of
+ * <code>OutputSubject</code>, even those it is not interested in.
+ * They need to be aware of their role in the pattern.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the proxy design pattern. <p>
+ */
+
+ public static void main (String[] args) {
+ OutputSubject real = new OutputImplementation();
+ OutputSubject countingProxy = new RequestCounter(real);
+ OutputSubject blockingProxy = new RequestBlocker(countingProxy);
+
+ System.out.println("\n===> Issuing SAFE request...");
+ blockingProxy.safeRequest ("Safe Reqeust");
+ System.out.println("\n===> Issuing REGULAR request...");
+ blockingProxy.regularRequest("Normal Request");
+ System.out.println("\n===> Issuing UNSAFE request...");
+ blockingProxy.unsafeRequest ("Unsafe Request");
+
+ System.out.println("\n===> Issuing SAFE request...");
+ blockingProxy.safeRequest ("Safe Reqeust");
+ System.out.println("\n===> Issuing REGULAR request...");
+ blockingProxy.regularRequest("Normal Request");
+ System.out.println("\n===> Issuing UNSAFE request...");
+ blockingProxy.unsafeRequest ("Unsafe Request");
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java
new file mode 100644
index 000000000..dab1bedd1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java
@@ -0,0 +1,67 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Acts as <i>RealSubject</i> according to GoF. It implements the
+ * <code>OutputSubject</code> interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class OutputImplementation implements OutputSubject {
+
+ /**
+ * A type of <i>request(..)</i>. Prints the argument string to
+ * <code>System.out</code>
+ *
+ * @param s the string to print
+ */
+
+ public void safeRequest(String s) {
+ System.out.println("[RealSubject.safeRequest()]: "+s);
+ }
+
+ /**
+ * A type of <i>request(..)</i>.
+ * <code>System.out</code>
+ *
+ * @param s the string to print
+ */
+
+ public void regularRequest(String s) {
+ System.out.println("[RealSubject.regularRequest()]: "+s);
+ }
+
+ /**
+ * A type of <i>request(..)</i>.
+ *
+ * @param s the string to print
+ */
+
+ public void unsafeRequest(String s) {
+ System.out.println("[RealSubject.unsafeRequest()]: "+s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java
new file mode 100644
index 000000000..a6f9cf362
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java
@@ -0,0 +1,60 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the <i>Subject</i> interface that is implemented by both
+ * <code>RequestCounter</code> and <code>OutputImplementation</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface OutputSubject {
+
+ /**
+ * A type of <i>request(..)</i>.
+ *
+ * @param s the string to print
+ */
+
+ public void safeRequest(String s);
+
+ /**
+ * A type of <i>request(..)</i>.
+ *
+ * @param s the string to print
+ */
+
+ public void regularRequest(String s);
+
+ /**
+ * A type of <i>request(..)</i>.
+ *
+ * @param s the string to print
+ */
+
+ public void unsafeRequest(String s);
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java
new file mode 100644
index 000000000..be562498f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java
@@ -0,0 +1,94 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Acts as <i>Proxy</i> according to GoF. It implements the
+ * <code>OutputSubject</code> interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class RequestBlocker implements OutputSubject {
+
+ /**
+ * a reference to the <i>Subject</i> (used to forward requests to)
+ */
+
+ private OutputSubject realSubject;
+
+ /**
+ * Creates a new <code>RequestBlocker</code> with the given
+ * <i>Subject</i>.
+ *
+ * @param subject The <i>Subject</i> to forward method calls to
+ */
+
+ public RequestBlocker(OutputSubject subject) {
+ this.realSubject = subject;
+ }
+
+ /**
+ * Forwards the request to its subject. We are not interested in
+ * this kind of request, but must implement the method (and the
+ * request forwarding) anyway since the method is part of the
+ * <code>RequestBlocker</code> interface.
+ *
+ * @param s the string to print
+ */
+
+ public void safeRequest(String s) {
+ realSubject.safeRequest(s);
+ System.out.println("[RequestBlocker:] Not interested in safe requests," +
+ " but must implement anyway");
+ }
+
+ /**
+ * Forwards the request to its subject. We are not interested in
+ * this kind of request, but must implement the method (and the
+ * request forwarding) anyway since the method is part of the
+ * <code>RequestBlocker</code> interface.
+ *
+ * @param s the string to print
+ */
+
+ public void regularRequest(String s) {
+ realSubject.regularRequest(s);
+ System.out.println("[RequestBlocker:] Not interested in regular requests," +
+ " but must implement anyway");
+ }
+
+ /**
+ * Blocks unsafe requests.
+ *
+ * @param s the string to print
+ */
+
+ public void unsafeRequest(String s) {
+ realSubject.unsafeRequest(s);
+ System.out.println("[RequestBlocker:] " + s + " blocked.");
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java
new file mode 100644
index 000000000..ba55bc0ea
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java
@@ -0,0 +1,104 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Acts as <i>Proxy</i> according to GoF. It implements the
+ * <code>OutputSubject</code> interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class RequestCounter implements OutputSubject {
+
+ /**
+ * a reference to the <i>Subject</i> (used to forward requests to)
+ */
+
+ private OutputSubject realSubject;
+
+ /**
+ * An internal counter for the number of calls to <code>
+ * print(String)</code>.
+ */
+
+ private int regularRequests = 0;
+
+ /**
+ * Creates a new <code>RequestCounter</code> with the given
+ * <i>Subject</i>.
+ *
+ * @param subject The <i>Subject</i> to forward method calls to
+ */
+
+ public RequestCounter(OutputSubject subject) {
+ this.realSubject = subject;
+ }
+
+ /**
+ * Forwards the request to its subject. We are not interested in
+ * this kind of request, but must implement the method (and the
+ * request forwarding) anyway since the method is part of the
+ * <code>RequestBlocker</code> interface.
+ *
+ * @param s the string to print
+ */
+
+ public void safeRequest(String s) {
+ realSubject.safeRequest(s);
+ System.out.println("[RequestCounter:] Not interested in safe " +
+ "requests, but must implement anyway");
+ }
+
+ /**
+ * Forwards the request to its subject and prints
+ * out how many times the <i>request()</i> has been called so far.
+ *
+ * @param s the string to print
+ */
+
+ public void regularRequest(String s) {
+ regularRequests++;
+ realSubject.regularRequest(s);
+ System.out.println("[RequestCounter:] That was regular request nr. " +
+ regularRequests);
+ }
+
+ /**
+ * Forwards the request to its subject. We are not interested in
+ * this kind of request, but must implement the method (and the
+ * request forwarding) anyway since the method is part of the
+ * <code>RequestBlocker</code> interface.
+ *
+ * @param s the string to print
+ */
+
+ public void unsafeRequest(String s) {
+ realSubject.unsafeRequest(s);
+ System.out.println("[RequestCounter:] Not interested in unsafe requests," +
+ " but must implement anyway");
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java
new file mode 100644
index 000000000..18c258e66
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java
@@ -0,0 +1,158 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Singleton design pattern example.<p>
+ *
+ * Intent: <i>Ensure that a class has only one instance and provide a global
+ * point of access to it.</i><p>
+ *
+ * Participating objects are <code>Printer</code> printer1, printer2, printer3 and
+ * <code>PrinterSubclass</code> ps1, ps2, ps3.<p>
+ *
+ * Three different objects of both Printer and PrinterSubclass are
+ * instantiated and compared.
+ *
+ * This Implementation treats the singleton property as a non-inherited
+ * property. This meant that <i>Singleton</i> classes can still be subclassed
+ * and these subclasses can access the <i>Singleton</i> constructor normally.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ *
+ * @see Printer
+ * @see PrinterSubclass
+ */
+
+public class Main {
+
+ /**
+ * the three object references to instances of the <i>Singleton</i> class.
+ */
+
+ private static Printer printer1, printer2, printer3;
+
+ // Experimental setup: Main creates three Printer objects.
+ // The Printer implementation gives each object a unique ID
+ // which is printed when print() is called. If the Singleton
+ // implementation works, all three objects should be the same.
+ //
+ // Implementation: AOP5 - One (concrete) aspect defines the behavior
+ // of the pattern, creating a generic getInstance() method that
+ // is attached to the Singleton interface. Another aspect assigns
+ // the role to a particular class.
+ //
+ // The general description of the pattern is reusable.
+ //
+ // Considers different signatures for the constructor.
+ //
+ // Clients don't have to type-cast, they just use new(..)
+ //
+ // Subclasses are automatically Singletons, too, unless
+ // explicitly declared as non-singletons
+
+
+ /**
+ * Implements the first test case. Creates 3 references to the
+ * <i>Singleton</i> by using the regular constructor. That should
+ * create three identical objects.
+ */
+
+ private static void test1() {
+ System.out.println("\nTest 1: All three printers should have the "
+ + "same ID");
+
+ printer1 = new Printer();
+ printer2 = new Printer();
+ printer3 = new Printer();
+
+ printer1.print();
+ printer2.print();
+ printer3.print();
+ }
+
+
+
+ /**
+ * Implements the second test case. Tests if the 3 objects from test 1 are
+ * in fact identical
+ */
+
+ private static void test2() {
+ System.out.println("\nTest 2: All three objects should be identical");
+
+ System.out.print("\tThey are ");
+ if ((printer1 == printer2) && (printer1 == printer3)) {
+ System.out.println("identical");
+ }
+ else {
+ System.out.println("not identical");
+ }
+ }
+
+
+ /**
+ * Implements the third test case. Creates 3 instances of the <i>Singleton
+ * </i>'s subclass. These objects should be different.
+ */
+
+ private static void test3() {
+ System.out.println("\nTest 3: Ensuring that subclasses can access the"
+ + "constructor");
+ System.out.println(" (All three outputs should be different)");
+
+ printer1 = new PrinterSubclass();
+ printer2 = new PrinterSubclass();
+ printer3 = new PrinterSubclass();
+
+ printer1.print();
+ printer2.print();
+ printer3.print();
+ }
+
+
+ /**
+ * This is the driver for the <code>Singleton</code> case. It performes
+ * three tests:
+ *
+ * <OL>
+ * <LI> Creates 3 references to the <i>Singleton</i> by using the
+ * regular constructor. That should create three identical objects.
+ * <LI> Tests if the above 3 objects are in fact identical
+ * <LI> Creates 3 instances of a <i>Singleton</i>'s subclass. These
+ * objects should be different.
+ * </OL>
+ */
+
+ public static void main (String[] args) {
+ System.out.println("Testing SINGLETON pattern (aspectj) ...");
+ test1();
+ test2();
+ test3();
+ System.out.println("\n... done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java
new file mode 100644
index 000000000..867b34b73
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java
@@ -0,0 +1,75 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample class that will be assigned the <i>Singleton</i> role
+ * in this example. The class's functionality
+ * is to store an instance-specific ID and provide a <code>print()</code>
+ * method that shows an object's ID.
+ *
+ * Note that in this implementation the class does not have to know
+ * that it is a <i>Singleton</i> (i.e. has no pattern code in it).
+ *
+ * Note further that instead of assigning the <i>Singleton</i> property
+ * via the <code>declare parents</code> construct in the aspect, it is
+ * possible to just add a <code>implements Singleton</doce> here. However,
+ * that would introduce pattern-related code into this type.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ */
+
+public class Printer {
+
+ /**
+ * counts the instances of this class
+ */
+
+ protected static int objectsSoFar = 0;
+
+ /**
+ * each instance has an ID to distinguish them.
+ */
+
+ protected int id;
+
+ /**
+ * Creates a <code>Printer</code> object. Note that the constructor
+ * is not protected; the protection is realized by the aspect.
+ */
+
+ public Printer() {
+ id = ++ objectsSoFar;
+ }
+
+ /**
+ * Prints the instance's ID to <code>System.out</code>.
+ */
+
+ public void print() {
+ System.out.println("\tMy ID is "+id);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java
new file mode 100644
index 000000000..8ec000bc5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java
@@ -0,0 +1,46 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample subclass of the <i>Singleton</i> class. This class is
+ * to test whether subclasses can still access the Singleton's constructor.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ *
+ * @see PrinterSingleton
+ */
+
+
+public class PrinterSubclass extends Printer {
+
+ /**
+ * Creates an instance of this class by calling <code>super()</code>.
+ */
+
+ public PrinterSubclass() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java
new file mode 100644
index 000000000..d87e6373c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java
@@ -0,0 +1,60 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.SingletonProtocol;
+
+/**
+ * Implements a concrete instance of the <i>Singleton</i> pattern. It declares
+ * Printer to be Singleton and defines an exception to the constructor
+ * protection: PrinterSubclass (a subclass of the Singleton) can still
+ * access Printer's constructor.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ *
+ * @see Printer
+ * @see PrinterSubclass
+ */
+
+
+public aspect SingletonInstance extends SingletonProtocol {
+
+ /**
+ * Assigns the Singleton to <code>Printer</code>. This is all that is
+ * necessary to provide <code>Printer</i>'s constructor with the
+ * Singleton protection.
+ */
+
+ declare parents: Printer implements Singleton;
+
+ /**
+ * This declaration allows <code>PrinterSubclass</code> (and all its
+ * subclasses) to access <code>Printer</code>'s constructor within
+ * its constructor (to allow for <code>super(..)</code> calls).
+ */
+
+ protected pointcut protectionExclusions():
+ call((PrinterSubclass+).new(..));
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java
new file mode 100644
index 000000000..a03707666
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java
@@ -0,0 +1,157 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Singleton design pattern example.<p>
+ *
+ * Intent: <i>Ensure that a class has only one instance and provide a global
+ * point of access to it.</i><p>
+ *
+ * Participating objects are <code>PrinterSingleton</code> printer1, printer2, printer3 and
+ * <code>PrinterSubclass</code> ps1, ps2, ps3.<p>
+ *
+ * Three different objects of both PrinterSingleton and PrinterSubclass are
+ * instantiated and compared.
+ *
+ * This Implementation treats the singleton property as a non-inherited
+ * property. This meant that <i>Singleton</i> classes can still be subclassed
+ * and these subclasses can access the <i>Singleton</i> constructor normally.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Making the singleton property non-inherited requires to make the
+ * constructor of the <i>Singleton</i> protected (so subtypes can still
+ * invoke <code>super(..)</code> in their constructor).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ *
+ * @see PrinterSingleton
+ * @see PrinterSubclass
+ */
+
+class Main {
+
+ /**
+ * the three object references to instances of the <i>Singleton</i> class.
+ */
+
+ private static PrinterSingleton printer1, printer2, printer3;
+
+ /**
+ * Implements the first test case. Creates 3 references to the
+ * <i>Singleton</i> by (a) using the regular constructor and then by (b)
+ * using a factory method. (a) should fail (but does not, since this
+ * <code>Main</code> class is in the same package and can access the
+ * protected constructor), (b) should create three identical objects.
+ */
+
+ private static void test1() {
+ System.out.println("\nTest 1a: Try to call regular constructor. "
+ + "This should fail.");
+
+ printer1 = new PrinterSingleton();
+ printer2 = new PrinterSingleton();
+ printer3 = new PrinterSingleton();
+
+ printer1.print();
+ printer2.print();
+ printer3.print();
+
+ System.out.println("\t=> OO Problem: Classes in the same package can "
+ + "access the protected constructor.");
+
+ System.out.println("\nTest 1b: Using instance() instead. This hould "
+ + "create three identical objects.");
+
+ printer1 = PrinterSingleton.instance();
+ printer2 = PrinterSingleton.instance();
+ printer3 = PrinterSingleton.instance();
+
+ printer1.print();
+ printer2.print();
+ printer3.print();
+ }
+
+
+ /**
+ * Implements the second test case. Tests if the 3 objects from test 1 are
+ * in fact identical
+ */
+
+ private static void test2() {
+ System.out.println("\nTest 2: All three objects should be identical");
+
+ System.out.print("\tThey are ");
+ if ((printer1 == printer2) && (printer1 == printer3)) {
+ System.out.println("identical");
+ }
+ else {
+ System.out.println("not identical");
+ }
+ }
+
+
+ /**
+ * Implements the third test case. Creates 3 instances of the <i>Singleton
+ * </i>'s subclass. These objects should be different.
+ */
+
+ private static void test3() {
+ System.out.println("\nTest 3: Ensuring that subclasses can access the"
+ + " constructor");
+ System.out.println(" (All three outputs should be different)");
+
+ printer1 = new PrinterSubclass();
+ printer2 = new PrinterSubclass();
+ printer3 = new PrinterSubclass();
+
+ printer1.print();
+ printer2.print();
+ printer3.print();
+ }
+
+ /**
+ * This is the driver for the <code>Singleton</code> case. It performes
+ * three tests:
+ *
+ * <OL>
+ * <LI> Creates 3 references to the <i>Singleton</i> by (a) using the
+ * regular constructor and then by (b) using a factory method.
+ * (a) should fail, (b) should create three identical objects.
+ * <LI> Tests if the above 3 objects are in fact identical
+ * <LI> Creates 3 instances of a <i>Singleton</i>'s subclass. These
+ * objects should be different.
+ * </OL>
+ */
+
+ public static void main (String[] args) {
+ System.out.println("Testing SINGLETON pattern (java) ...");
+ test1();
+ test2();
+ test3();
+ System.out.println("\n... done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java
new file mode 100644
index 000000000..ee3d090e3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java
@@ -0,0 +1,100 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample <i>Singleton</i> class. The class's functionality
+ * is to store an instance-specific ID and provide a <code>print()</code>
+ * method that shows an object's ID.
+ *
+ * Note that in this implementation the <i>Singleton</i> class has to know
+ * that it implements the pattern (i.e. has to have appropriate code in it).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ */
+
+
+public class PrinterSingleton {
+
+ /**
+ * counts the instances of this class
+ */
+
+ protected static int objectsSoFar = 0;
+
+ /**
+ * stores this <i>Singleton</i>'s only instance
+ */
+
+ protected static PrinterSingleton onlyInstance = null;
+
+ /**
+ * each instance has an ID to distinguish them.
+ */
+
+ protected int id;
+
+ /**
+ * Creates a new <code>PrinterSingleton</code>. The new instance gets
+ * an ID equal to the total number of instances created of that type.
+ * This constructor is protected to disallow it being called from other
+ * places but the factory method and this type's subtypes.
+ *
+ * Unfortunately, this still allows other types in the same package
+ * to access the constructor.
+ *
+ * Choosing to make it <code>private</code> would prevent that problem,
+ * but would make it impossible to subclass the type properly
+ * (as subtypes then could not use <code>super(..)</code> in their
+ * constructor.
+ */
+
+ protected PrinterSingleton() {
+ id = ++ objectsSoFar;
+ }
+
+ /**
+ * Factory method that provides access to the <i>Singleton</i> instance.
+ * Uses creation-on-demand.
+ *
+ * @return the unique <i>Singleton</i> instance
+ */
+
+ public static PrinterSingleton instance() {
+ if(onlyInstance == null) {
+ onlyInstance = new PrinterSingleton();
+ }
+ return onlyInstance;
+ }
+
+ /**
+ * Prints the instance's ID to <code>System.out</code>.
+ */
+
+ public void print() {
+ System.out.println("\tMy ID is "+id);
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java
new file mode 100644
index 000000000..218f99206
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java
@@ -0,0 +1,43 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a sample subclass of the <i>Singleton</i> class. This class is
+ * to test whether subclasses can still access the Singleton's constructor.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ */
+
+public class PrinterSubclass extends PrinterSingleton {
+
+ /**
+ * Creates an instance of this class by calling <code>super()</code>.
+ */
+
+ public PrinterSubclass() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java
new file mode 100644
index 000000000..4009e3291
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java
@@ -0,0 +1,138 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the State design pattern example.<p>
+ *
+ * Intent: <i>Allow an object to alter its behavior when its internal state
+ * changes. The object will appear to change its class</i><p>
+ *
+ * Participating objects are <code>Queue</code> as <i>Context</i>, and
+ * <code>QueueNormal</code>, <code>QueueEmpty</code>, and <code>QueueFull
+ * </code> as <i>ConcreteState</i>s. The <i>State</i> interface is defined in
+ * <code>QueueState</code>.
+ * <p>
+ *
+ * This example of the State design pattern models a Queue ADT with
+ * a limited capacity that has three different states:
+ * <UL>
+ * <LI>Empty: The queue is empty
+ * <LI>Normal: The queue is neither empty nor full
+ * <LI>Full: The queue is full (# of elements = capacity)
+ * </UL>
+ * The queue stores Objects. The following operations are defined on Queue:
+ * <UL>
+ * <LI><code>insert(Object)</code> Inserts a new Object into the queue
+ * <LI><code>getFirst():Object</code> Returns the first element in the queue
+ * <LI><code>removeFirst()</code> Removes the first elelemts from the queue
+ * </UL>
+ * These are the pattern roles:
+ * <UL>
+ * <LI>Queue: Context
+ * <LI>QueueState: State interface
+ * <LI>QueueEmpty: ConcreteState1
+ * <LI>QueueNormal: ConcreteState2
+ * <LI>QueueFull: ConcreteState3
+ * </UL>
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * This implementation uses a concrete aspect to take care of all the state
+ * transitions in the system. States are no longer tangled with each other
+ * as they do not have to know about their successor states. All state
+ * transitions are localized in the aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see Queue
+ * @see QueueState
+ * @see QueueEmpty
+ * @see QueueNormal
+ * @see QueueFull
+ * @see QueueStateAspect
+ */
+
+public class Main {
+
+ /**
+ * Implements insertion into a queue. Prints out status messages.
+ *
+ * @param queue the queue to insert into
+ * @param s the string to insert into the queue
+ */
+
+ public static void testInsert(Queue queue, String s) {
+ System.out.print(" Trying to insert ["+s+"] into the queue ... ");
+ boolean status = queue.insert(s);
+ if (status == true) {
+ System.out.println("successful");
+ } else {
+ System.out.println("NOT successful, queue probably full");
+ }
+ }
+
+ /**
+ * Implements deletion from a queue. Prints out status messages.
+ *
+ * @param queue the queue to delete items from
+ */
+
+ public static void testRemove(Queue queue) {
+ System.out.print(" Trying to remove 1st element of the queue ... ");
+ String item = (String) queue.getFirst();
+ boolean status = queue.removeFirst();
+ if (status == true) {
+ System.out.println("successful: "+item);
+ } else {
+ System.out.println("NOT successful: "+item);
+ }
+ }
+
+ /**
+ * Implements the driver for the State design pattern example.<p>
+ *
+ * @param args the command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Testing Pattern: State - STARTING\n");
+
+ Queue queue = new Queue();
+ testInsert(queue, "This ");
+ testInsert(queue, "is ");
+ testInsert(queue, "a ");
+ testInsert(queue, "test");
+ System.out.println();
+ testRemove(queue);
+ testRemove(queue);
+ testRemove(queue);
+ testRemove(queue);
+
+ System.out.println("\nTesting Pattern: State - FINISHED");
+
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java
new file mode 100644
index 000000000..c5709666d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java
@@ -0,0 +1,85 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>context</i> of the queue example. This is effectively
+ * a queue with limited capacity. Requests are forwarded to the current state
+ * object.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Queue {
+
+ /**
+ * the current state of this context
+ */
+
+ protected QueueState state = new QueueEmpty();
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(Object arg) {
+ return state.insert(arg);
+ }
+
+ /**
+ * Returns the first item in the queue
+ *
+ * @return the first item in the queue
+ */
+
+ public Object getFirst() {
+ return state.getFirst();
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst() {
+ return state.removeFirst();
+ }
+
+ /**
+ * Sets the state of the context to the arguments state.
+ *
+ * @param state the new state for the context object.
+ */
+
+ public void setState(QueueState state) {
+ this.state = state;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java
new file mode 100644
index 000000000..579bea67e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java
@@ -0,0 +1,76 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "empty" for the queue example.
+ * Removing items is impossible if the queue is empty.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueNormal
+ * @see QueueFull
+ */
+
+public class QueueEmpty implements QueueState {
+
+ /**
+ * Tries to insert an object into the queue. Returns true since it is
+ * always possible to insert items into an empty queue. The appropriate
+ * state transitions are implemented by the aspect.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return true.
+ */
+
+ public boolean insert(Object arg) {
+ return true;
+ }
+
+ /**
+ * Returns the first item in the queue. Returns null since the queue is
+ * empty.
+ *
+ * @return null.
+ */
+
+ public Object getFirst() {
+ return null;
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns false (queue is
+ * empty).
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return false.
+ */
+
+ public boolean removeFirst(){
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java
new file mode 100644
index 000000000..bf9b4e8b3
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java
@@ -0,0 +1,85 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "full" for the queue example.
+ * Inserting items is impossible if the queue is full.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueEmpty
+ * @see QueueNormal
+ */
+
+public class QueueFull implements QueueState {
+
+ /**
+ * stores the items in the queue
+ */
+
+ protected Object[] items;
+
+ /**
+ * stores the index of the first item in the queue.
+ */
+
+ protected int first;
+
+ /**
+ * Tries to insert an object into the queue. Returns false since the
+ * queue is full.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return false.
+ */
+
+ public boolean insert(Object arg) {
+ return false;
+ }
+
+ /**
+ * Returns the first item in the queue.
+ *
+ * @return the first item in the queue.
+ */
+
+ public Object getFirst() {
+ return items[first];
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese. The state transition to "normal" is implemented by
+ * the aspect.
+ *
+ * @return true since it is always possible to delete an item from a
+ * full queue
+ */
+
+ public boolean removeFirst(){
+ return true;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java
new file mode 100644
index 000000000..f719d8f6a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java
@@ -0,0 +1,94 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "normal" for the queue example.
+ * Inserting and deleting items is possible in this state.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueEmpty
+ * @see QueueFull
+ */
+
+public class QueueNormal implements QueueState {
+
+ /**
+ * stores the items in the queue
+ */
+
+ protected Object[] items = new Object[3];
+
+ /**
+ * stores the index of the first item in the queue
+ */
+
+ protected int first = 0;
+
+ /**
+ * stores the index of the last item in the queue
+ */
+
+ protected int last = 0;
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese. Potential state changes to "full" are facilitated
+ * by the aspect.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(Object arg) { // Inserts a new Object into the queue
+ items[(last)%items.length] = arg;
+ last = (last+1) % items.length;
+ return true;
+ }
+
+ /**
+ * Returns the first item in the queue.
+ *
+ * @returns null.
+ */
+
+ public Object getFirst() { // Returns the first element in the queue
+ return items[first];
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese. Potential state changes to "empty" are facilitated
+ * by the aspect.
+ *
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst(){ // Removes the first element from the queue
+ first = (first + 1) % items.length;
+ return true;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java
new file mode 100644
index 000000000..32de7a10c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>State</i>s within this queue example. The
+ * operations provided are <code>insert(..)</code>, <code>getFirst(..)</code>,
+ * and <code>removeFirst(..)</code>. This verison
+ * does not require passing the context as an argument to these functions.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface QueueState {
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(Object arg);
+
+ /**
+ * Returns the first item in the queue
+ *
+ * @return the first item in the queue
+ */
+
+ public Object getFirst();
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst();
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java
new file mode 100644
index 000000000..bfdcae8e4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java
@@ -0,0 +1,114 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the state transitions for this state design pattern example.
+ * State transitions are realizied as <code>after</code> advice. The
+ * joinpoints are the calls from the context to its state object.<p>
+ *
+ * Exisiting states are reused without a employing a flyweight mechanism or
+ * (inflexibly) modularizing the transitions in the context.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ */
+
+
+public aspect QueueStateAspect {
+
+ /**
+ * the queue's "empty" state
+ */
+
+ protected QueueEmpty empty = new QueueEmpty();
+
+ /**
+ * the queue's "normal" state
+ */
+
+ protected QueueNormal normal = new QueueNormal();
+
+ /**
+ * the queue's "full" state
+ */
+
+ protected QueueFull full = new QueueFull();
+
+
+ /**
+ * Sets the initial state of the queue to empty.
+ *
+ * @param queue the queue context that is initialized.
+ */
+
+
+ after(Queue queue): initialization(new()) && target(queue) {
+ queue.setState(empty);
+ }
+
+ /**
+ * Updates the queue context's state after each call from it to the
+ * <code>insert(Object)</code> method if its current state.
+ *
+ * @param queue the queue context that makes the call.
+ * @param qs the current QueueState that receives the call
+ * @param arg the object to be inserted.
+ */
+
+ after(Queue queue, QueueState qs, Object arg): call(boolean QueueState+.insert(Object)) && target(qs) && args(arg) && this(queue) {
+ if (qs == empty) {
+ normal.insert(arg);
+ queue.setState(normal);
+ } else if (qs == normal) {
+ if (normal.first == normal.last) {
+ full.items = normal.items;
+ full.first = normal.first;
+ queue.setState(full);
+ }
+ }
+ }
+
+ /**
+ * Updates the queue context's state after each call from it to the
+ * <code>removeFirst()</code> method if its current state.
+ *
+ * @param queue the queue context that makes the call.
+ * @param qs the current QueueState that receives the call
+ */
+
+ after(Queue queue, QueueState qs): call(boolean QueueState+.removeFirst()) && target(qs) && this(queue) {
+ if (qs == full) {
+ normal.items = full.items;
+ normal.last = full.first;
+ normal.first = (full.first +1) % normal.items.length;
+ queue.setState(normal);
+ } else if (qs == normal) {
+ if (normal.first == normal.last) {
+ queue.setState(empty);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java
new file mode 100644
index 000000000..423feb302
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java
@@ -0,0 +1,147 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the State design pattern example.<p>
+ *
+ * Intent: <i>Allow an object to alter its behavior when its internal state
+ * changes. The object will appear to change its class</i><p>
+ *
+ * Participating objects are <code>Queue</code> as <i>Context</i>, and
+ * <code>QueueNormal</code>, <code>QueueEmpty</code>, and <code>QueueFull
+ * </code> as <i>ConcreteState</i>s. The <i>State</i> interface is defined in
+ * <code>QueueState</code>. This version implements an update-on-demand
+ * logic (see GoF, implementation 1, page 308). The logic requires passing
+ * the context to calls to methods defined on the state interface, and an
+ * interface for context objects. The interface is defined in
+ * <code>QueueContext</code>.
+ * <p>
+ *
+ * This example of the State design pattern models a Queue ADT with
+ * a limited capacity that has three different states:
+ * <UL>
+ * <LI>Empty: The queue is empty
+ * <LI>Normal: The queue is neither empty nor full
+ * <LI>Full: The queue is full (# of elements = capacity)
+ * </UL>
+ * The queue stores Objects. The following operations are defined on Queue:
+ * <UL>
+ * <LI><code>insert(Object)</code> Inserts a new Object into the queue
+ * <LI><code>getFirst():Object</code> Returns the first element in the queue
+ * <LI><code>removeFirst()</code> Removes the first elelemts from the queue
+ * </UL>
+ * These are the pattern roles:
+ * <UL>
+ * <LI>Queue: Context
+ * <LI>QueueState: State interface
+ * <LI>QueueEmpty: ConcreteState1
+ * <LI>QueueNormal: ConcreteState2
+ * <LI>QueueFull: ConcreteState3
+ * </UL>
+ * This implementation passes the context as an argument to its method
+ * calls to state objects, thus allowing for update on demand and removing
+ * the constraint that Queue has to ask the states for the successor state
+ * after each call.
+ *
+ * According to GoF, this implementation is generally more flexible than
+ * having the state transitions fixed in the context object. Note however
+ * that this approach results in a tight coupling of <i>ConcreteState</i>s
+ * and <i>Context</i> objects.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueContext
+ * @see Queue
+ * @see QueueState
+ * @see QueueEmpty
+ * @see QueueNormal
+ * @see QueueFull
+ */
+
+
+public class Main {
+
+ /**
+ * Implements insertion into a queue. Prints out status messages.
+ *
+ * @param queue the queue to insert into
+ * @param s the string to insert into the queue
+ */
+
+ private static void testInsert(Queue queue, String s) {
+ System.out.print(" Trying to insert ["+s+"] into the queue ... ");
+ boolean status = queue.insert(s);
+ if (status == true) {
+ System.out.println("successful");
+ } else {
+ System.out.println("NOT successful, queue probably full");
+ }
+ }
+
+ /**
+ * Implements deletion from a queue. Prints out status messages.
+ *
+ * @param queue the queue to delete items from
+ */
+
+ private static void testRemove(Queue queue) {
+ System.out.print(" Trying to remove 1st element of the queue ... ");
+ String item = (String) queue.getFirst();
+ boolean status = queue.removeFirst();
+ if (status == true) {
+ System.out.println("successful: "+item);
+ } else {
+ System.out.println("NOT successful: "+item);
+ }
+ }
+
+ /**
+ * Implements the driver for the State design pattern example.<p>
+ *
+ * @param args the command line paramters, unused
+ */
+
+ public static void main(String[] args) {
+
+ System.out.println("Testing Pattern: State - STARTING\n");
+
+ Queue queue = new Queue();
+ testInsert(queue, "This ");
+ testInsert(queue, "is ");
+ testInsert(queue, "a ");
+ testInsert(queue, "test");
+ System.out.println();
+ testRemove(queue);
+ testRemove(queue);
+ testRemove(queue);
+ testRemove(queue);
+
+ System.out.println("\nTesting Pattern: State - FINISHED");
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java
new file mode 100644
index 000000000..141a76560
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java
@@ -0,0 +1,85 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>context</i> of the queue example. This is effectively
+ * a queue with limited capacity. Requests are forwarded to the current state
+ * object.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Queue implements QueueContext {
+
+ /**
+ * the current <i>State</i> of this <i>Context</i>
+ */
+
+ protected QueueState state = new QueueEmpty();
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(Object arg) {
+ return state.insert(this, arg);
+ }
+
+ /**
+ * Returns the first item in the queue
+ *
+ * @return the first item in the queue
+ */
+
+ public Object getFirst() {
+ return state.getFirst(this);
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwise.
+ *
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst() { // Removes the first element from the queue
+ return state.removeFirst(this);
+ }
+
+ /**
+ * Sets the state of the context to the arguments state.
+ *
+ * @param state the new state for the context object.
+ */
+
+ public void setState(QueueState state) {
+ this.state = state;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java
new file mode 100644
index 000000000..09ce140cb
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java
@@ -0,0 +1,43 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>Context</i>s within this queue example. The
+ * operation provided is <code>setState(QueueState)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface QueueContext {
+
+ /**
+ * Sets the state of the context to the arguments state.
+ *
+ * @param state the new state for the context object.
+ */
+
+ public void setState(QueueState state);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java
new file mode 100644
index 000000000..a914dffd5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "empty" for the queue example.
+ * Removing items is impossible if the queue is empty. Inserting items will
+ * trigger a state change to "normal".
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueNormal
+ * @see QueueFull
+ */
+
+public class QueueEmpty implements QueueState {
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese. The state of the context
+ * is changed to "normal" (queue is no longer empty).
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(QueueContext context, Object arg) {
+ QueueNormal nextState = new QueueNormal();
+ context.setState(nextState);
+ return nextState.insert(context, arg);
+ }
+
+ /**
+ * Returns the first item in the queue. Returns null since the queue is
+ * empty.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return null.
+ */
+
+ public Object getFirst(QueueContext context) {
+ return null;
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns false (queue is
+ * empty).
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return false.
+ */
+
+ public boolean removeFirst(QueueContext context){
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java
new file mode 100644
index 000000000..1e5f677d4
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java
@@ -0,0 +1,105 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "full" for the queue example.
+ * Inserting items is impossible if the queue is full. Removing items will
+ * trigger a state change to "normal".
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueEmpty
+ * @see QueueNormal
+ */
+
+public class QueueFull implements QueueState {
+
+ /**
+ * stores the items in the queue
+ */
+
+ protected Object[] items;
+
+ /**
+ * stores the index of the first item in the queue.
+ */
+
+ protected int first;
+
+ /**
+ * Creates a new QueueFull state object with the given set of elements
+ * and the given index.
+ *
+ * @param items the content of the full queue
+ * @param first the index of the first item in the queue
+ */
+
+ public QueueFull(Object[] items, int first) {
+ this.items = items;
+ this.first = first;
+ }
+
+ /**
+ * Tries to insert an object into the queue. Returns false since the
+ * queue is full.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @param arg the object to be inserted into the queue
+ * @return false.
+ */
+
+ public boolean insert(QueueContext context, Object arg) {
+ return false;
+ }
+
+ /**
+ * Returns the first item in the queue.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return the first item in the queue.
+ */
+
+ public Object getFirst(QueueContext context) {
+ return items[first];
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese. The state of the context is changed to "normal".
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst(QueueContext context){
+ QueueState nextState = new QueueNormal(items, first, first);
+ context.setState(nextState);
+ return nextState.removeFirst(context);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java
new file mode 100644
index 000000000..cb006cf40
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java
@@ -0,0 +1,129 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the <i>ConcreteState</i> "normal" for the queue example.
+ * Inserting and deleting items is possible in this state.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see QueueEmpty
+ * @see QueueFull
+ */
+
+public class QueueNormal implements QueueState {
+
+ /**
+ * stores the items in the queue
+ */
+
+ protected Object[] items = new Object[3];
+
+ /**
+ * stores the index of the first item in the queue
+ */
+
+ protected int first = 0;
+
+ /**
+ * stores the index of the last item in the queue
+ */
+
+ protected int last = 0;
+
+ /**
+ * Creates a new QueueNormal state object with the given set of elements
+ * and the given indices for first and last object.
+ *
+ * @param items the content of the full queue
+ * @param first the index of the first item in the queue
+ * @param last the index of the last item in the queue
+ */
+
+ public QueueNormal(Object[] items, int first, int last) {
+ this.items = items;
+ this.first = first;
+ this.last = last;
+ }
+
+ /**
+ * Alternate constructor that uses preset values for object variables.
+ */
+
+ public QueueNormal() {
+ }
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese. If the queue is full
+ * after the insertion, the state of the context is changed to "full".
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(QueueContext context, Object arg) {
+ items[(last)%items.length] = arg;
+ last = (last+1) % items.length;
+ if (first == last) {
+ context.setState(new QueueFull(items, first));
+ }
+ return true;
+ }
+
+ /**
+ * Returns the first item in the queue.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return the first item in the queue.
+ */
+
+ public Object getFirst(QueueContext context) {
+ return items[first];
+ }
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese. If the removed item was
+ * the last one in the queue, the state of the context is changed to
+ * "empty".
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst(QueueContext context){
+ first = (first + 1) % items.length;
+ if (first == last) {
+ context.setState(new QueueEmpty());
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java
new file mode 100644
index 000000000..7be872fc1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java
@@ -0,0 +1,70 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.state.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>State</i>s within this queue example. The
+ * operations provided are <code>insert(..)</code>, <code>getFirst(..)</code>,
+ * and <code>removeFirst(..)</code>.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface QueueState {
+
+ /**
+ * Tries to insert an object into the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @param arg the object to be inserted into the queue
+ * @return true if insertion was successful, false otherwise.
+ */
+
+ public boolean insert(QueueContext context, Object arg);
+
+ /**
+ * Returns the first item in the queue
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return the first item in the queue
+ */
+
+ public Object getFirst(QueueContext context);
+
+ /**
+ * Tries to remove an object from the queue. Returns true if successful,
+ * false otherwiese.
+ *
+ * @param context the <i>Context</i> for this design pattern (for update
+ * on demand)
+ * @return true if deletion was successful, false otherwise.
+ */
+
+ public boolean removeFirst(QueueContext context);
+
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java
new file mode 100644
index 000000000..be404119f
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java
@@ -0,0 +1,67 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the bubblesort sorting strategy for int arrays.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class BubbleSort {
+
+ /**
+ * Helper method that exchanges two values in an int array
+ *
+ * @param numbers the int array
+ * @param pos1 the position of the first element
+ * @param pos2 the position of the second element
+ */
+
+ private void exchange(int[] numbers, int pos1, int pos2) {
+ int tmp = numbers[pos1];
+ numbers[pos1] = numbers[pos2];
+ numbers[pos2] = tmp;
+ }
+
+ /**
+ * Sorts an int array using basic bubblesort
+ *
+ * @param numbers the int array to sort
+ */
+
+ public void sort(int[] numbers) {
+ System.out.print("Sorting by BubbleSort...");
+ for (int end = numbers.length; end > 1; end --) {
+ for (int current = 0; current < end - 1; current ++) {
+ if (numbers[current] > numbers[current+1]) {
+ exchange(numbers, current, current+1);
+ }
+ }
+ }
+ System.out.println("done.");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java
new file mode 100644
index 000000000..fa7d5f4d6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the linear sort sorting strategy for int arrays.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class LinearSort {
+
+ /**
+ * Helper method that exchanges two values in an int array
+ *
+ * @param numbers the int array
+ * @param pos1 the position of the first element
+ * @param pos2 the position of the second element
+ */
+
+ private void exchange(int[] numbers, int pos1, int pos2) {
+ int tmp = numbers[pos1];
+ numbers[pos1] = numbers[pos2];
+ numbers[pos2] = tmp;
+ }
+
+
+ /**
+ * Sorts an int array
+ *
+ * @param numbers the int array to sort
+ */
+
+ public void sort(int[] numbers) {
+ System.out.print("Sorting by LinearSort...");
+ int lowest = 0;
+
+ for (int start = 0; start < numbers.length; start ++) {
+ lowest = start;
+
+ for (int current = start; current < numbers.length; current ++) {
+ if (numbers[current] < numbers[lowest]) {
+ lowest = current;
+ }
+ }
+ exchange(numbers, start, lowest);
+ }
+ System.out.println("done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java
new file mode 100644
index 000000000..c219af7fe
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java
@@ -0,0 +1,96 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the strategy design pattern example.<p>
+ *
+ * Intent: <i>Define a family of algorithms, encapsulate each one, and make
+ * them interchangeable. Strategy lets the algorithm vary independently from
+ * clients that use it.</i><p>
+ *
+ * Participating objects are <code>LinearSort</code> and <i>BubbleSort</i>
+ * as <i>Strategies</i>, and <code>Sorter</code> as <i>Context</i>.
+ *
+ * In this example, an array of 10 numbers is to be sorted. Depending on the
+ * number of arguments of the call to <code>Main</code>, linear sort or
+ * bubblesort are used as sorting algorithms. The interface for the strategies
+ * is defined in <code>SortingStrategy</code>.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see LinearSort
+ * @see BubbleSort
+ */
+
+public class Main {
+
+ /**
+ * Returns the content of the int array in a string
+ *
+ * @param numbers the int array to display
+ * @returns a string with all the ints from the array
+ */
+
+ private static String show(int[] numbers) {
+ String out = "";
+ for (int i=0; i<numbers.length; i++) {
+ out += (numbers[i] + " ");
+ }
+ return out;
+ }
+
+ /**
+ * Implements the driver for the strategy example. If called with more
+ * than zero arguments, bubblesort is used to sort the array of ten
+ * numbers; otherwise linear sort.
+ */
+
+ public static void main(String[] args) {
+ int[] numbers = {3, 2, 9, 8, 1, 5, 6, 4, 7, 0};
+
+ LinearSort sort1 = new LinearSort();
+ BubbleSort sort2 = new BubbleSort();
+
+ Sorter sorter = new Sorter();
+
+
+ if (args.length == 0) {
+ SortingStrategy.aspectOf().setConcreteStrategy(sorter, sort1);
+ }
+ else {
+ SortingStrategy.aspectOf().setConcreteStrategy(sorter, sort2);
+ }
+
+ System.out.println("\nPreparing sort...");
+ System.out.println("original: "+show(numbers));
+ numbers = sorter.sort(numbers);
+ System.out.println("sorted: "+show(numbers));
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java
new file mode 100644
index 000000000..0827addb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java
@@ -0,0 +1,39 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This class represents the <i>Context</i> of the pattern. Note that
+ * it does not have to have pattern-related code in it.
+ *
+ * It will sort an int array with a provided sorting strategy. The
+ * implementation of the <code>sort(int[])</code> method is provided
+ * by the aspect. The aspect also chooses the proper strategy to
+ * perform the sorting.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Sorter {} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java
new file mode 100644
index 000000000..9657f08f6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java
@@ -0,0 +1,106 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.StrategyProtocol;
+
+/**
+ * This aspect defines the mechanics for executing the <i>Strategy</i>'s
+ * algorithm. In this case, an around advice is utilized to execute the
+ * proper code.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see LinearSort
+ * @see BubbleSort
+ */
+
+
+public aspect SortingStrategy extends StrategyProtocol {
+
+
+ /**
+ * Assignes the <i>Context</i> role to <code>Sorter</code>
+ */
+
+ declare parents: Sorter implements Context;
+
+ /**
+ * Assignes the <i>Strategy</i> role to <code>LinearSort</code>
+ */
+
+ declare parents: LinearSort implements Strategy;
+
+ /**
+ * Assignes the <i>Strategy</i> role to <code>BubbleSort</code>
+ */
+
+ declare parents: BubbleSort implements Strategy;
+
+
+ /**
+ * Sorts the array. This is merely a method stub. The actual
+ * implementation can either be realized here or in an
+ * <code>around</code> advice as illustrated below.
+ *
+ * This method acts as <i>ContextInterface()</code>.
+ *
+ * @param numbers
+ * @return
+ */
+
+ public int[] Sorter.sort(int[] numbers) {
+ return numbers;
+ }
+
+
+
+ /**
+ * Invokes the appropriate strategy's sort() method when the
+ * Sorter needs to sort. Using around advice is only one way
+ * of realizing this (see above).
+ *
+ * The around advice solution is more useful if the <i>Context</i>
+ * itself defines the <i>ContextInterface()</i> (not the case here).
+ *
+ * This particular implementation was chosen to illustrate the
+ * alternatives.
+ */
+
+ int[] around(Sorter s, int[] numbers):
+ call(int[] Sorter.sort(int[])) && target(s) && args(numbers) {
+
+ Strategy strategy = getConcreteStrategy(s);
+
+ if (strategy instanceof BubbleSort) {
+ ((BubbleSort)strategy).sort(numbers);
+ } else if (strategy instanceof LinearSort) {
+ ((LinearSort) strategy).sort(numbers);
+ } else {
+ // Invalid strategy: could throw an exception here
+ }
+ return numbers;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java
new file mode 100644
index 000000000..3009d9fd0
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the bubblesort sorting strategy for int arrays.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ */
+
+public class BubbleSort implements SortingStrategy {
+
+ /**
+ * Helper method that exchanges two values in an int array
+ *
+ * @param numbers the int array
+ * @param pos1 the position of the first element
+ * @param pos2 the position of the second element
+ */
+
+ private void exchange(int[] numbers, int pos1, int pos2) {
+ int tmp = numbers[pos1];
+ numbers[pos1] = numbers[pos2];
+ numbers[pos2] = tmp;
+ }
+
+ /**
+ * Sorts an int array using basic bubble sort
+ *
+ * @param numbers the int array to sort
+ */
+
+ public void sort(int[] numbers) {
+ System.out.print("Sorting by BubbleSort...");
+ for (int end = numbers.length; end > 1; end --) {
+ for (int current = 0; current < end - 1; current ++) {
+ if (numbers[current] > numbers[current+1]) {
+ exchange(numbers, current, current+1);
+ }
+ }
+ }
+ System.out.println("done.");
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java
new file mode 100644
index 000000000..0fa44cae1
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java
@@ -0,0 +1,72 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the linear sort sorting strategy for int arrays.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class LinearSort implements SortingStrategy{
+
+ /**
+ * Helper method that exchanges two values in an int array
+ *
+ * @param numbers the int array
+ * @param pos1 the position of the first element
+ * @param pos2 the position of the second element
+ */
+
+ private void exchange(int[] numbers, int pos1, int pos2) {
+ int tmp = numbers[pos1];
+ numbers[pos1] = numbers[pos2];
+ numbers[pos2] = tmp;
+ }
+
+
+ /**
+ * Sorts an int array
+ *
+ * @param numbers the int array to sort
+ */
+
+ public void sort(int[] numbers) {
+ System.out.print("Sorting by LinearSort...");
+ int lowest = 0;
+
+ for (int start = 0; start < numbers.length; start ++) {
+ lowest = start;
+
+ for (int current = start; current < numbers.length; current ++) {
+ if (numbers[current] < numbers[lowest]) {
+ lowest = current;
+ }
+ }
+ exchange(numbers, start, lowest);
+ }
+ System.out.println("done.");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java
new file mode 100644
index 000000000..10df445f6
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java
@@ -0,0 +1,75 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Strategy design pattern example.<p>
+ *
+ * Intent: <i>Define a family of algorithms, encapsulate each one, and make
+ * them interchangeable. Strategy lets the algorithm vary independently from
+ * clients that use it.</i><p>
+ *
+ * Participating objects are <code>LinearSort</code> and <code>BubbleSort
+ * </code> as <i>Strategies</i>, and <code>Sorter</code> as <i>Context</i>.
+ *
+ * In this example, an array of 10 numbers is to be sorted. Depending on the
+ * number of arguments of the call to <code>Main.main(..)</code>, linear sort
+ * or bubblesort are used as sorting algorithms. The interface for the
+ * <i>strategies</i> is defined in <code>SortingStrategy</code>.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see LinearSort
+ * @see BubbleSort
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the strategy example. If called with more
+ * than zero arguments, bubblesort is used to sort the array of ten
+ * numbers; otherwise linear sort is used.
+ */
+
+ public static void main(String[] args) {
+ int[] numbers = {3, 2, 9, 8, 1, 5, 6, 4, 7, 0};
+
+ SortingStrategy sort1 = new LinearSort();
+ SortingStrategy sort2 = new BubbleSort();
+
+ Sorter sorter;
+
+ if (args.length == 0) {
+ sorter = new Sorter(sort1, numbers);
+ }
+ else {
+ sorter = new Sorter(sort2, numbers);
+ }
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java
new file mode 100644
index 000000000..4a53ffc39
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java
@@ -0,0 +1,69 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Sorts an int array with a provided sorting strategy.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see LinearSort
+ * @see BubbleSort
+ */
+
+public class Sorter {
+
+ /**
+ * Shows the original (unsorted) array, sorts it and shows the new
+ * (sorted) array.
+ *
+ * @param sort the sorting strategy
+ * @param numbers the array of int to sort
+ */
+
+ public Sorter(SortingStrategy sort, int[] numbers) {
+ System.out.println("\nPreparing sort...");
+ System.out.println("original: "+show(numbers));
+ sort.sort(numbers);
+ System.out.println("sorted: "+show(numbers));
+ System.out.println("Done sorting.");
+ }
+
+ /**
+ * Returns the content of the int array in a string
+ *
+ * @param numbers the int array to display
+ * @returns a string with all the ints from the array
+ */
+
+ private static String show(int[] numbers) {
+ String out = "";
+ for (int i=0; i<numbers.length; i++)
+ {
+ out += (numbers[i] + " ");
+ }
+ return out;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java
new file mode 100644
index 000000000..e5d647549
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java
@@ -0,0 +1,36 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the interface for sorting strategies
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+
+public interface SortingStrategy {
+ public void sort(int[] numbers);
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java
new file mode 100644
index 000000000..bededc15a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java
@@ -0,0 +1,69 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for creators. In this example, it acts as the <i>
+ * AbstractClass</i>. T
+ *
+ * Note that the template method <code>generate(String)</code>
+ * (which uses all other methods defined in this abstract class) is
+ * implemented by the aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface DecoratedStringGenerator {
+
+ /**
+ * Prepares a string for decoration.
+ *
+ * @param s the string to filter
+ * @return the prepared string
+ */
+
+ public String prepare (String s);
+
+ /**
+ * Filters a string.
+ *
+ * @param s the string to filter
+ * @return the filtered string
+ */
+
+ public String filter (String s);
+
+ /**
+ * Finalizes a string. This is the last step in the template method.
+ *
+ * @param s the string to finalize
+ * @returns the finalized string
+ */
+
+ public String finalize (String s);
+}
+
+
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java
new file mode 100644
index 000000000..2903a7191
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteClass</i> that decorates strings by turnung all
+ * characters into lowercase and then capitalizing the consonants. It also
+ * adds an explanation at the end.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class FancyGenerator implements DecoratedStringGenerator {
+
+ /**
+ * Prepares a string for decoration. Turns the string into lowercase.
+ *
+ * @param s the string to filter
+ * @return the prepared string
+ */
+
+ public String prepare (String s) {
+ return s.toLowerCase();
+ }
+
+ /**
+ * Filters a string. Capitalizes all consonants.
+ *
+ * @param s the string to filter
+ * @return the filtered string
+ */
+
+ public String filter (String s) {
+ s = s.replace('a', 'A');
+ s = s.replace('e', 'E');
+ s = s.replace('i', 'I');
+ s = s.replace('o', 'O');
+ s = s.replace('u', 'U');
+ return s;
+ }
+
+ /**
+ * Finalizes a string by adding an explanation to it.
+ *
+ * @param s the string to finalize
+ * @return the finalized string
+ */
+
+ public String finalize (String s) {
+ return (s+".\n(all consonants identified)");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java
new file mode 100644
index 000000000..aa7d6be80
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java
@@ -0,0 +1,51 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an instance of the Template Method design pattern.
+ * Attaches the template method and its implementation to the
+ * <i>AbstractClass</i>, thereby allowing it to be an interface.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public aspect Generating {
+
+ /**
+ * Defines the implementation of the <i>TemplateMethod()</i>.
+ * Generates a string with certain decorations.
+ *
+ * @param s the string to be used to generate a decorated string from
+ */
+
+ public String DecoratedStringGenerator.generate(String s) {
+ s = prepare(s);
+ s = filter(s);
+ s = finalize(s);
+ return s;
+ }
+}
+ \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java
new file mode 100644
index 000000000..fa4d447f2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java
@@ -0,0 +1,75 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Template Method design pattern example.<p>
+ *
+ * Intent: <i>Define the skeleton of an algorithm in an operation, deferring
+ * some steps to subclasses. Template Method lets subclasses redefine certain
+ * steps of an algorithm without changing the algorithm's structure</i><p>
+ *
+ * Participating objects are <code>SimpleGenerator</code> and
+ * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The
+ * <i>AbstractClass</i> is <code>DecoratedStringGenerator</code>.
+ * <p>
+ *
+ * In this example, the template method <code>generate(String)</code>
+ * modifies a string in three steps and returns the result. While the
+ * SimpleGenerator does not change the string much, the
+ * FancyGenerator turns the string to lowercase, then capitalizes all
+ * consonants and adds an explanantion to it.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Note that <i>AbstractClass</i> is an interface. The implementation of the
+ * template method is provided by the aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Template Method design
+ * pattern example.<p>
+ *
+ * @param args the command line parameters, unused
+ */
+
+ public static void main(String[] args) {
+ String original = "This Is The Original String To Be Processed";
+
+ DecoratedStringGenerator c1 = new SimpleGenerator();
+ DecoratedStringGenerator c2 = new FancyGenerator();
+
+ System.out.println("<Original>");
+ System.out.println(original);
+ System.out.println("<SimpleGenerator>");
+ System.out.println(c1.generate(original));
+ System.out.println("<FancyGenerator>");
+ System.out.println(c2.generate(original));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java
new file mode 100644
index 000000000..c63a93ad9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteClass</i> that decorates strings by adding a
+ * period at the end of them.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class SimpleGenerator implements DecoratedStringGenerator {
+
+ /**
+ * Prepares a string for decoration. Does nothing.
+ *
+ * @param s the string to filter
+ * @return the passed string
+ */
+
+ public String prepare (String s) {
+ return s;
+ }
+
+ /**
+ * Filters a string. Does nothing.
+ *
+ * @param s the string to filter
+ * @return the passed string
+ */
+
+ public String filter (String s) {
+ return s;
+ }
+
+ /**
+ * Finalizes a string by adding a period to it.
+ *
+ * @param s the string to finalize
+ * @return the finalized string
+ */
+
+ public String finalize (String s) {
+ return s+".";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java
new file mode 100644
index 000000000..55a520687
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for generating decorated strings.
+ * In this example, it acts as the <i>AbstractClass</i>.
+ *
+ * The template method is <code>generate(String)</code>,
+ * which uses all other methods defined in this abstract class.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public abstract class DecoratedStringGenerator {
+
+ /**
+ * Decorates a string. This is the <i>TemplateMethod()</i>.
+ *
+ * @param s the string to decorate
+ * @return the decorated string
+ */
+
+ public String generate(String s) {
+ s = prepare(s);
+ s = filter(s);
+ s = finalize(s);
+ return s;
+ }
+
+ /**
+ * Prepares a string for decoration.
+ *
+ * @param s the string to filter
+ * @return the prepared string
+ */
+
+ public abstract String prepare (String s);
+
+ /**
+ * Filters a string.
+ *
+ * @param s the string to filter
+ * @return the filtered string
+ */
+
+ public abstract String filter (String s);
+
+ /**
+ * Finalizes a string. This is the last step in the template method.
+ *
+ * @param s the string to finalize
+ * @return the finalized string
+ */
+
+ public abstract String finalize (String s);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java
new file mode 100644
index 000000000..d55129bee
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteClass</i> that decorates strings by turnung all
+ * characters into lowercase and then capitalizing the consonants. It also
+ * adds an explanation at the end.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class FancyGenerator extends DecoratedStringGenerator {
+
+ /**
+ * Prepares a string for decoration. Turns the string into lowercase.
+ *
+ * @param s the string to filter
+ * @return the prepared string
+ */
+
+ public String prepare (String s) {
+ return s.toLowerCase();
+ }
+
+ /**
+ * Filters a string. Capitalizes all consonants.
+ *
+ * @param s the string to filter
+ * @return the filtered string
+ */
+
+ public String filter (String s) {
+ s = s.replace('a', 'A');
+ s = s.replace('e', 'E');
+ s = s.replace('i', 'I');
+ s = s.replace('o', 'O');
+ s = s.replace('u', 'U');
+ return s;
+ }
+
+ /**
+ * Finalizes a string by adding an explanation to it.
+ *
+ * @param s the string to finalize
+ * @return the finalized string
+ */
+
+ public String finalize (String s) {
+ return (s+".\n(all consonants capitalized)");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java
new file mode 100644
index 000000000..a9245b69b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java
@@ -0,0 +1,76 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Template Method design pattern example.<p>
+ *
+ * Intent: <i>Define the skeleton of an algorithm in an operation, deferring
+ * some steps to subclasses. Template Method lets subclasses redefine certain
+ * steps of an algorithm without changing the algorithm's structure</i><p>
+ *
+ * Participating objects are <code>SimpleGenerator</code> and
+ * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The
+ * <i>AbstractClass</i> is <code>DecoratedStringGenerator</code>.
+ * <p>
+ *
+ * In this example, the template method <code>generate(String)</code>
+ * modifies a string in three steps and returns the result. While the
+ * SimpleGenerator does not change the string much, the
+ * FancyGenerator turns the string to lowercase, then capitalizes all
+ * consonants and adds an explanantion to it.
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Note that <i>AbstractClass</i> does in fact have to be an abstract
+ * class (as opposed to an interface), to make it possible to define
+ * a default implementation for the template method.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Template Method design
+ * pattern example.<p>
+ *
+ * @param args the command line parameters, unused
+ */
+
+ public static void main(String[] args) {
+ String original = "This Is The Original String To Be Processed";
+
+ DecoratedStringGenerator c1 = new SimpleGenerator();
+ DecoratedStringGenerator c2 = new FancyGenerator();
+
+ System.out.println("<Original>");
+ System.out.println(original);
+ System.out.println("<SimpleGenerator>");
+ System.out.println(c1.generate(original));
+ System.out.println("<FancyGenerator>");
+ System.out.println(c2.generate(original));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java
new file mode 100644
index 000000000..425dcc9cd
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java
@@ -0,0 +1,68 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteClass</i> that decorates strings by adding a
+ * period at the end of them.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class SimpleGenerator extends DecoratedStringGenerator {
+
+ /**
+ * Prepares a string for decoration. Does nothing.
+ *
+ * @param s the string to filter
+ * @return the passed string
+ */
+
+ public String prepare (String s) {
+ return s;
+ }
+
+ /**
+ * Filters a string. Does nothing.
+ *
+ * @param s the string to filter
+ * @return the passed string
+ */
+
+ public String filter (String s) {
+ return s;
+ }
+
+ /**
+ * Finalizes a string by adding a period to it.
+ *
+ * @param s the string to finalize
+ * @return the finalized string
+ */
+
+ public String finalize (String s) {
+ return s+".";
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java
new file mode 100644
index 000000000..24dad0e39
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java
@@ -0,0 +1,61 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a
+ * terminal binary tree element (leaf).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class BinaryTreeLeaf implements Visitable {
+
+ /**
+ * the value stored in this leaf
+ */
+
+ protected int value;
+
+ /**
+ * Creates a new Leaf with the given value.
+ *
+ * @param value the value of the leaf
+ */
+
+ public BinaryTreeLeaf(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Accessor for the leaf's value
+ *
+ * @return the leaf's value
+ */
+
+ public int getValue() {
+ return value;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java
new file mode 100644
index 000000000..84b87122c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java
@@ -0,0 +1,79 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a
+ * non-terminal binary tree element.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class BinaryTreeNode implements Visitable {
+
+ /**
+ * the left subtree
+ */
+
+ protected Visitable left;
+
+ /**
+ * the right subtree
+ */
+
+ protected Visitable right;
+
+ /**
+ * Accessor for the left subtree.
+ *
+ * @return the left subtree.
+ */
+
+ public Visitable getLeft() {
+ return left;
+ }
+
+ /**
+ * Accessor for the right subtree.
+ *
+ * @return the right subtree.
+ */
+
+ public Visitable getRight() {
+ return right;
+ }
+
+ /**
+ * Creates a non-terminal node of a binary tree.
+ *
+ * @param l the new left subtree.
+ * @param l the new left subtree.
+ */
+
+ public BinaryTreeNode(Visitable left, Visitable right) {
+ this.left = left;
+ this.right = right;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java
new file mode 100644
index 000000000..938f50f03
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java
@@ -0,0 +1,103 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Visitor design pattern example.<p>
+ *
+ * Intent: <i>Represents an operation to be performed on the elements of an
+ * object structure. Visitor lets you define a new operation without changing
+ * the classes of the elements on which it operates</i><p>
+ *
+ * Participating classes are <code>SummationVisitor</code> and
+ * <code>TraversalVisitor</code> as <i>ConcreteVisitor</i>s, implementing the
+ * <code>VisitorProtocol.Visitor</code> interface. <BR>
+ *
+ * <code>BinaryTreeNode</code> and <code>BinaryTreeLeaf</code> are
+ * <i>ConcreteElement</i>s, implementing the <code>Visitable</code> interface.
+ * <p>
+ *
+ * In this example, a binary tree that has int values as leafs is built.
+ * SummationVisitor is a <i>Visitor</i> that collects the sum of
+ * elements in the leafs (should be 6).
+ *
+ * TraversalVisitor is a <i>Visitor</i> that
+ * collects a description of the tree like {{1,2},3}
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Note that <UL>
+ * <LI> Every visitor (even the inteface) has to know of each possible element
+ * type in the object structure.
+ * <LI> Nodes need not to know of the visitor interface;
+ * </UL>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Visitor design pattern example.<p>
+ *
+ * @param args the command-line parameters, unused
+ */
+
+
+ public static void main(String[] args) {
+
+ System.out.println("Building the tree (1): leaves");
+
+ BinaryTreeLeaf one = new BinaryTreeLeaf(1);
+ BinaryTreeLeaf two = new BinaryTreeLeaf(2);
+ BinaryTreeLeaf three = new BinaryTreeLeaf(3);
+
+ System.out.println("Building the tree (1): regular nodes");
+
+ BinaryTreeNode regN = new BinaryTreeNode(one, two);
+ BinaryTreeNode root = new BinaryTreeNode(regN, three);
+
+ System.out.println("The tree now looks like this: ");
+ System.out.println(" regN ");
+ System.out.println(" / \\ ");
+ System.out.println(" regN 3 ");
+ System.out.println(" / \\ ");
+ System.out.println(" 1 2 ");
+
+ System.out.println("Visitor 1: SumVisitor, collects the sum of leaf");
+ System.out.println("values. Result should be 6.");
+
+ SummationVisitor sumVisitor = new SummationVisitor();
+ root.accept(sumVisitor);
+ System.out.println(sumVisitor.report());
+
+ System.out.println("Visitor 2: TraversalVisitor, collects a tree");
+ System.out.println("representation. Result should be {{1,2},3}.");
+
+ TraversalVisitor traversalVisitor = new TraversalVisitor();
+ root.accept(traversalVisitor);
+ System.out.println(traversalVisitor.report());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java
new file mode 100644
index 000000000..928cbd90a
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java
@@ -0,0 +1,80 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol;
+
+/**
+ * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf
+ * values in the tree.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class SummationVisitor implements VisitorProtocol.Visitor {
+
+ /**
+ * the colleced sum of leaf values
+ */
+
+ protected int sum = 0;
+
+ /**
+ * Visits a non-terminal binary tree node.
+ *
+ * @param node the regular node
+ */
+
+ public void visitNode(VisitorProtocol.VisitableNode node) {
+ if (node instanceof BinaryTreeNode) {
+ BinaryTreeNode rnode = (BinaryTreeNode) node;
+ rnode.left.accept(this);
+ rnode.right.accept(this);
+ }
+ }
+
+ /**
+ * Visits a terminal tree node.
+ *
+ * @param node the leaf
+ */
+
+ public void visitLeaf(VisitorProtocol.VisitableNode node) {
+ if (node instanceof BinaryTreeLeaf) {
+ BinaryTreeLeaf leaf = (BinaryTreeLeaf) node;
+ sum += leaf.getValue();
+ }
+ }
+
+ /**
+ * Returns the result of the visitor's operation
+ *
+ * @return a string representing the sum of elemnent in the tree's leaves
+ */
+
+ public String report() {
+ return ">>> SumVisitor collected a sum of "+sum;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java
new file mode 100644
index 000000000..2143cad72
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol;
+
+/**
+ * Implements a <i>ConcreteVisitor</i> that collects string representation
+ * of the tree.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class TraversalVisitor implements VisitorProtocol.Visitor {
+
+ /**
+ * contains the accumulated result
+ */
+
+ protected String result = "";
+
+ /**
+ * Visits a a non-terminal binary tree node.
+ *
+ * @param node the regular node
+ */
+
+ public void visitNode(VisitorProtocol.VisitableNode node) {
+ if (node instanceof BinaryTreeNode) {
+ BinaryTreeNode rnode = (BinaryTreeNode) node;
+ result += "{";
+ rnode.left.accept(this);
+ result += ",";
+ rnode.right.accept(this);
+ result += "}";
+ }
+ }
+
+ /**
+ * Visits a terminal tree node.
+ *
+ * @param node the leaf
+ */
+
+ public void visitLeaf(VisitorProtocol.VisitableNode node) {
+ if (node instanceof BinaryTreeLeaf) {
+ BinaryTreeLeaf leaf = (BinaryTreeLeaf) node;
+ result += leaf.value;
+ }
+ }
+
+ /**
+ * Returns the result of the visitor's operation
+ *
+ * @return a string representing a traversal of the tree
+ */
+
+ public String report() {
+ return ">>> TraversalVisitor traversed the tree to: "+result;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java
new file mode 100644
index 000000000..cbf4e52b2
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java
@@ -0,0 +1,34 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for nodes. For this example, the interface is empty.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface Visitable {}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java
new file mode 100644
index 000000000..17bae11fd
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java
@@ -0,0 +1,55 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol;
+
+/**
+ * Implements a concrete visitor pattern instance. This aspect assigns
+ * the roles to the participants.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public aspect Visiting extends VisitorProtocol {
+
+ /**
+ * Assigns the <code>VisitableNote</code> role to <code>Visitable</code>
+ */
+
+ declare parents: Visitable implements VisitableNode;
+
+ /**
+ * Assigns the <code>Node</code> role to <code>BinaryTreeNode</code>
+ */
+
+ declare parents: BinaryTreeNode implements Node;
+
+ /**
+ * Assigns the <code>Leaf</code> role to <code>BinaryTreeLeaf</code>
+ */
+
+ declare parents: BinaryTreeLeaf implements Leaf;
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/build.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/build.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/build.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/visitor.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/visitor.lst
new file mode 100644
index 000000000..a4a021898
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/visitor.lst
@@ -0,0 +1,2 @@
+*.java
+../../../patternLibrary/VisitorProtocol.java
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java
new file mode 100644
index 000000000..38102d325
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java
@@ -0,0 +1,71 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a
+ * terminal binary tree element (leaf).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class BinaryTreeLeaf implements Visitable {
+
+ /**
+ * the value stored in this leaf
+ */
+
+ protected int value;
+
+ /**
+ * Accepts a visitor and calls <code>visitLeaf(Node) on it.
+ *
+ * @param visitor the NodeVisitor that is to be accepted.
+ */
+
+ public void accept(BinaryTreeVisitor visitor) {
+ visitor.visitLeaf(this);
+ }
+
+ /**
+ * Creates a new <code>BinaryTreeLeaf</code> with the given value.
+ *
+ * @param value the value of the leaf
+ */
+
+ public BinaryTreeLeaf(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Accessor for the leaf's value
+ *
+ * @return the leaf's value
+ */
+
+ public int getValue() {
+ return value;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java
new file mode 100644
index 000000000..604749717
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java
@@ -0,0 +1,89 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a
+ * non-terminal binary tree element.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class BinaryTreeNode implements Visitable {
+
+ /**
+ * the left subtree
+ */
+
+ protected Visitable left;
+
+ /**
+ * the right subtree
+ */
+
+ protected Visitable right;
+
+ /**
+ * Accepts a visitor and calls <code>visitRegularNode(Node) on it.
+ *
+ * @param visitor the NodeVisitor that is to be accepted.
+ */
+
+ public void accept(BinaryTreeVisitor visitor) {
+ visitor.visitNode(this);
+ }
+
+ /**
+ * Accessor for the left subtree.
+ *
+ * @return the left subtree.
+ */
+
+ public Visitable getLeft() {
+ return left;
+ }
+
+ /**
+ * Accessor for the right subtree.
+ *
+ * @return the right subtree.
+ */
+
+ public Visitable getRight() {
+ return right;
+ }
+
+ /**
+ * Creates a non-terminal node of a binary tree.
+ *
+ * @param left the new left subtree.
+ * @param right the new left subtree.
+ */
+
+ public BinaryTreeNode(Visitable left, Visitable right) {
+ this.left = left;
+ this.right = right;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java
new file mode 100644
index 000000000..5ed0d22da
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java
@@ -0,0 +1,59 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for <i>Visitor</i>s that operate on binary trees
+ * consisting of leaves and nodes.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface BinaryTreeVisitor {
+
+ /**
+ * Visits a non-terminal binary tree node.
+ *
+ * @param node the node to visit
+ */
+
+ public void visitNode(Visitable node);
+
+ /**
+ * Visits a leaf, which is a terminal tree node.
+ *
+ * @param node the leaf
+ */
+
+ public void visitLeaf(Visitable node);
+
+ /**
+ * Returns the result of the visitor's operation
+ *
+ * @return a string describing the result of this visitor's operation.
+ */
+
+ public String report();
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java
new file mode 100644
index 000000000..0f336e61e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java
@@ -0,0 +1,104 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the driver for the Visitor design pattern example.<p>
+ *
+ * Intent: <i>Represents an operation to be performed on the elements of an
+ * object structure. Visitor lets you define a new operation without changing
+ * the classes of the elements on which it operates</i><p>
+ *
+ * Participating classes are <code>SummationVisitor</code> and
+ * <code>TraversalVisitor</code> as <i>ConcreteVisitor</i>s, implementing the
+ * <code>BinaryTreeVisitor</code> interface. <BR>
+ *
+ * <code>BinaryTreeNode</code> and <code>BinaryTreeLeaf</code> are
+ * <i>ConcreteElement</i>s, implementing the <code>Visitable</code> interface.
+ * <p>
+ *
+ * In this example, a binary tree is built that has
+ * int values as leafs. <code>SummationVisitor</code> is a <i>Visitor</i>
+ * that collects the sum of the leaf values (should be 6).
+ *
+ * TraversalVisitor is a visitor that
+ * collects a description of the tree like {{1,2},3}
+ *
+ * <p><i>This is the Java version.</i><p>
+ *
+ * Note that <UL>
+ * <LI> Every visitor (even the interface) has to know of each possible element
+ * type in the object structure.
+ * <LI> Nodes need to know of the visitor interface; they have to implement the
+ * accept(NodeVisitor) method.
+ * </UL>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class Main {
+
+ /**
+ * Implements the driver for the Visitor design pattern example.<p>
+ *
+ * @param args the command-line parameters, unused
+ */
+
+
+ public static void main(String[] args) {
+
+ System.out.println("Building the tree (1): leaves");
+
+ BinaryTreeLeaf one = new BinaryTreeLeaf(1);
+ BinaryTreeLeaf two = new BinaryTreeLeaf(2);
+ BinaryTreeLeaf three = new BinaryTreeLeaf(3);
+
+ System.out.println("Building the tree (1): regular nodes");
+
+ BinaryTreeNode regN = new BinaryTreeNode(one, two);
+ BinaryTreeNode root = new BinaryTreeNode(regN, three);
+
+ System.out.println("The tree now looks like this: ");
+ System.out.println(" regN ");
+ System.out.println(" / \\ ");
+ System.out.println(" regN 3 ");
+ System.out.println(" / \\ ");
+ System.out.println(" 1 2 ");
+
+ System.out.println("Visitor 1: SumVisitor, collects the sum of leaf");
+ System.out.println("values. Result should be 6.");
+
+ SummationVisitor sumVisitor = new SummationVisitor();
+ root.accept(sumVisitor);
+ System.out.println(sumVisitor.report());
+
+ System.out.println("Visitor 2: TraversalVisitor, collects a tree");
+ System.out.println("representation. Result should be {{1,2},3}.");
+
+ TraversalVisitor traversalVisitor = new TraversalVisitor();
+ root.accept(traversalVisitor);
+ System.out.println(traversalVisitor.report());
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java
new file mode 100644
index 000000000..326775c1e
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java
@@ -0,0 +1,74 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf
+ * values in the tree.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class SummationVisitor implements BinaryTreeVisitor {
+
+ /**
+ * the colleced sum of leaf values
+ */
+
+ protected int sum = 0;
+
+ /**
+ * Visits a non-terminal binary tree node.
+ *
+ * @param node the regular node
+ */
+
+ public void visitNode(Visitable node) {
+ BinaryTreeNode rnode = (BinaryTreeNode) node;
+ rnode.left.accept(this);
+ rnode.right.accept(this);
+ }
+
+ /**
+ * Visits a terminal tree node.
+ *
+ * @param node the leaf
+ */
+
+ public void visitLeaf(Visitable node) {
+ BinaryTreeLeaf leaf = (BinaryTreeLeaf) node;
+ sum += leaf.getValue();
+ }
+
+ /**
+ * Returns the result of the visitor's operation
+ *
+ * @return a string representation of the sum of leaf values
+ */
+
+ public String report() {
+ return ">>> SummationVisitor collected a sum of: "+sum;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java
new file mode 100644
index 000000000..24dbffb58
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java
@@ -0,0 +1,77 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements a <i>ConcreteVisitor</i> that collects string representation
+ * of the tree.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public class TraversalVisitor implements BinaryTreeVisitor {
+
+ /**
+ * contains the accumulated result
+ */
+
+ protected String result = "";
+
+ /**
+ * Visits a non-terminal binary tree node.
+ *
+ * @param node the regular node
+ */
+
+ public void visitNode(Visitable node) {
+ BinaryTreeNode rnode = (BinaryTreeNode) node;
+ result += "{";
+ rnode.getLeft().accept(this);
+ result += ",";
+ rnode.getRight().accept(this);
+ result += "}";
+ }
+
+ /**
+ * Visits a terminal tree node.
+ *
+ * @param node the leaf
+ */
+
+ public void visitLeaf(Visitable node) {
+ BinaryTreeLeaf leaf = (BinaryTreeLeaf) node;
+ result += leaf.getValue();
+ }
+
+ /**
+ * Returns the result of the visitor's operation
+ *
+ * @return a string representing a traversal of the tree
+ */
+
+ public String report() {
+ return ">>> TraversalVisitor traversed the tree to: "+result;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java
new file mode 100644
index 000000000..4db9b475d
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java
@@ -0,0 +1,43 @@
+package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Defines the interface for nodes that can accept <i>Visitor</i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface Visitable {
+
+ /**
+ * Accepts a <i>Visitor</i>.
+ *
+ * @param visitor the NodeVisitor that is to be accepted.
+ */
+
+ public void accept(BinaryTreeVisitor visitor);
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java
new file mode 100644
index 000000000..752e67fb8
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java
@@ -0,0 +1,47 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an exception that occurs if an a request reaches the
+ * end of a <i>Chain of Responsibility</i> but remains unhandled.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/28/04
+ *
+ * @see ChainOfResponsibilityProtocol
+ */
+
+public class ChainOfResponsibilityException extends RuntimeException {
+
+ /**
+ * Creates a ChainOfResponsibilityException
+ *
+ * @param s the error message
+ */
+
+ public ChainOfResponsibilityException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java
new file mode 100644
index 000000000..f21e0b883
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java
@@ -0,0 +1,176 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.WeakHashMap;
+
+/**
+ * Defines the general behavior of the chain of responsibility design pattern.
+ *
+ * Each concrete sub-aspect of this aspect defines one particular instance of
+ * the pattern, with an arbitrary number of <i>Handler</i> classes involved.
+ *
+ * The sub-aspect defines three things: <ol>
+ *
+ * <li> what types can be <i>Handlers</i>
+ *
+ * <li> what types can be <i>Request</i>s
+ *
+ * <li> what triggers a <i>Request</i>
+ *
+ * <li> how each <i>Handler</i> treats a particular request. The default
+ * implementation in this aspect here makes it only necessary to code
+ * those cases where an event is actually handled.
+ * </ol>
+ *
+ * Note that in this implementation, a default behavior for <i>Handler</i>s is
+ * defined: unless a <i>Handler</i> explicitly handles an event, it is passed
+ * to its successor. In addition to that, the implementation allows to define
+ * a default bahavior in case no <i>Handler</i> in the chain handles an event.
+ * Here, an exception is raised. <p>
+ *
+ * Note further that this version, as all approaches that utilize role
+ * interfaces (empty interfaces identifying the roles in the pattern), has the
+ * following limitations: role interfaces only work on types that the weaver
+ * has access to. Further, without generics support for Java/AspectJ, casting
+ * is required at some points.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 01/27/04
+ *
+ */
+
+public abstract aspect ChainOfResponsibilityProtocol {
+
+ /**
+ * This interface is used by extending aspects to say what types
+ * handle requests. It models the <i>Handler</i> role.
+ */
+
+ protected interface Handler {}
+
+ /**
+ * This interface is used by extending aspects to say what types
+ * represent requests. It models the <i>Request</i> role.
+ */
+
+ protected interface Request {}
+
+ /**
+ * Stores the mapping between <code>Handler</code>s and its<i>
+ * Successor</i>. For each handler, its <i>Successor</i>
+ * is stored.
+ */
+
+ private WeakHashMap successors = new WeakHashMap();
+
+
+ /**
+ * Implements the abstracted CoR behavior. Assumption: If the request is
+ * not handled, the last receiver handles it by default ( that is true
+ * for this implementnation of the protocol).
+ *
+ * The current handler gets asked if it wants to handle the request. If
+ * not, the request is forwarded to its successor
+ */
+
+ protected void receiveRequest(Handler handler, Request request) {
+ if (handler.acceptRequest(request)) {
+ handler.handleRequest(request);
+ } else {
+ Handler successor = getSuccessor(handler);
+ if (successor == null) {
+ throw new ChainOfResponsibilityException("request unhandled (end of chain reached)\n");
+ // This is one way to deal with unhandled requests.
+ } else {
+ receiveRequest(successor, request);
+ }
+ }
+ }
+
+ /**
+ * Method defined for Handlers: returns true if a Handler wants to hanlde
+ * that request. By default, requests are rejected.
+ *
+ * @param request the request to be handled
+ */
+
+ public boolean Handler.acceptRequest(Request request) {
+ return false;
+ }
+
+ /**
+ * Method defined for Handlers: handles a request. Default implementation,
+ * does nothing. It is possible to extend this library implementation to
+ * shows an error message if this method is not overwritten.
+ *
+ * @param request the request to be handled
+ */
+
+ public void Handler.handleRequest(Request request) {}
+
+
+ /**
+ * The join points after which a request is raised.
+ * It replaces the normally scattered calls to <i>notify()</i>. To be
+ * concretized by sub-aspects.
+ */
+
+ protected abstract pointcut eventTrigger(Handler handler, Request request);
+
+
+ /**
+ * Calls receiveRequest() after a request was started.
+ *
+ * @param s the subject on which the change occured
+ */
+
+ after(Handler handler, Request request): eventTrigger(handler, request) {
+ receiveRequest(handler, request);
+ }
+
+
+ /**
+ * Adds a successor to a <i>Handler</i>.
+ *
+ * @param handler the handler to add a new successor to
+ * @param successor the new successor to attach
+ */
+
+ public void setSuccessor(Handler handler, Handler successor) {
+ successors.put(handler, successor);
+ }
+
+
+ /**
+ * Returns the successor of a handler.
+ *
+ * @param handler the handler in question
+ * @return the successor of the handler
+ */
+
+ public Handler getSuccessor(Handler handler) {
+ return ((Handler) successors.get(handler));
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java
new file mode 100644
index 000000000..03867b689
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java
@@ -0,0 +1,52 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This interface is implemented by <i>Command</i> objects.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public interface Command {
+
+ /**
+ * Executes the command.
+ *
+ * @param receiver the object this command is manipulating.
+ */
+
+ public void executeCommand(CommandReceiver receiver);
+
+ /**
+ * Queries the command's executable status. This interface method is
+ * optional (default: all commands are excutable); a default
+ * implementation is provided by the abstract CommandProtocol aspect.
+ *
+ * @returns a boolean indicating whether the command is excutable.
+ */
+
+ public boolean isExecutable();
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java
new file mode 100644
index 000000000..0933fa84c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java
@@ -0,0 +1,38 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This interface is used by extending aspects to say what types
+ * can be Invokers (i.e. senders of an executeCommand() call).
+ * This role is assigned by concrete sub-aspects of the <code>CommandProtocol
+ * </code> pattern aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see CommandProtocol
+ */
+
+public interface CommandInvoker { } \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java
new file mode 100644
index 000000000..11951abba
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java
@@ -0,0 +1,255 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.WeakHashMap;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandInvoker;
+import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandReceiver;
+
+/**
+ * This is the abstract <i>Command</i> protocol.
+ *
+ * Note that this implementation allows only for exactly one command per
+ * invoker. That is usually sufficient, but alternate implementations
+ * could account for multiple commands by using composite
+ * (macro) commands (either with or without defined order).
+ *
+ * To allow for some flexibility, commands can either be explicitly
+ * set or removed by <i>Client</i>s, or this can be done via
+ * pointcuts.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public abstract aspect CommandProtocol {
+
+////////////////////////////////
+// Invoker -> Command mapping //
+////////////////////////////////
+
+ /**
+ * stores the mapping between CommandInvokers and Commands
+ */
+
+ private WeakHashMap mappingInvokerToCommand = new WeakHashMap();
+
+ /**
+ * Sets a new command for an invoker
+ *
+ * @param invoker the object which will invoke the command
+ * @param command the command to be set
+ * @return the former command
+ */
+
+ public Object setCommand(CommandInvoker invoker, Command command) {
+ return mappingInvokerToCommand.put(invoker, command);
+ }
+
+ /**
+ * Removes a command from an invoker
+ *
+ * @param invoker the object which will no longer invoke the command
+ * @param command the command to be removed
+ * @return the former command
+ */
+
+ public Object removeCommand(CommandInvoker invoker) {
+ return setCommand(invoker, null);
+ }
+
+
+ /**
+ * Returns the command for an invoker
+ *
+ * @param invoker the object for which to return the command
+ * @return the current command for the invoker
+ */
+
+ public Command getCommand(CommandInvoker invoker) {
+ return (Command) mappingInvokerToCommand.get(invoker);
+ }
+
+
+/////////////////////////////////
+// Command -> Receiver mapping //
+/////////////////////////////////
+
+ /**
+ * stores the mapping between Coammnds and Receivers
+ */
+
+ private WeakHashMap mappingCommandToReceiver = new WeakHashMap();
+
+ /**
+ * Sets a new receiver for a command
+ *
+ * @param command the command to be set
+ * @param receiver the object to be manipulated by the command's
+ * execute() method
+ * @return the former receiver
+ */
+
+ public Object setReceiver(Command command, CommandReceiver receiver) {
+ return mappingCommandToReceiver.put(command, receiver);
+ }
+
+ /**
+ * Returns the receiver for a particular command
+ *
+ * @param invoker the object for which to return the command
+ * @returns the current command for the invoker
+ */
+
+ public CommandReceiver getReceiver(Command command) {
+ return (CommandReceiver) mappingCommandToReceiver.get(command);
+ }
+
+
+///////////////////////////////////////
+// Command Execution via PC & advice //
+///////////////////////////////////////
+
+
+ /**
+ * The join points after which to execute the command.
+ * This replaces the normally scattered <i>Command.execute()</i> calls.
+ *
+ * @param invoker the object invoking the command
+ */
+
+ protected abstract pointcut commandTrigger(CommandInvoker invoker);
+
+
+ /**
+ * Calls <code>executeCommand()</code> when the command is triggered.
+ *
+ * @param invoker the object invoking the command
+ */
+
+ after(CommandInvoker invoker): commandTrigger(invoker) {
+ Command command = getCommand(invoker);
+ if (command != null) {
+ CommandReceiver receiver = getReceiver(command);
+ command.executeCommand(receiver);
+ } else {
+ // Do nothing: This Invoker has no associated command
+ }
+ }
+
+
+//////////////////////////////////
+// setCommand() via PC & advice //
+//////////////////////////////////
+
+ /**
+ * The join points after which to set a command for an invoker.
+ * This replaces the normally scattered <i>Invoker.add(Command)</i> calls.
+ * The pointcut is provided in addition to the setCommand() method above,
+ * to allow all pattern code to be removed from concrete invokers.
+ *
+ * This PC is non-abstract, to make it optional for sub-aspcects to define
+ * it.
+ *
+ * @param invoker the invoker to attach the command to
+ * @param command the command to be attached to the invoker
+ */
+
+ protected pointcut setCommandTrigger(CommandInvoker invoker, Command command);
+
+
+ /**
+ * Calls <code>addCommand()</code> when a command should be set.
+ *
+ * @param invoker the invoker to attach the command to
+ * @param command the command to be attached to the invoker
+ */
+
+ after (CommandInvoker invoker, Command command):
+ setCommandTrigger(invoker, command) {
+ if (invoker != null) {
+ setCommand(invoker, command);
+ } else {
+ // If the invoker is null, the command cannot be set.
+ // Either ignore this case or throw an exception
+ }
+ }
+
+/////////////////////////////////////
+// removeCommand() via PC & advice //
+/////////////////////////////////////
+
+ /**
+ * The join points after which to remove a command from an invoker.
+ * This replaces the normally scattered <code>Invoker.remove(Command)
+ * </code> calls.
+ *
+ * The pointcut is provided in addition to the <code>removeCommand()
+ * </code> method above, to allow all pattern code to be removed from
+ * concrete invokers.
+ *
+ * This PC is non-abstract, to make it optional for sub-aspcects to define
+ * it.
+ *
+ * @param invoker the invoker to remove the command from
+ */
+
+ protected pointcut removeCommandTrigger(CommandInvoker invoker);
+
+ /**
+ * Calls <code>removeCommand()</code> when a command should be removed.
+ *
+ * @param invoker the invoker to remove the command from
+ */
+
+ after(CommandInvoker invoker): removeCommandTrigger(invoker) {
+ if (invoker != null) {
+ removeCommand(invoker);
+ } else {
+ // If the invoker is null, the command cannot be removed.
+ // Either ignore this case or throw an exception
+ }
+ }
+
+////////////////////////////////////////////
+// Command default method implementations //
+////////////////////////////////////////////
+
+ /**
+ * Provides a deault implementation for the isExecutable method defined
+ * in the Command interface.
+ *
+ * @return true (default implementation). Can be overwritten by concrete
+ * aspects or even concrete commands.
+ */
+
+ public boolean Command.isExecutable() {
+ return true;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java
new file mode 100644
index 000000000..0a7f8e458
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java
@@ -0,0 +1,39 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * This interface is used by extending aspects to say what types
+ * can be Receivers (i.e. manipulated by a command object receiving an
+ * executeCommand() call).
+ * This role is assigned by concrete sub-aspects of the <code>CommandProtocol
+ * </code> pattern aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ *
+ * @see CommandProtocol
+ */
+
+public interface CommandReceiver { } \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java
new file mode 100644
index 000000000..bab9e74dc
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java
@@ -0,0 +1,209 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Enumeration;
+import java.util.WeakHashMap;
+import java.util.Vector;
+
+/**
+ * Defines the abstract Composite design pattern.<p>
+ *
+ * It maintains the mapping between composites and their children, defines the
+ * Component, Composite, and Leaf roles, and implements facilities to
+ * implements methods that work on the whole aggregate structure.
+ *
+ * <p><i>This is the AspectJ version.</i><p>
+ *
+ * Each concrete subaspect does the following things: <UL>
+ * <LI> Defines which classes are Components and Leafs
+ * <LI> (optional) Defines methods that operate on the whole aggregate
+ * structure (using visitors)
+ * </UL>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/06/04
+ */
+
+public abstract aspect CompositeProtocol {
+
+ /**
+ * Defines the Component role. The role is public to allow clients to
+ * handle objects of that type.
+ */
+
+ public interface Component {}
+
+ /**
+ * Defines the Composite role. Composites are Components that can have
+ * children. This role is only used within the pattern context, thus it
+ * is protected.
+ */
+
+ protected interface Composite extends Component {}
+
+ /**
+ * Defines the Leaf role. Leafs are Components that can not have
+ * children. This role is only used within the pattern context, thus it
+ * is protected.
+ */
+
+ protected interface Leaf extends Component {}
+
+ /**
+ * stores the mapping between components and their children
+ */
+
+ private WeakHashMap perComponentChildren = new WeakHashMap();
+
+ /**
+ * Returns a vector of the children of the argument component
+ */
+
+ private Vector getChildren(Component s) {
+ Vector children = (Vector)perComponentChildren.get(s);
+ if ( children == null ) {
+ children = new Vector();
+ perComponentChildren.put(s, children);
+ }
+ return children;
+ }
+
+ /**
+ * Client-accessible method to add a new child to a composite
+ *
+ * @param composite the composite to add a new child to
+ * @param component the new child to add
+ */
+
+ public void addChild(Composite composite, Component component) {
+ getChildren(composite).add(component);
+ }
+
+ /**
+ * Client-accessible method to remove a child from a composite
+ *
+ * @param composite the composite to remove a child from
+ * @param component the child to remove
+ */
+
+ public void removeChild(Composite composite, Component component) {
+ getChildren(composite).remove(component);
+ }
+
+ /**
+ * Client-accessible method to get an Enumeration of all children of
+ * a composite
+ *
+ * @param composite the composite to add a new child to
+ * @param component the new child to add
+ */
+
+ public Enumeration getAllChildren(Component c) {
+ return getChildren(c).elements();
+ }
+
+
+
+ /**
+ * Defines an interface for visitors that operate on the composite
+ * structure. These visitors are implemented by concrete sub-aspects
+ * and used in the <code>recurseOperation(Component, Visitor)</code>
+ * method. This construct is needed to allow for method forwarding:
+ * A composite that receives a method forwards the request to all its
+ * children.
+ */
+
+ protected interface Visitor {
+
+ /**
+ * Generic method that performs an unspecified operation on compoennts
+ *
+ * @param c the component to perform the operation on
+ */
+
+ public void doOperation(Component c);
+ }
+
+ /**
+ * Implements the method-forwarding logic: If a method is to be applied
+ * to the aggregate structure, each composite forwards it to its children
+ *
+ * @param c the current component
+ * @param v the visitor representing the operation to be performed
+ */
+
+ public void recurseOperation(Component c, Visitor v) { // This implements the logic that Composites forward
+ for (Enumeration enum = getAllChildren(c); enum.hasMoreElements(); ) { // method calls to their children
+ Component child = (Component) enum.nextElement();
+ v.doOperation(child);
+ }
+ }
+
+
+
+ /**
+ * Defines an interface for visitors that operate on the composite
+ * structure. These visitors are implemented by comcrete sub-aspects
+ * and used in the <code>recurseOperation(Component, Visitor)<>/code>
+ * method. This construct is needed to allow for method forwarding:
+ * A composite that receives a method forwards the request to all its
+ * children. <p>
+ *
+ * This version allows for a return value of Object type. For some odd
+ * reason AJDT complains if this type is declared protected (as it should
+ * be). Note that Visitor above works fine as protected.
+ */
+
+ public interface FunctionVisitor {
+
+ /**
+ * Generic method that performs an unspecified operation on components
+ *
+ * @param c the component to perform the operation on
+ */
+
+ public Object doFunction(Component c);
+ }
+
+ /**
+ * Implements the method-forwarding logic: If a method is to be applied
+ * to the aggregate structure, each composite forwards it to its children.
+ * This version allows for a return value of Object type, effectively
+ * enableing collecting aggregate results on the composite structure.
+ *
+ * @param c the current component
+ * @param fv the visitor representing the operation to be performed
+ */
+
+ public Enumeration recurseFunction(Component c, FunctionVisitor fv) {
+ Vector results = new Vector();
+ for (Enumeration enum = getAllChildren(c); enum.hasMoreElements(); ) { // method calls to their children
+ Component child = (Component) enum.nextElement();
+ results.add(fv.doFunction(child));
+ }
+ return results.elements();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java
new file mode 100644
index 000000000..9092d9675
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java
@@ -0,0 +1,83 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Implements a the abstracted Flyweight design pattern. Included is the
+ * general creation-on-demand logic. Concrete subaspects are used to
+ * defines the actual <i>FlyweightFactories</i>.
+ *
+ * Concrete subaspects need only to assign the flyweight roles and to
+ * overwrite the <code>createFlyweight(Object)<code> method.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/11/04
+ */
+
+public abstract aspect FlyweightProtocol {
+
+ /**
+ * stores the existing <i>Flyweight</i> by key
+ */
+
+ private Hashtable flyweights = new Hashtable();
+
+ /**
+ * defines the <i>Flyweight</i> role.
+ */
+
+ protected interface Flyweight{};
+
+ /**
+ * Creates a <i>Flyweight</i> for a given key. This method is called by
+ * <code>getFlyweight(Object)</code> if the flyweight does not already
+ * exist.
+ *
+ * @param key the key identifying the particular flyweight
+ * @return the <i>Flyweight</i> representing the key
+ */
+
+ protected abstract Flyweight createFlyweight(Object key);
+
+ /**
+ * Returns the <i>Flyweight</i> for a particular key.
+ * If the appropriate <i>Flyweight</i> does not yet exist, it is created
+ * on demand.
+ *
+ * @param key the key identifying the particular <i>Flyweight</i>
+ * @return the <i>Flyweight</i> representing the key
+ */
+
+ public Flyweight getFlyweight(Object key) {
+ if (flyweights.containsKey(key)) {
+ return (Flyweight) flyweights.get(key);
+ } else {
+ Flyweight flyweight = createFlyweight(key);
+ flyweights.put(key, flyweight);
+ return flyweight;
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java
new file mode 100644
index 000000000..b676ed98b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java
@@ -0,0 +1,143 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.WeakHashMap;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * Defines the general behavior of the Mediator design pattern.
+ *
+ * Each concrete sub-aspect of MediatorProtocol defines one kind of mediation
+ * relationship. Within that kind of relationship, there can be any number
+ * of <i>Colleague</i>s.
+ *
+ * The sub-aspect defines three things: <ol>
+ *
+ * <li> what types can be <i>Colleague</i>s and <i>Mediator</i> <br>
+ * this is done using <code>implements</code>
+ *
+ * <li> what operations on the <i>Colleague</i> trigger <i>Mediator</i>
+ * updates.<br>
+ * This is done by concretizing the <code>change(Colleague)</code>
+ * pointcut
+ *
+ * <li> how to mediate <br>
+ * this is done by concretizing
+ * <code>notifyMediator(Colleague, Mediator)</code>
+ * </ol>
+ *
+ * Note that in this implementation, the work of updating is a method
+ * on the sub-aspect, not a method introduced on the <i>Mediator</i>. This
+ * allows one class of object to be the <i>Mediator</i> in different kinds of
+ * mediation relationships, each of which has a different updating
+ * behavior.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public abstract aspect MediatorProtocol {
+
+
+ /**
+ * Declares the Colleague role.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ protected interface Colleague { }
+
+ /**
+ * Declares the <code>Mediator</code> role.
+ * Roles are modeled as (empty) interfaces.
+ */
+
+ protected interface Mediator { }
+
+ /**
+ * Stores the mapping between <i>Colleagues</i>s and <i>
+ * Mediator</i>s. For each <i>Colleague</i>, its <i>Mediator</i>
+ * is stored.
+ */
+
+ private WeakHashMap mappingColleagueToMediator = new WeakHashMap();
+
+
+ /**
+ * Returns the <i>Mediator</i> of
+ * a particular <i>Colleague</i>. Used internally.
+ *
+ * @param colleague the <i>Colleague</i> for which to return the mediator
+ * @return the <i>Mediator</i> of the <i>Colleague</i> in question
+ */
+
+ private Mediator getMediator(Colleague colleague) {
+ Mediator mediator =
+ (Mediator) mappingColleagueToMediator.get(colleague);
+ return mediator;
+ }
+
+ /**
+ * Sets the <i>Mediator</i> for a <i>Colleague</i>. This is a method
+ * on the pattern aspect, not on any of the participants.
+ *
+ * @param colleague the <i>Colleague</i> to set a new <i>Mediator</i> for
+ * @param mediator the new <i>Mediator</i> to set
+ */
+
+ public void setMediator(Colleague colleague, Mediator mediator) {
+ mappingColleagueToMediator.put(colleague, mediator);
+ }
+
+
+ /**
+ * Defines what changes on <i>Colleague</i>s cause their <i>Mediator</i>
+ * to be notified
+ *
+ * @param colleague the <i>Colleague</i> on which the change occured
+ */
+
+ protected abstract pointcut change(Colleague colleague);
+
+
+ /**
+ * Call updateObserver to update each observer.
+ */
+
+ after(Colleague c): change(c) {
+ notifyMediator(c, getMediator(c));
+ }
+
+ /**
+ * Defines how the <i>Mediator</i> is to be updated when a change
+ * to a <code>Colleague</code> occurs. To be concretized by sub-aspects.
+ *
+ * @param c the <i>Colleague</i> on which a change of interest occured
+ * @param m the <i>Mediator</i> to be notifed of the change
+ */
+
+ protected abstract void notifyMediator(Colleague c, Mediator m);
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java
new file mode 100644
index 000000000..0acf0b5e5
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java
@@ -0,0 +1,51 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Declares the methods for setting and getting the state for <i>Memento</i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public interface Memento {
+
+ /**
+ * Sets the state of this <i>Memento</i> give the passed state.
+ *
+ *
+ * @param state the state to store
+ */
+
+ public void setState(Object state);
+
+ /**
+ * Returns the state of this <i>Memento</i> give the passed originator.
+ *
+ * @return the state stored by this <i>Memento</i>
+ */
+
+ public Object getState();
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java
new file mode 100644
index 000000000..8c361ed81
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java
@@ -0,0 +1,46 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements an exception that occurs if an incorrect <i>Originator</i> is used
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ *
+ * @see MementoProtocol
+ */
+
+public class MementoException extends RuntimeException {
+
+ /**
+ * Creates a MementoException
+ *
+ * @param s the error message
+ */
+
+ public MementoException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java
new file mode 100644
index 000000000..7697a0f58
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java
@@ -0,0 +1,65 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the abstract Memento design pattern. It defines the role of
+ * <i>Originator</i>. The <i>Memento</i> role is client-usable and as such
+ * defined outside this aspect.
+ *
+ * Concrete sub-aspects overwrite the two abstract methods to define how
+ * <i>Memento</i>s get generated and how they are used to restore the state
+ * of <i>Originator</i>s.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/12/04
+ */
+
+public abstract aspect MementoProtocol {
+
+ /**
+ * Defines the <i>Originator</i> type. Used only internally.
+ */
+
+ protected interface Originator {}
+
+ /**
+ * Creates a <i>Memento</i> object for an <i>Originator</i>
+ *
+ * @param o the <i>Originator</i> to create a <i>Memento</i> for
+ * @return the <i>Memento</i> storing the originator's state
+ */
+
+ public abstract Memento createMementoFor(Originator o);
+
+ /**
+ * Restores this <i>Originator</i> to a former state encapsulated in the
+ * <i>Memento</i> passed
+ *
+ * @param o the <i>Originator</i> to restore
+ * @param m the <i>Memento</i> that stores the prior state
+ */
+
+ public abstract void setMemento(Originator o, Memento m);
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java
new file mode 100644
index 000000000..da403022b
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java
@@ -0,0 +1,168 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.WeakHashMap;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * Defines the general behavior of the Observer design pattern.
+ *
+ * Each concrete sub-aspect of ObserverProtocol defines one kind of observing
+ * relationship. Within that kind of relationship, there can be any number
+ * of <i>Subject</i>s, each with any number of <i>Observer</i>s.
+ *
+ * The sub-aspect defines three things: <ol>
+ *
+ * <li> what types can be <i>Subject</i>s or observers <br>
+ * this is done using +implements
+ *
+ * <li> what operations on the <i>Subject</i> require updating the observers <br>
+ * this is done by concretizing the changes(Subject) pointcut
+ *
+ * <li> how to update the observers <br>
+ * this is done by defining a method on
+ * updateObserver(Subject, Observer)
+ * </ol>
+ *
+ * Note that in this implementation, the work of updating is a method
+ * on the sub-aspect, not a method introduced on the observer. This
+ * allows one class of object to be the observer in different kinds of
+ * observing relationships, each of which has a different updating
+ * behavior. For observers that just have a single generic update
+ * behavior, the method on updateObserver will just be a simple call
+ * that generic updater.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ */
+
+public abstract aspect ObserverProtocol {
+
+
+ /**
+ * This interface is used by extending aspects to say what types
+ * can be <i>Subject</i>s. It models the <i>Subject</i> role.
+ */
+
+ protected interface Subject { }
+
+
+ /**
+ * This interface is used by extending aspects to say what types
+ * can be <i>Observer</i>s. It models the <i>Observer</i> role.
+ */
+
+ protected interface Observer { }
+
+
+ /**
+ * Stores the mapping between <i>Subject</i>s and <i>
+ * Observer</i>s. For each <i>Subject</i>, a <code>LinkedList</code>
+ * is of its <i>Observer</i>s is stored.
+ */
+
+ private WeakHashMap perSubjectObservers;
+
+
+ /**
+ * Returns a <code>Collection</code> of the <i>Observer</i>s of
+ * a particular subject. Used internally.
+ *
+ * @param subject the <i>subject</i> for which to return the <i>Observer</i>s
+ * @return a <code>Collection</code> of s's <i>Observer</i>s
+ */
+
+ protected List getObservers(Subject subject) {
+ if (perSubjectObservers == null) {
+ perSubjectObservers = new WeakHashMap();
+ }
+ List observers = (List)perSubjectObservers.get(subject);
+ if ( observers == null ) {
+ observers = new LinkedList();
+ perSubjectObservers.put(subject, observers);
+ }
+ return observers;
+ }
+
+
+ /**
+ * Adds an <i>Observer</i> to a <i>Subject</i>. This is the equivalent of <i>
+ * attach()</i>, but is a method on the pattern aspect, not the
+ * <i>Subject</i>.
+ *
+ * @param s the <i>Subject</i> to attach a new <i>Observer</i> to
+ * @param o the new <i>Observer</i> to attach
+ */
+
+ public void addObserver(Subject subject, Observer observer) {
+ getObservers(subject).add(observer);
+ }
+
+ /**
+ * Removes an observer from a <i>Subject</i>. This is the equivalent of <i>
+ * detach()</i>, but is a method on the pattern aspect, not the <i>Subject</i>.
+ *
+ * @param s the <i>Subject</i> to remove the <i>Observer</i> from
+ * @param o the <i>Observer</i> to remove
+ */
+
+ public void removeObserver(Subject subject, Observer observer) {
+ getObservers(subject).remove(observer);
+ }
+
+ /**
+ * The join points after which to do the update.
+ * It replaces the normally scattered calls to <i>notify()</i>. To be
+ * concretized by sub-aspects.
+ */
+
+ protected abstract pointcut subjectChange(Subject s);
+
+ /**
+ * Calls <code>updateObserver(..)</code> after a change of interest to
+ * update each <i>Observer</i>.
+ *
+ * @param subject the <i>Subject</i> on which the change occured
+ */
+
+ after(Subject subject): subjectChange(subject) {
+ Iterator iter = getObservers(subject).iterator();
+ while ( iter.hasNext() ) {
+ updateObserver(subject, ((Observer)iter.next()));
+ }
+ }
+
+ /**
+ * Defines how each <i>Observer</i> is to be updated when a change
+ * to a <i>Subject</i> occurs. To be concretized by sub-aspects.
+ *
+ * @param subject the <i>Subject</i> on which a change of interest occured
+ * @param observer the <i>Observer</i> to be notifed of the change
+ */
+
+ protected abstract void updateObserver(Subject subject, Observer observer);
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java
new file mode 100644
index 000000000..79ef7cd56
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java
@@ -0,0 +1,91 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the abstract Prototype design pattern. It attaches a default
+ * <code>clone()</code> method on all <i>Prototype</i> participants and
+ * provides a static <code>cloneObject(Prototype)</clone> method. The default
+ * implementation of that method is to try to use the <code>clone()</code>
+ * method and, failing that, to call its protected <code>
+ * createCloneFor(Prototype)</code> method. Concrete subaspects can either
+ * overwrite none or one (or both) of the methods to tailor their
+ * particular design pattern instance to its individual needs
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/13/04
+ */
+
+public abstract aspect PrototypeProtocol {
+
+ /**
+ * Defines the <i>Prototype</i> role.
+ */
+
+ protected interface Prototype {}
+
+ /**
+ * Attaches a default <code>clone()</code> method to all prototypes.
+ * This makes use of Java's clone() mechanism that creates a deep copy
+ * of the object in question.
+ *
+ * @return a copy of the object
+ */
+
+ public Object Prototype.clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * Provides a static default aspect method for cloning prototypes.
+ * It uses the attached clone() method if possible. If not, it calls the
+ * static <code>createCloneFor(Prototype)</code> method.
+ *
+ * @param object the prototype object to clone
+ * @return a copy of the object
+ */
+
+
+ public Object cloneObject(Prototype object) {
+ try {
+ return object.clone();
+ } catch (CloneNotSupportedException ex) {
+ return createCloneFor(object);
+ }
+ }
+
+ /**
+ * Provides an alternative method for cases when the default
+ * <code>clone()</code> method fails. This method can be
+ * overwritten by concrete subaspects. In this default implementation
+ * it return null.
+ *
+ * @param object the prototype object to clone
+ * @return a copy of the object, but null in this case
+ */
+
+ protected Object createCloneFor(Prototype object) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java
new file mode 100644
index 000000000..856a681a9
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java
@@ -0,0 +1,115 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Defines the abstracted Proxy design pattern.<p>
+ *
+ * Concrete sub-aspects define the following: <UL>
+ * <LI> Which class(es) are <i>RealSubject</i>s
+ * <LI> Which requests need to be handled by the <i>Proxy</i>
+ * (methods, field accesses)
+ * <LI> What to return in case of a proxy-covered
+ * access to a method.
+ * </UL>
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public abstract aspect ProxyProtocol {
+
+ /**
+ * Defines the Subject role (used for correct typing)
+ */
+
+ protected interface Subject {}
+
+ /**
+ * Captures all accesses to the subject that should be covered by
+ * this pattern instance.
+ */
+
+ protected abstract pointcut requests();
+
+ /**
+ * Extends the <code>requests()</code> pointcut to include a
+ * field for the joinpoint. Used internally only.
+ */
+
+ private pointcut requestsByCaller(Object caller):
+ requests() && this(caller);
+
+ /**
+ * Intercepts accesses to protected parts of the OutputSubject.
+ * If access is proxy protected, the method
+ * <code>handleProxyProtection(..)</code> is called instead.
+ *
+ * @param caller the object responsible for the protected access
+ * @param subject the subject receiving the call
+ */
+
+ Object around(Object caller, Subject subject):
+ requestsByCaller(caller) && target(subject) {
+
+ if (! isProxyProtected(caller, subject, thisJoinPoint) )
+ return proceed(caller, subject);
+ return handleProxyProtection(caller, subject, thisJoinPoint);
+ }
+
+ /**
+ * Checks whether the request should be handled by the Proxy or not
+ *
+ * @param caller the object responsible for the protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the protected access
+ *
+ * @return true if the access is covered by the proxy, false otherwise
+ */
+
+ protected abstract boolean isProxyProtected(Object caller,
+ Subject subject,
+ JoinPoint joinPoint);
+
+ /**
+ * For delegation: Provides an alternative return value if access
+ * is proxy protected. A default implementation is supplied so that
+ * concrete subaspects are not forced to implement the method.
+ *
+ * @param caller the object responsible for the proxy protected access
+ * @param subject the subject receiving the call
+ * @param joinPoint the joinpoint associated with the proxy protected
+ * access
+ *
+ * @return an alternative return value
+ */
+
+ protected Object handleProxyProtection(Object caller,
+ Subject subject,
+ JoinPoint joinPoint) {
+ return null;
+ }
+}
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java
new file mode 100644
index 000000000..fddd603da
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java
@@ -0,0 +1,93 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Defines the general behavior of the Singleton design pattern.
+ *
+ * Each concrete sub-aspect of SingletonProtocol defines the Singleton
+ * property for one or more types.
+ *
+ * The sub-aspect defines two things: <ol>
+ *
+ * <li> what types are <i>Singleton</i> <br>
+ *
+ * <li> what classes can access the <i>Singleton</i>'s constructor (if any)
+ * despite its property
+ * </ol>
+ *
+ * for this implementation we choose to illustrate that it is not necessary
+ * to provide a factory method for accessing the <i>Singleton</i>
+ * instance (like <i>getSingleton()</i>). The regular
+ * constructor may be used instead.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/18/04
+ */
+
+public abstract aspect SingletonProtocol {
+
+ /**
+ * stores the <i>Singleton</i> instances
+ */
+
+ private Hashtable singletons = new Hashtable();
+
+ /**
+ * Defines the <i>Singleton</i> role. It is realized as <code>public
+ * </code> to allow for more flexibility (i.e., alternatively, types
+ * can just themselves declare that they implement the interface to
+ * aquire the <i>Singleton</i> property.
+ */
+
+ public interface Singleton {}
+
+ /**
+ * Placeholder for exceptions to the <i>Singleton</i>'s constructor
+ * protection. For example, non-singleton subclasses may need to
+ * access the protected constructor of the <i>Singleton</i> normally.
+ *
+ * An alternative implementation would be to define an interface
+ * for singleton exceptions similar to the one above.
+ */
+
+ protected pointcut protectionExclusions();
+
+ /**
+ * Protects the <i>Singleton</i>'s constructor. Creates the unique
+ * instance on demant and returns it instead of a new object.
+ *
+ * @return the singleton instance
+ */
+
+ Object around(): call((Singleton+).new(..)) && !protectionExclusions() {
+ Class singleton = thisJoinPoint.getSignature().getDeclaringType();
+ if (singletons.get(singleton) == null) { // How to access the static instance variable here?
+ singletons.put(singleton, proceed());
+ }
+ return singletons.get(singleton);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java
new file mode 100644
index 000000000..0e3291460
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java
@@ -0,0 +1,87 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Implements the the abstract Strategy design pattern protocol<p>
+ *
+ * Defines the <i>Strategy</i> and <i>Context</i> role. Also provides
+ * methods for setting and retrieving the <i>Strategy</i> for a
+ * given <i>Context</i>.
+ *
+ * It is also possible (although not shown here) to provide abstract
+ * pointcuts for setting or removing <i>Strategy</i>s from
+ * <i>Context</>s. This would allow <i>Client</i> implementations
+ * to be free of pattern code. For an example of how to do that,
+ * see the implementation of the abstract CommandProtocol aspect.
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+
+
+public abstract aspect StrategyProtocol {
+
+ /**
+ * Stores the current strategy for each context
+ *
+ * @param numbers the int array to sort
+ */
+ Hashtable strategyPerContext = new Hashtable();
+
+ /**
+ * Defines the <i>Strategy</i> role
+ */
+
+ protected interface Strategy { }
+
+ /**
+ * Defines the <i>Context</i> role
+ */
+
+ protected interface Context { }
+
+ /**
+ * Sets the strategy for a given context
+ *
+ * @param c the context to set the strategy for
+ * @param s the new strategy
+ */
+ public void setConcreteStrategy(Context c, Strategy s) {
+ strategyPerContext.put(c, s);
+ }
+
+ /**
+ * Returns the strategy for a given context
+ *
+ * @param c the context object
+ * @return the strategy object for that context
+ */
+ public Strategy getConcreteStrategy(Context c) {
+ return (Strategy) strategyPerContext.get(c);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java
new file mode 100644
index 000000000..b1c30546c
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java
@@ -0,0 +1,130 @@
+package ca.ubc.cs.spl.aspectPatterns.patternLibrary;
+
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This file is part of the design patterns project at UBC
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is ca.ubc.cs.spl.aspectPatterns.
+ *
+ * For more details and the latest version of this code, please see:
+ * http://www.cs.ubc.ca/labs/spl/projects/aodps.html
+ *
+ * Contributor(s):
+ */
+
+/**
+ * Implements the abstracted Visitor design pattern.<p>
+ *
+ * Intent: <i>Represents an operation to be performed on the elements of an
+ * object structure. Visitor lets you define a new operation without changing
+ * the classes of the elements on which it operates</i><p>
+ *
+ * Note that this implementation only deals with two different kind of nodes:
+ * terminal and non-terminal nodes. In cases where the aggregate structure
+ * contains more types of nodes, this aspect cannot be used without
+ * modifications. <p>
+ *
+ * Note further that whenever the aggregate structure is unimportant, the
+ * additional functionality can be added in a much sipmler using
+ * AspectJ's open classes mechanism (i.e., by using inter-type declarations
+ * to implement the desired functionality).
+ *
+ * @author Jan Hannemann
+ * @author Gregor Kiczales
+ * @version 1.1, 02/17/04
+ */
+
+public abstract aspect VisitorProtocol {
+
+ /**
+ * Defines the <i>Element</i> role. The inerface is public so that
+ * <i>ConcreteVisitor</i>s can use the type.
+ */
+
+ public interface VisitableNode {}
+
+ /**
+ * Defines a <i>ConcreteElement</i> role for non-terminal nodes in
+ * a binary tree structure. The interface is protected as it is only used
+ * by concrete subaspects.
+ */
+
+ protected interface Node extends VisitableNode {}
+
+ /**
+ * Defines a <i>ConcreteElement</i> role for terminal nodes in
+ * a tree structure. The inerface is protected as it is only used
+ * by concrete subaspects.
+ */
+
+ protected interface Leaf extends VisitableNode {}
+
+ /**
+ * This interface is implemented by <i>ConcreteVisitor</i>s.
+ */
+
+ public interface Visitor {
+
+ /**
+ * Defines a method signature for visiting regular nodes.
+ *
+ * @param node the regular node to visit
+ */
+
+ public void visitNode(VisitableNode node);
+
+ /**
+ * Defines a method signature for visiting leaf nodes.
+ *
+ * @param node the leaf node to visit
+ */
+
+ public void visitLeaf(VisitableNode node);
+
+ /**
+ * Defines a method signature for returning the visitor's results
+ *
+ * @param node a string containig the visitor's results
+ */
+
+ public String report();
+ }
+
+ /**
+ * Declares <code>accept(..)</code> for visitable nodes
+ *
+ * @param visitor the visitor that is to be accepted
+ */
+
+ public void VisitableNode.accept(Visitor visitor) {}
+
+ /**
+ * Declares <code>accept(..)</code> for regular nodes
+ *
+ * @param visitor the visitor that is to be accepted
+ */
+
+ public void Node.accept(Visitor visitor) {
+ visitor.visitNode(this);
+ }
+
+ /**
+ * Declares <code>accept(..)</code> for leaf nodes
+ *
+ * @param visitor the visitor that is to be accepted
+ */
+
+ public void Leaf.accept(Visitor visitor) {
+ visitor.visitLeaf(this);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/build-lib.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/build-lib.lst
new file mode 100644
index 000000000..ba39bf644
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/build-lib.lst
@@ -0,0 +1,5 @@
+-outjar
+lib.jar
+-sourceroots
+.
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-all.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-all.lst
new file mode 100644
index 000000000..8b16e3479
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-all.lst
@@ -0,0 +1,253 @@
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\AbstractFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\AbstractFactoryEnhancement.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\Display.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\FramedFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\aspectj\RegularFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\AbstractFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\Display.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\FramedFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\abstractFactory\java\RegularFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\PrinterAdapter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\SystemOutPrinter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\aspectj\Writer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\PrinterAdapter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\SystemOutPrinter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\adapter\java\Writer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\AbstractionImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\CrossCapitalImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\GreetingScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\InformationScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\ScreenImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\aspectj\StarImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\CrossCapitalImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\GreetingScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\InformationScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\ScreenImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\bridge\java\StarImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\Creator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\CreatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\TextCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\aspectj\XMLCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\Creator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\TextCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\builder\java\XMLCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Click.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\ClickChain.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Frame.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\aspectj\Panel.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Click.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\ClickHandler.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Frame.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\chainOfResponsibility\java\Panel.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommand.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommand2.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\ButtonCommanding.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\aspectj\Printer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\ButtonCommand.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\ButtonCommand2.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Command.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\command\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\Directory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\File.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\FileSystemComposition.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\Directory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\File.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\FileSystemComponent.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\composite\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\BracketDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\ConcreteOutput.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\aspectj\StarDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\BracketDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\ConcreteOutput.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\Output.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\OutputDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\decorator\java\StarDecorator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\Decoration.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\OutputFacade.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\RegularScreen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\facade\java\StringTransformer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\ButtonCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\CreatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\GUIComponentCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\LabelCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\ButtonCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\GUIComponentCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\LabelCreator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\factoryMethod\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\CharacterFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\FlyweightImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\PrintableFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\aspect\WhitespaceFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\CharacterFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\PrintableFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\PrintableFlyweightFactory.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\flyweight\java\WhitespaceFlyweight.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\AndExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanConstant.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\BooleanInterpretation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\ExpressionException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\NotExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\OrExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\VariableContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\aspectj\VariableExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\AndExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\BooleanConstant.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\BooleanExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\ExpressionException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\NotExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\OrExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\VariableContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\interpreter\java\VariableExpression.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\OpenList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\OpenListIteration.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\aspectj\SimpleList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\OpenList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\ReverseIterator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\iterator\java\SimpleList.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Label.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\aspectj\MediatorImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Button.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\GUIColleague.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\GUIMediator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Label.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\mediator\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\Counter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\CounterMemento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\Counter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\CounterMemento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\memento\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\ColorObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\CoordinateObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Point.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\aspectj\ScreenObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\ChangeObserver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\ChangeSubject.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Point.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\observer\java\Screen.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypeA.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypeB.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\aspectj\StringPrototypes.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\StringPrototypeA.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\prototype\java\StringPrototypeB.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\AlternateOutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\OutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestBlocking.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestCounting.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\aspectj\RequestDelegation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\OutputImplementation.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\OutputSubject.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\RequestBlocker.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\proxy\java\RequestCounter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\Printer.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\PrinterSubclass.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\aspectj\SingletonInstance.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\PrinterSingleton.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\singleton\java\PrinterSubclass.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\Queue.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueEmpty.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueFull.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueNormal.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueState.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\aspectj\QueueStateAspect.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\Queue.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueContext.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueEmpty.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueFull.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueNormal.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\state\java\QueueState.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\BubbleSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\LinearSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\Sorter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\aspectj\SortingStrategy.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\BubbleSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\LinearSort.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\Sorter.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\strategy\java\SortingStrategy.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\DecoratedStringGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\FancyGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\Generating.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\aspectj\SimpleGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\DecoratedStringGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\FancyGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\templateMethod\java\SimpleGenerator.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\BinaryTreeLeaf.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\BinaryTreeNode.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\SummationVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\TraversalVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Visitable.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\aspectj\Visiting.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeLeaf.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeNode.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\BinaryTreeVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\Main.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\SummationVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\TraversalVisitor.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\examples\visitor\java\Visitable.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ChainOfResponsibilityException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ChainOfResponsibilityProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\Command.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandInvoker.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CommandReceiver.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\CompositeProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\FlyweightProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MediatorProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\Memento.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MementoException.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\MementoProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ObserverProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\PrototypeProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\ProxyProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\SingletonProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\StrategyProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\patternLibrary\VisitorProtocol.java
+c:\home\ws\main\os-aj-hanneman-2004\src\ca\ubc\cs\spl\aspectPatterns\testCenter\TestCenter.java
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-source.lst b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-source.lst
new file mode 100644
index 000000000..9607e3545
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/src/tut-source.lst
@@ -0,0 +1,5 @@
+-sourceroots
+.
+-aspectpath
+../../../patternLibrary/lib.jar
+
diff --git a/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/testPattern.bat b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/testPattern.bat
new file mode 100644
index 000000000..9b15ec080
--- /dev/null
+++ b/docs/modules/ROOT/pages/sandbox/ubc-design-patterns/testPattern.bat
@@ -0,0 +1,4 @@
+cd bin
+java ca.ubc.cs.spl.aspectPatterns.examples.%1.java.Main %2 %3 %4
+java ca.ubc.cs.spl.aspectPatterns.examples.%1.aspectj.Main %2 %3 %4
+cd .. \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/teaching/demos/aosd2004.ppt b/docs/modules/ROOT/pages/teaching/demos/aosd2004.ppt
new file mode 100644
index 000000000..5d3078724
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/aosd2004.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/build.xml b/docs/modules/ROOT/pages/teaching/demos/figures/build.xml
new file mode 100644
index 000000000..2816008dc
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/build.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<!-- writen for Ant 1.5.1 -->
+<project name="figures" default="reset">
+
+<target name="reset" description="Reset the demonstration system sources">
+
+ <delete>
+ <fileset dir="src"/>
+ </delete>
+ <copy todir="src">
+ <fileset dir="src-fresh"/>
+ </copy>
+</target>
+
+</project> \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/readme.html b/docs/modules/ROOT/pages/teaching/demos/figures/readme.html
new file mode 100644
index 000000000..49e59396e
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/readme.html
@@ -0,0 +1,299 @@
+
+<head>
+<style>
+<!--
+ table.MsoNormalTable
+ {mso-style-parent:"";
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ }
+-->
+</style>
+<STYLE TYPE="text/css">
+<!--
+
+ /* FOR THE SDA PAGE */
+
+ /*
+ BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;}
+ */
+
+ A:link {
+ color:#4756AC;
+ }
+ A:visited {
+ color:#60657B;
+ }
+ A:hover {
+ color:red
+ }
+
+ INPUT {font:12px "Courier New", sans-serif;}
+
+ H2 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H3 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H4 {
+ font:15px/16px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:140%;
+ }
+ P {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .paragraph {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ LI {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ /*
+ UL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }*/
+
+ DL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ B { font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:140%;
+ }
+ .footer {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#888888;
+ text-align:left
+ }
+ .figureTitle {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ text-align:center
+ }
+ .copyrightNotice {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#999999;
+ line-height:110%;
+ }
+ .smallHeading {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:110%;
+ }
+ .tinyHeading {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:120%;
+ }
+ .newsText {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .fancyHeading {
+ font:20px/20px Chantilly, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ color:#6f7a92;
+ margin-left: 10px;
+ line-height:130%;
+ }
+
+-->
+</STYLE>
+</head>
+
+<h2 align="center">AspectJ Figures Demo Instructions</h2>
+<h4>Setup</h4>
+<ul>
+ <li>
+ <p style="text-align: left">src: contains the end result of the demo, with the Canvas.updateHistory()
+ call refactored into the src/figures/support/HistoryUpdating.aj aspect</li>
+ <li>
+ <p style="text-align: left">src-fresh: contains the plain Java sources that the demo starts with</li>
+</ul>
+<h4>Reset </h4>
+<ul>
+ <li>run the &quot;reset&quot; target in build.xml to reset overwrite the sources in
+ src with those in src-fresh</li>
+</ul>
+<h4>Script</h4>
+<div align="center">
+ <table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0" style="width: 531.65pt; margin-left: -7.95pt" id="table1">
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Show Figure editor running</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Inspect Point.java</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Use joinpoint probe or Eclipse search to find calls</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">call(void
+ figures.Canvas.updateHistory())</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Describe places that it’s called</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">create aspect (defines a special class that can crosscut other
+ classes)</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">aspect HistoryUpdating </span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">write pointcut (has name and parameters)</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">pointcut moves():
+ </font> </span></p>
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">&nbsp;&nbsp;&nbsp; execution(void
+ Line.setP1(Point)) || </font> </span></p>
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">&nbsp;&nbsp;&nbsp; execution(void
+ Line.setP2(Point));</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">write after advice (runs “on the way back out”)</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">after() returning: move() { <br>
+ &nbsp;&nbsp; &lt;runs after each move&gt; }</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">extend advice to Point setters (multi-class)</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">call(void FigureElement+.set*(..))</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">capture context &amp; use interface</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">move(FigureElement fe):
+ this(fe)
+ &amp;&amp;..</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Show structure, note that SlothfulPoint is now included</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Run &amp; show effect</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">&nbsp;</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Show Point.moveBy history violoation</span></p>
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Want to make sure that sets of private fields of classes implementing
+ FigureElement only happen from within the set methods</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">declare warning:
+ </font> </span></p>
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">&nbsp;&nbsp;&nbsp; set(private * FigureElement+.*) &nbsp;<br>
+&nbsp;&nbsp;&nbsp; &amp;&amp; !(withincode(*
+ FigureElement+.set*(..)) || <br>
+&nbsp;&nbsp;&nbsp; withincode(FigureElement+.new(..))):</font></span></p>
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family: Courier"><font size="1">&nbsp;&nbsp;&nbsp; &quot;should only assign to fields
+ from set methods&quot;;</font></span></td>
+ </tr>
+ <tr style="height: 33.45pt">
+ <td style="width: 231px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="text-indent: -.25in; margin-left: 40.5pt">
+ <span style="font-size: 10.0pt; font-family: Symbol">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span><span style="font-size:10.0pt;font-family:
+ Tahoma">Write before advice that does precondition checking on Points.</span></td>
+ <td style="width: 461px; height: 33.45pt; padding: 1.5pt; background: #F7F7F7">
+ <p class="MsoNormal" style="margin-left:7.5pt">
+ <span style="font-family:&quot;Courier New&quot;"><font size="2">before(int</font><font size="2">
+ newValue): <br>
+ &nbsp;&nbsp;&nbsp; set(int Point.*) &amp;&amp; args(newValue) {<br>
+ &nbsp;&nbsp;&nbsp; if (newValue &lt; 0) {<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new IAE(&quot;too small&quot;);<br>
+ &nbsp;&nbsp;&nbsp; } <br>
+ }</font></span></td>
+ </tr>
+ </table>
+</div>
+<p>&nbsp;</p>
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/scratch/HistoryUpdating.java b/docs/modules/ROOT/pages/teaching/demos/figures/scratch/HistoryUpdating.java
new file mode 100644
index 000000000..f4eff3d3f
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/scratch/HistoryUpdating.java
@@ -0,0 +1,27 @@
+package figures.support;
+
+import figures.*;
+
+public aspect HistoryUpdating {
+
+ pointcut moves(FigureElement fe):
+ this(fe) &&
+ execution(void FigureElement+.set*(..));
+
+ after(FigureElement fe) returning: moves(fe) {
+ Canvas.updateHistory(fe);
+ }
+
+ declare error:
+ set(private * FigureElement+.*) &&
+ !(withincode(void FigureElement+.set*(..)) ||
+ withincode(FigureElement+.new(..))):
+ "doh!!!";
+
+ before(int newValue):
+ set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Box.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Box.java
new file mode 100644
index 000000000..4db7f439d
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Box.java
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Box extends ShapeFigureElement {
+ private Point _p0;
+ private Point _p1;
+ private Point _p2;
+ private Point _p3;
+
+ public Box(int x0, int y0, int width, int height) {
+ _p0 = new Point(x0, y0);
+ _p1 = new Point(x0+width, y0);
+ _p2 = new Point(x0+width, y0+height);
+ _p3 = new Point(x0, y0+height);
+ }
+
+ public Point getP0() { return _p0; }
+ public Point getP1() { return _p1; }
+ public Point getP2() { return _p2; }
+ public Point getP3() { return _p3; }
+
+ public void move(int dx, int dy) {
+ _p0.move(dx, dy);
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ _p3.move(dx, dy);
+ }
+
+ public void checkBoxness() {
+ if ((_p0.getX() == _p3.getX()) &&
+ (_p1.getX() == _p2.getX()) &&
+ (_p0.getY() == _p1.getY()) &&
+ (_p2.getY() == _p3.getY()))
+ return;
+ throw new IllegalStateException("This is not a square.");
+ }
+
+ public String toString() {
+ return "Box(" + _p0 + ", " + _p1 + ", " + _p2 + ", " + _p3 + ")";
+ }
+
+ public Shape getShape() {
+ return new Rectangle(getP1().getX(),
+ getP1().getY(),
+ getP3().getX() - getP1().getX(),
+ getP3().getY() - getP1().getY());
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Canvas.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Canvas.java
new file mode 100644
index 000000000..ef849a5d5
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Canvas.java
@@ -0,0 +1,15 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import figures.support.Log;
+
+public class Canvas {
+ public static void updateHistory() { }
+
+ public static void updateHistory(FigureElement fe) {
+ System.out.println("> updating history for: " + fe);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ColorControl.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ColorControl.java
new file mode 100644
index 000000000..46d1ba428
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ColorControl.java
@@ -0,0 +1,20 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.Color;
+import figures.FigureElement;
+
+public aspect ColorControl {
+ public static void setFillColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ public static void setLineColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ // fill in here
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/FigureElement.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/FigureElement.java
new file mode 100644
index 000000000..ae06c132b
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/FigureElement.java
@@ -0,0 +1,21 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public interface FigureElement {
+ public static final int MIN_VALUE = 0;
+ public static final int MAX_VALUE = 500;
+
+ public abstract void move(int dx, int dy);
+
+ public abstract Rectangle getBounds();
+
+ public abstract boolean contains(Point2D p);
+
+ public abstract void paint(Graphics2D g2);
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Group.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Group.java
new file mode 100644
index 000000000..59c1a17cf
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Group.java
@@ -0,0 +1,88 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Group implements FigureElement {
+ private Collection _members;
+ private String _identifier;
+
+ public Group(FigureElement first) {
+ this._members = new ArrayList();
+ add(first);
+ }
+
+ public void add(FigureElement fe) {
+ _members.add(fe);
+ }
+
+ public Iterator members() {
+ return _members.iterator();
+ }
+
+ public void move(int dx, int dy) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.move(dx, dy);
+ }
+ }
+
+ public void resetIdentifier(String identifier) {
+ resetIdentifier(identifier);
+ }
+
+ public String toString() {
+ if (_identifier != null) {
+ return _identifier;
+ }
+
+ StringBuffer buf = new StringBuffer("Group(");
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ buf.append(i.next().toString());
+ if (i.hasNext()) {
+ buf.append(", ");
+ }
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ public Rectangle getBounds() {
+ Rectangle previous = null;
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ Rectangle rect = fe.getBounds();
+ if (previous != null) {
+ previous = previous.union(rect);
+ } else {
+ previous = rect;
+ }
+ }
+ return previous;
+ }
+
+ public boolean contains(Point2D p) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return true;
+ }
+ return false;
+ }
+
+ public void paint(Graphics2D g2) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.paint(g2);
+ }
+ }
+
+ public int size() {
+ return _members.size();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Line.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Line.java
new file mode 100644
index 000000000..e76206639
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Line.java
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Line extends ShapeFigureElement {
+ private Point _p1;
+ private Point _p2;
+
+ public Line(Point p1, Point p2) {
+ _p1 = p1;
+ _p2 = p2;
+ }
+
+ public Point getP1() {
+ return _p1;
+ }
+
+ public void setP1(Point p1) {
+ _p1 = p1;
+ Canvas.updateHistory();
+ }
+
+ public Point getP2() {
+ return _p2;
+ }
+
+ public void setP2(Point p2) {
+ _p2 = p2;
+ Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ }
+
+ public String toString() {
+ return "Line(" + _p1 + ", " + _p2 + ")";
+ }
+
+ /**
+ * Used to determine if this line {@link contains(Point2D)} a point.
+ */
+ final static int THRESHHOLD = 5;
+
+ /**
+ * Returns <code>true</code> if the point segment distance is less than
+ * {@link THRESHHOLD}.
+ */
+ public boolean contains(Point2D p) {
+ return getLine2D().ptLineDist(p) < THRESHHOLD;
+ }
+
+ private Line2D getLine2D() {
+ return new Line2D.Float((float)getP1().getX(),
+ (float)getP1().getY(),
+ (float)getP2().getX(),
+ (float)getP2().getY());
+ }
+
+ public Shape getShape() {
+ return getLine2D();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Point.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Point.java
new file mode 100644
index 000000000..9699aaf31
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/Point.java
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Point extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public Point(int x, int y) {
+ _x = x;
+ _y = y;
+ }
+
+ public int getX() {
+ return _x;
+ }
+
+ public void setX(int x) {
+ _x = x;
+ Canvas.updateHistory();
+ }
+
+ public int getY() {
+ return _y;
+ }
+
+ public void setY(int y) {
+ _y = y;
+ Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ _x += dx;
+ _y += dy;
+ }
+
+ public String toString() {
+ return "Point(" + _x + ", " + _y + ")";
+ }
+
+ /** The height of displayed {@link Point}s. */
+ private final static int HEIGHT = 10;
+
+ /** The width of displayed {@link Point}s. -- same as {@link HEIGHT}. */
+ private final static int WIDTH = Point.HEIGHT;
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)getX()-Point.WIDTH/2,
+ (float)getY()-Point.HEIGHT/2,
+ (float)Point.HEIGHT,
+ (float)Point.WIDTH);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ShapeFigureElement.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ShapeFigureElement.java
new file mode 100644
index 000000000..29a4a89ad
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/ShapeFigureElement.java
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public abstract class ShapeFigureElement implements FigureElement {
+ public abstract void move(int dx, int dy);
+
+ public abstract Shape getShape();
+
+ public Rectangle getBounds() {
+ return getShape().getBounds();
+ }
+
+ public boolean contains(Point2D p) {
+ return getShape().contains(p);
+ }
+
+ public Color getLineColor() {
+ return Color.black;
+ }
+
+ public Color getFillColor() {
+ return Color.red;
+ }
+
+ public final void paint(Graphics2D g2) {
+ Shape shape = getShape();
+ g2.setPaint(getFillColor());
+ g2.fill(shape);
+ g2.setPaint(getLineColor());
+ g2.draw(shape);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/SlothfulPoint.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/SlothfulPoint.java
new file mode 100644
index 000000000..620970373
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/SlothfulPoint.java
@@ -0,0 +1,42 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+/**
+ * This class makes mistakes to be caught by invariant checkers.
+ */
+public class SlothfulPoint extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public SlothfulPoint(int x, int y) {
+ }
+
+ public void setX(int x) {
+ _x = x;
+ }
+
+ public void setY(int y) {
+ _y = y;
+ }
+
+ public void move(int dx, int dy) {
+ setX(_x + dx);
+ setY(_y + dy);
+ }
+
+ public String toString() {
+ return "SlothfulPoint";
+ }
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)_x,
+ (float)_y, 1.0f, 1.0f);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/FigurePanel.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/FigurePanel.java
new file mode 100644
index 000000000..cac59e835
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/FigurePanel.java
@@ -0,0 +1,172 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import figures.Point;
+import figures.Line;
+import figures.FigureElement;
+import figures.Group;
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+
+public class FigurePanel extends JComponent {
+
+ ButtonsPanel bp = new ButtonsPanel();
+ FigureSurface fs = new FigureSurface();
+ ConsolePanel cp = new ConsolePanel();
+
+
+ public FigurePanel() {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(fs);
+ panel.add(bp);
+ JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, cp);
+ sp.setPreferredSize(new Dimension(500, 400));
+ sp.setDividerLocation(250);
+ add(BorderLayout.CENTER, sp);
+ }
+
+ class ButtonsPanel extends JPanel {
+ private JLabel msgs = new JLabel("click to add a point or line");
+ public ButtonsPanel() {
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+// add(new JButton(new AbstractAction("Main") {
+// public void actionPerformed(ActionEvent e) {
+// Main.main(new String[]{});
+// fs.repaint();
+// }
+// }));
+ add(msgs);
+ }
+
+ public void log(String msg) {
+ msgs.setText(msg);
+ }
+ }
+
+ static class ConsolePanel extends JPanel {
+
+ JTextArea text = new JTextArea();
+
+ public ConsolePanel() {
+ super(new BorderLayout());
+ text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10));
+ JScrollPane scroller = new JScrollPane(text);
+ scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ add(BorderLayout.CENTER, scroller);
+ }
+
+ public void println(String msg) {
+ text.append(msg + '\n');
+ }
+ }
+
+ final static Color BACKGROUND = Color.white;
+
+ static class FigureSurface extends JPanel implements MouseListener, MouseMotionListener {
+ private Group canvas;
+
+ public FigureSurface() {
+ canvas = new Group(new Point(250, 250));
+ addMouseMotionListener(this);
+ addMouseListener(this);
+ setPreferredSize(new Dimension(500,500));
+ }
+
+ private Point addPoint(int x, int y) {
+ Point p = new Point(x, y);
+ canvas.add(p);
+ repaint();
+ return p;
+ }
+
+ private Line addLine(Point p1, Point p2) {
+ if (Math.abs(p1.getX()-p2.getX()) < 5 ||
+ Math.abs(p1.getY()-p2.getY()) < 5) {
+ return null;
+ }
+
+ Line line = null;
+ if (p1 != null && p2 != null) {
+ line = new Line(p1, p2);
+ canvas.add(line);
+ }
+ repaint();
+ return line;
+ }
+
+ public void paint(Graphics g) {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setPaint(BACKGROUND);
+ g2.fill(new Rectangle2D.Float(0f, 0f, (float)g2.getClipBounds().width, (float)g2.getClipBounds().height));
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ canvas.paint(g2);
+ }
+
+
+ int lastX, lastY;
+ int pressX, pressY;
+
+ FigureElement first = null;
+ Point point1 = null;
+
+ public void mousePressed(MouseEvent e){
+ int x = e.getX(), y = e.getY();
+ pressX = lastX = x; pressY = lastY = y;
+ first = findFigureElement(x, y);
+ if (first == null) {
+ point1 = addPoint(x, y);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ int x = e.getX(), y = e.getY(), dx = lastX-x, dy = lastY-y;
+ lastX = x;
+ lastY = y;
+ if (first == null) {
+ Line line = addLine(point1, new Point(x, y));
+ if (line != null) {
+ canvas.add(line.getP2());
+ first = line.getP2();
+ canvas.add(line);
+ }
+ } else {
+ first.move(-dx, -dy);
+ }
+ repaint();
+ }
+
+ public void mouseReleased(MouseEvent e){
+ mouseDragged(e);
+ first = null;
+ point1 = null;
+ }
+
+
+ public void mouseMoved(MouseEvent e){}
+ public void mouseClicked(MouseEvent e){}
+ public void mouseExited(MouseEvent e){}
+ public void mouseEntered(MouseEvent e){}
+
+ private FigureElement findFigureElement(int x, int y) {
+ Point2D p = new Point2D.Float((float)x, (float)y);
+ for (Iterator i = canvas.members(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return fe;
+ }
+ return null;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/LogAdapter.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/LogAdapter.java
new file mode 100644
index 000000000..92a192f15
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/LogAdapter.java
@@ -0,0 +1,16 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import figures.support.Log;
+
+aspect LogAdapter {
+
+ before(String s): call(void Log.log(String)) && args(s) {
+ if (Main.panel != null) {
+ Main.panel.cp.println(s);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/Main.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/Main.java
new file mode 100644
index 000000000..da257aeda
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/gui/Main.java
@@ -0,0 +1,25 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import javax.swing.*;
+import figures.support.Log;
+import figures.Point;
+
+public class Main {
+ static FigurePanel panel;
+
+ public static void main(String[] args) {
+ JFrame figureFrame = new JFrame("Figure Editor");
+ panel = new FigurePanel();
+ figureFrame.setContentPane(panel);
+ figureFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ figureFrame.pack();
+ figureFrame.setVisible(true);
+
+// Point p = new Point(0, 0);
+// p.setX(-10);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/support/Log.java b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/support/Log.java
new file mode 100644
index 000000000..1ae18cc46
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src-fresh/figures/support/Log.java
@@ -0,0 +1,36 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.support;
+
+public class Log {
+ private static StringBuffer data = new StringBuffer();
+
+ public static void traceObject(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void log(String s) {
+ data.append(s);
+ data.append(';');
+ }
+
+ public static void logClassName(Class _class) {
+ String name = _class.getName();
+ int dot = name.lastIndexOf('.');
+ if (dot == -1) {
+ log(name);
+ } else {
+ log(name.substring(dot+1, name.length()));
+ }
+ }
+
+ public static String getString() {
+ return data.toString();
+ }
+
+ public static void clear() {
+ data.setLength(0);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Box.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Box.java
new file mode 100644
index 000000000..4db7f439d
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Box.java
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Box extends ShapeFigureElement {
+ private Point _p0;
+ private Point _p1;
+ private Point _p2;
+ private Point _p3;
+
+ public Box(int x0, int y0, int width, int height) {
+ _p0 = new Point(x0, y0);
+ _p1 = new Point(x0+width, y0);
+ _p2 = new Point(x0+width, y0+height);
+ _p3 = new Point(x0, y0+height);
+ }
+
+ public Point getP0() { return _p0; }
+ public Point getP1() { return _p1; }
+ public Point getP2() { return _p2; }
+ public Point getP3() { return _p3; }
+
+ public void move(int dx, int dy) {
+ _p0.move(dx, dy);
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ _p3.move(dx, dy);
+ }
+
+ public void checkBoxness() {
+ if ((_p0.getX() == _p3.getX()) &&
+ (_p1.getX() == _p2.getX()) &&
+ (_p0.getY() == _p1.getY()) &&
+ (_p2.getY() == _p3.getY()))
+ return;
+ throw new IllegalStateException("This is not a square.");
+ }
+
+ public String toString() {
+ return "Box(" + _p0 + ", " + _p1 + ", " + _p2 + ", " + _p3 + ")";
+ }
+
+ public Shape getShape() {
+ return new Rectangle(getP1().getX(),
+ getP1().getY(),
+ getP3().getX() - getP1().getX(),
+ getP3().getY() - getP1().getY());
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Canvas.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Canvas.java
new file mode 100644
index 000000000..ef849a5d5
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Canvas.java
@@ -0,0 +1,15 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import figures.support.Log;
+
+public class Canvas {
+ public static void updateHistory() { }
+
+ public static void updateHistory(FigureElement fe) {
+ System.out.println("> updating history for: " + fe);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ColorControl.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ColorControl.java
new file mode 100644
index 000000000..f1a76512b
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ColorControl.java
@@ -0,0 +1,16 @@
+package figures;
+
+import java.awt.Color;
+import figures.FigureElement;
+
+public aspect ColorControl {
+ public static void setFillColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ public static void setLineColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ // fill in here
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/FigureElement.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/FigureElement.java
new file mode 100644
index 000000000..ae06c132b
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/FigureElement.java
@@ -0,0 +1,21 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public interface FigureElement {
+ public static final int MIN_VALUE = 0;
+ public static final int MAX_VALUE = 500;
+
+ public abstract void move(int dx, int dy);
+
+ public abstract Rectangle getBounds();
+
+ public abstract boolean contains(Point2D p);
+
+ public abstract void paint(Graphics2D g2);
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Group.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Group.java
new file mode 100644
index 000000000..59c1a17cf
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Group.java
@@ -0,0 +1,88 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Group implements FigureElement {
+ private Collection _members;
+ private String _identifier;
+
+ public Group(FigureElement first) {
+ this._members = new ArrayList();
+ add(first);
+ }
+
+ public void add(FigureElement fe) {
+ _members.add(fe);
+ }
+
+ public Iterator members() {
+ return _members.iterator();
+ }
+
+ public void move(int dx, int dy) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.move(dx, dy);
+ }
+ }
+
+ public void resetIdentifier(String identifier) {
+ resetIdentifier(identifier);
+ }
+
+ public String toString() {
+ if (_identifier != null) {
+ return _identifier;
+ }
+
+ StringBuffer buf = new StringBuffer("Group(");
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ buf.append(i.next().toString());
+ if (i.hasNext()) {
+ buf.append(", ");
+ }
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ public Rectangle getBounds() {
+ Rectangle previous = null;
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ Rectangle rect = fe.getBounds();
+ if (previous != null) {
+ previous = previous.union(rect);
+ } else {
+ previous = rect;
+ }
+ }
+ return previous;
+ }
+
+ public boolean contains(Point2D p) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return true;
+ }
+ return false;
+ }
+
+ public void paint(Graphics2D g2) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.paint(g2);
+ }
+ }
+
+ public int size() {
+ return _members.size();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Line.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Line.java
new file mode 100644
index 000000000..e9911c6d7
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Line.java
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Line extends ShapeFigureElement {
+ private Point _p1;
+ private Point _p2;
+
+ public Line(Point p1, Point p2) {
+ _p1 = p1;
+ _p2 = p2;
+ }
+
+ public Point getP1() {
+ return _p1;
+ }
+
+ public void setP1(Point p1) {
+ _p1 = p1;
+// Canvas.updateHistory();
+ }
+
+ public Point getP2() {
+ return _p2;
+ }
+
+ public void setP2(Point p2) {
+ _p2 = p2;
+// Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ }
+
+ public String toString() {
+ return "Line(" + _p1 + ", " + _p2 + ")";
+ }
+
+ /**
+ * Used to determine if this line {@link contains(Point2D)} a point.
+ */
+ final static int THRESHHOLD = 5;
+
+ /**
+ * Returns <code>true</code> if the point segment distance is less than
+ * {@link THRESHHOLD}.
+ */
+ public boolean contains(Point2D p) {
+ return getLine2D().ptLineDist(p) < THRESHHOLD;
+ }
+
+ private Line2D getLine2D() {
+ return new Line2D.Float((float)getP1().getX(),
+ (float)getP1().getY(),
+ (float)getP2().getX(),
+ (float)getP2().getY());
+ }
+
+ public Shape getShape() {
+ return getLine2D();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Point.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Point.java
new file mode 100644
index 000000000..d832b983c
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/Point.java
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Point extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public Point(int x, int y) {
+ _x = x;
+ _y = y;
+ }
+
+ public int getX() {
+ return _x;
+ }
+
+ public void setX(int x) {
+ _x = x;
+// Canvas.updateHistory();
+ }
+
+ public int getY() {
+ return _y;
+ }
+
+ public void setY(int y) {
+ _y = y;
+// Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ setX(_x + dx);
+ setY(_y + dy);
+ }
+
+ public String toString() {
+ return "Point(" + _x + ", " + _y + ")";
+ }
+
+ /** The height of displayed {@link Point}s. */
+ private final static int HEIGHT = 10;
+
+ /** The width of displayed {@link Point}s. -- same as {@link HEIGHT}. */
+ private final static int WIDTH = Point.HEIGHT;
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)getX()-Point.WIDTH/2,
+ (float)getY()-Point.HEIGHT/2,
+ (float)Point.HEIGHT,
+ (float)Point.WIDTH);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ShapeFigureElement.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ShapeFigureElement.java
new file mode 100644
index 000000000..29a4a89ad
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/ShapeFigureElement.java
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public abstract class ShapeFigureElement implements FigureElement {
+ public abstract void move(int dx, int dy);
+
+ public abstract Shape getShape();
+
+ public Rectangle getBounds() {
+ return getShape().getBounds();
+ }
+
+ public boolean contains(Point2D p) {
+ return getShape().contains(p);
+ }
+
+ public Color getLineColor() {
+ return Color.black;
+ }
+
+ public Color getFillColor() {
+ return Color.red;
+ }
+
+ public final void paint(Graphics2D g2) {
+ Shape shape = getShape();
+ g2.setPaint(getFillColor());
+ g2.fill(shape);
+ g2.setPaint(getLineColor());
+ g2.draw(shape);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/SlothfulPoint.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/SlothfulPoint.java
new file mode 100644
index 000000000..620970373
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/SlothfulPoint.java
@@ -0,0 +1,42 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+/**
+ * This class makes mistakes to be caught by invariant checkers.
+ */
+public class SlothfulPoint extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public SlothfulPoint(int x, int y) {
+ }
+
+ public void setX(int x) {
+ _x = x;
+ }
+
+ public void setY(int y) {
+ _y = y;
+ }
+
+ public void move(int dx, int dy) {
+ setX(_x + dx);
+ setY(_y + dy);
+ }
+
+ public String toString() {
+ return "SlothfulPoint";
+ }
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)_x,
+ (float)_y, 1.0f, 1.0f);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/FigurePanel.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/FigurePanel.java
new file mode 100644
index 000000000..cac59e835
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/FigurePanel.java
@@ -0,0 +1,172 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import figures.Point;
+import figures.Line;
+import figures.FigureElement;
+import figures.Group;
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+
+public class FigurePanel extends JComponent {
+
+ ButtonsPanel bp = new ButtonsPanel();
+ FigureSurface fs = new FigureSurface();
+ ConsolePanel cp = new ConsolePanel();
+
+
+ public FigurePanel() {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(fs);
+ panel.add(bp);
+ JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, cp);
+ sp.setPreferredSize(new Dimension(500, 400));
+ sp.setDividerLocation(250);
+ add(BorderLayout.CENTER, sp);
+ }
+
+ class ButtonsPanel extends JPanel {
+ private JLabel msgs = new JLabel("click to add a point or line");
+ public ButtonsPanel() {
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+// add(new JButton(new AbstractAction("Main") {
+// public void actionPerformed(ActionEvent e) {
+// Main.main(new String[]{});
+// fs.repaint();
+// }
+// }));
+ add(msgs);
+ }
+
+ public void log(String msg) {
+ msgs.setText(msg);
+ }
+ }
+
+ static class ConsolePanel extends JPanel {
+
+ JTextArea text = new JTextArea();
+
+ public ConsolePanel() {
+ super(new BorderLayout());
+ text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10));
+ JScrollPane scroller = new JScrollPane(text);
+ scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ add(BorderLayout.CENTER, scroller);
+ }
+
+ public void println(String msg) {
+ text.append(msg + '\n');
+ }
+ }
+
+ final static Color BACKGROUND = Color.white;
+
+ static class FigureSurface extends JPanel implements MouseListener, MouseMotionListener {
+ private Group canvas;
+
+ public FigureSurface() {
+ canvas = new Group(new Point(250, 250));
+ addMouseMotionListener(this);
+ addMouseListener(this);
+ setPreferredSize(new Dimension(500,500));
+ }
+
+ private Point addPoint(int x, int y) {
+ Point p = new Point(x, y);
+ canvas.add(p);
+ repaint();
+ return p;
+ }
+
+ private Line addLine(Point p1, Point p2) {
+ if (Math.abs(p1.getX()-p2.getX()) < 5 ||
+ Math.abs(p1.getY()-p2.getY()) < 5) {
+ return null;
+ }
+
+ Line line = null;
+ if (p1 != null && p2 != null) {
+ line = new Line(p1, p2);
+ canvas.add(line);
+ }
+ repaint();
+ return line;
+ }
+
+ public void paint(Graphics g) {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setPaint(BACKGROUND);
+ g2.fill(new Rectangle2D.Float(0f, 0f, (float)g2.getClipBounds().width, (float)g2.getClipBounds().height));
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ canvas.paint(g2);
+ }
+
+
+ int lastX, lastY;
+ int pressX, pressY;
+
+ FigureElement first = null;
+ Point point1 = null;
+
+ public void mousePressed(MouseEvent e){
+ int x = e.getX(), y = e.getY();
+ pressX = lastX = x; pressY = lastY = y;
+ first = findFigureElement(x, y);
+ if (first == null) {
+ point1 = addPoint(x, y);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ int x = e.getX(), y = e.getY(), dx = lastX-x, dy = lastY-y;
+ lastX = x;
+ lastY = y;
+ if (first == null) {
+ Line line = addLine(point1, new Point(x, y));
+ if (line != null) {
+ canvas.add(line.getP2());
+ first = line.getP2();
+ canvas.add(line);
+ }
+ } else {
+ first.move(-dx, -dy);
+ }
+ repaint();
+ }
+
+ public void mouseReleased(MouseEvent e){
+ mouseDragged(e);
+ first = null;
+ point1 = null;
+ }
+
+
+ public void mouseMoved(MouseEvent e){}
+ public void mouseClicked(MouseEvent e){}
+ public void mouseExited(MouseEvent e){}
+ public void mouseEntered(MouseEvent e){}
+
+ private FigureElement findFigureElement(int x, int y) {
+ Point2D p = new Point2D.Float((float)x, (float)y);
+ for (Iterator i = canvas.members(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return fe;
+ }
+ return null;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/LogAdapter.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/LogAdapter.java
new file mode 100644
index 000000000..92a192f15
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/LogAdapter.java
@@ -0,0 +1,16 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import figures.support.Log;
+
+aspect LogAdapter {
+
+ before(String s): call(void Log.log(String)) && args(s) {
+ if (Main.panel != null) {
+ Main.panel.cp.println(s);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/Main.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/Main.java
new file mode 100644
index 000000000..d69f903e8
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/gui/Main.java
@@ -0,0 +1,25 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import javax.swing.*;
+import figures.support.Log;
+import figures.Point;
+
+public class Main {
+ static FigurePanel panel;
+
+ public static void main(String[] args) {
+ JFrame figureFrame = new JFrame("Figure Editor");
+ panel = new FigurePanel();
+ figureFrame.setContentPane(panel);
+ figureFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ figureFrame.pack();
+ figureFrame.setVisible(true);
+
+ Point p = new Point(0, 0);
+ p.setX(-10);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/HistoryUpdating.aj b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/HistoryUpdating.aj
new file mode 100644
index 000000000..f4eff3d3f
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/HistoryUpdating.aj
@@ -0,0 +1,27 @@
+package figures.support;
+
+import figures.*;
+
+public aspect HistoryUpdating {
+
+ pointcut moves(FigureElement fe):
+ this(fe) &&
+ execution(void FigureElement+.set*(..));
+
+ after(FigureElement fe) returning: moves(fe) {
+ Canvas.updateHistory(fe);
+ }
+
+ declare error:
+ set(private * FigureElement+.*) &&
+ !(withincode(void FigureElement+.set*(..)) ||
+ withincode(FigureElement+.new(..))):
+ "doh!!!";
+
+ before(int newValue):
+ set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/Log.java b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/Log.java
new file mode 100644
index 000000000..1ae18cc46
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/figures/src/figures/support/Log.java
@@ -0,0 +1,36 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.support;
+
+public class Log {
+ private static StringBuffer data = new StringBuffer();
+
+ public static void traceObject(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void log(String s) {
+ data.append(s);
+ data.append(';');
+ }
+
+ public static void logClassName(Class _class) {
+ String name = _class.getName();
+ int dot = name.lastIndexOf('.');
+ if (dot == -1) {
+ log(name);
+ } else {
+ log(name.substring(dot+1, name.length()));
+ }
+ }
+
+ public static String getString() {
+ return data.toString();
+ }
+
+ public static void clear() {
+ data.setLength(0);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/oopsla2001-script.html b/docs/modules/ROOT/pages/teaching/demos/oopsla2001-script.html
new file mode 100644
index 000000000..1c506956c
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/oopsla2001-script.html
@@ -0,0 +1,310 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Language" content="en-us">
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
+<meta name="ProgId" content="FrontPage.Editor.Document">
+<title>AspectJ Installation Note</title>
+<STYLE TYPE="text/css">
+<!--
+
+ /* FOR THE SDA PAGE */
+
+ /*
+ BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;}
+ */
+
+ A:link {
+ color:#4756AC;
+ }
+ A:visited {
+ color:#60657B;
+ }
+ A:hover {
+ color:red
+ }
+
+ INPUT {font:12px "Courier New", sans-serif;}
+
+ H2 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H3 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H4 {
+ font:15px/16px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:140%;
+ }
+ P {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .paragraph {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ LI {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ /*
+ UL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }*/
+
+ DL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ B { font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:140%;
+ }
+ .footer {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#888888;
+ text-align:left
+ }
+ .figureTitle {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ text-align:center
+ }
+ .copyrightNotice {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#999999;
+ line-height:110%;
+ }
+ .smallHeading {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:110%;
+ }
+ .tinyHeading {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:120%;
+ }
+ .newsText {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .fancyHeading {
+ font:20px/20px Chantilly, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ color:#6f7a92;
+ margin-left: 10px;
+ line-height:130%;
+ }
+
+-->
+</STYLE>
+</head>
+
+<BODY BGCOLOR="white">
+
+<h3 align="center">AspectJ Demo</h3>
+
+<h4>1. Installing the Demo</h4>
+
+<ul>
+ <li>Extract the contents of &quot;aspectj-demo.zip&quot; to
+ &quot;C:\aspectj-demo&quot;, resulting in the following directory structure:
+ <ul>
+ <li>C:\aspectj-demo
+ <ul>
+ <li>apps</li>
+ <li>bin</li>
+ <li>examples</li>
+ <li>slides</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>Verify that JBuilder 4 is using the correct project by opening it, closing
+ all of the current projects
+ <ul>
+ <li>Under the &quot;File&quot; menu select &quot;Close Projects...&quot;,
+ select all of the open projects and close them</li>
+ <li>Under the &quot;File&quot; menu select &quot;Open Project...&quot;,
+ and open &quot;C:\aspectj-demo\examples\jbuilder\Spacewar.jpr&quot;</li>
+ <li>You should now be able to compile &quot;Spacewar&quot;.&nbsp; If
+ ajdeForJBuilder reports any problems refer to
+ &quot;C:\aspectj-demo\apps\aspectj0.8\doc\primer\tools\ajdeForJBuilder.html&quot;</li>
+ </ul>
+ </li>
+ <li>Set up your &quot;Windows Taskbar&quot; to be permanently visible by
+ right-clicking the bar, selecting &quot;Properties&quot;, and un-checking
+ &quot;Auto hide&quot;</li>
+ <li>From your &quot;Windows Explorer&quot; drag the
+ &quot;C:\aspectj-demo\bin\Demo&quot; folder to the &quot;Windows
+ Taskbar&quot;.&nbsp; This will have the effect of placing the demo buttons
+ on the taskbar.&nbsp; To remove the buttons drag off the &quot;Demo&quot;
+ toolbar and close the resulting floating toolbar window.</li>
+ <li>It is useful to have the &quot;Task Manager&quot; running in the
+ &quot;System Tray&quot; during the demo in order to see when the debugger is
+ loading since it is slow.&nbsp; To launch it right-click the &quot;Windows
+ Taskbar&quot; and select &quot;Task Manager&quot;, then minimize the window.
+ </li>
+</ul>
+<h4>2. Initial Setup</h4>
+<ul>
+ <li>Emacs Setup
+ <ul>
+ <li>Click &quot;Emacs&quot;, and move the cursor to the beginning of the
+ &quot;spacewar.Ship.fire&quot; method</li>
+ </ul>
+ </li>
+ <li>JBuilder Setup
+ <ul>
+ <li>Click &quot;JBuilder&quot;, open the &quot;AspectJ Structure
+ View&quot;, and bring the editor to the &quot;spacewar.Ship.fire&quot;
+ method</li>
+ <li>under the &quot;Spacewar.jpr&quot; node in the &quot;Project
+ Explorer&quot; (left pane of main window) expand the &quot;spacewar&quot;
+ package to see its classes</li>
+ <li>ensure that the last compile was done without &quot;Debug.java&quot;
+ in the build configuration</li>
+ </ul>
+ </li>
+ <li>Forte Setup
+ <ul>
+ <li>Click &quot;Forte&quot;, click the &quot;AspectJ Structure View&quot;
+ button, and navigate the editor to the &quot;spacewar.EnsureShipIsAlive&quot;
+ class </li>
+ </ul>
+ </li>
+ <li>AJDoc Setup
+ <ul>
+ <li>click &quot;AJDoc&quot;, browse to the &quot;spacewar/Ship.java&quot;
+ class</li>
+ </ul>
+ </li>
+</ul>
+<h4>3. Running the Demo</h4>
+<ul>
+ <li>Emacs
+ <ul>
+ <li>At the declaration of the &quot;spacewar.Ship.fire&quot; method hit
+ &quot;&lt;cntrl&gt;x, &lt;cntrl&gt;j&quot;</li>
+ <li>Follow the resulting popup menu to the &quot;EnsureShipIsAlive&quot;
+ advice</li>
+ <li>Navigate back to &quot;spacewar.Ship.fire&quot; using the same method</li>
+ </ul>
+ </li>
+ <li>JBuilder
+ <ul>
+ <li>Navigation
+ <ul>
+ <li>In the &quot;Structure View&quot; select the &quot;fire&quot;
+ method and expand it's children to reveal &quot;EnsureShipIsAlive:
+ around...&quot;</li>
+ <li>Double-click &quot;EnsureShipIsAlive: around...&quot; to navigate
+ to that advice declaration</li>
+ <li>Navigate back using the same method, or using the
+ &quot;Back&quot;, then &quot;Forward&quot; method in conjuntion with
+ the structure tree (this navigation can also be done by
+ right-clicking the inline advice icons in the editor's gutter)</li>
+ </ul>
+ </li>
+ <li>Compilation
+ <ul>
+ <li>In &quot;EnsureShipIsAlive&quot; remove &quot;ship&quot; from the
+ &quot;proceed(ship)&quot; call and recompile.</li>
+ <li>When the error message pops up fix it by replacing
+ &quot;ship&quot;</li>
+ </ul>
+ </li>
+ <li>Build Configuration
+ <ul>
+ <li>Double-click &quot;Default.lst&quot; and select the &quot;lst
+ Designer&quot; tab at the bottom of the editor pane</li>
+ <li>Expand the &quot;spacewar&quot; node</li>
+ <li>Click &quot;Debug.java&quot; in order to add it to the
+ configuration</li>
+ <li>Navigate to the &quot;Ship.java&quot; class so that the effects of
+ the new compilation are visible in the &quot;Structure View&quot;
+ when the compilation completes</li>
+ <li>Compile &quot;Default.lst&quot;</li>
+ <li>Run the project (top the execution of the project by clicking the
+ red stop button in the run messages pane)</li>
+ </ul>
+ </li>
+ <li>Debugging
+ <ul>
+ <li>Start the debugger</li>
+ <li>When the &quot;Please select launch parameters...&quot; dialog
+ pops up click &quot;OK&quot;</li>
+ <li>Select the &quot;Classes&quot; tab (4th tab from the top)</li>
+ <li>When the game starts, expand &quot;spacewar&quot;, expand &quot;Ship.java&quot;</li>
+ <li>Browse to the &quot;fire&quot; method and expand it</li>
+ <li>Right-click on the &quot;fire&quot; method and select &quot;stop
+ in spaceawar.Ship.fire&quot;</li>
+ <li>Wait for the breakpoint to be hit</li>
+ <li>Use the &quot;Step Into&quot; button (5th button on the bottom
+ from the left) to single step the file until you step through the
+ advice and into the body of the fire method</li>
+ <li>Click the red stop button (1st button) in order to stop the
+ debugging</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>Forte
+ <ul>
+ <li>Currently no Forte demo (fyi: navigate the structure the same way as
+ in JBuilder, and right-click the LST files to compile them, right click
+ &quot;Game.java&quot; to execute it)</li>
+ </ul>
+ </li>
+ <li>AJDoc
+ <ul>
+ <li>Scroll down to the &quot;fire&quot; method, and follow it's
+ &quot;Advised by: &quot; link to get to the &quot;EnsureShipIsAlive&quot;
+ aspect</li>
+ </ul>
+ </li>
+</ul>
+<p>&nbsp;</p>
+
+
+</body>
+
+</html>
diff --git a/docs/modules/ROOT/pages/teaching/demos/oopsla2002-script.html b/docs/modules/ROOT/pages/teaching/demos/oopsla2002-script.html
new file mode 100644
index 000000000..310505196
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/oopsla2002-script.html
@@ -0,0 +1,671 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="oopsla2002-script_files/filelist.xml">
+<title>demo: OO IDE</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Author>Mik Kersten</o:Author>
+ <o:LastAuthor>Mik Kersten</o:LastAuthor>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>91</o:TotalTime>
+ <o:LastPrinted>2002-09-06T19:46:00Z</o:LastPrinted>
+ <o:Created>2003-11-11T03:52:00Z</o:Created>
+ <o:LastSaved>2003-11-11T03:52:00Z</o:LastSaved>
+ <o:Pages>1</o:Pages>
+ <o:Words>320</o:Words>
+ <o:Characters>1829</o:Characters>
+ <o:Company>Xerox PARC</o:Company>
+ <o:Lines>15</o:Lines>
+ <o:Paragraphs>4</o:Paragraphs>
+ <o:CharactersWithSpaces>2145</o:CharactersWithSpaces>
+ <o:Version>11.5606</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:Compatibility>
+ <w:BreakWrappedTables/>
+ <w:SnapToGridInCell/>
+ <w:WrapTextWithPunct/>
+ <w:UseAsianBreakRules/>
+ <w:UseWord2002TableStyleRules/>
+ </w:Compatibility>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+ {font-family:Courier;
+ panose-1:2 7 4 9 2 2 5 2 4 4;
+ mso-font-alt:"Courier New";
+ mso-font-charset:0;
+ mso-generic-font-family:modern;
+ mso-font-format:other;
+ mso-font-pitch:fixed;
+ mso-font-signature:3 0 0 0 1 0;}
+@font-face
+ {font-family:Wingdings;
+ panose-1:5 0 0 0 0 0 0 0 0 0;
+ mso-font-charset:2;
+ mso-generic-font-family:auto;
+ mso-font-pitch:variable;
+ mso-font-signature:0 268435456 0 0 -2147483648 0;}
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
+@font-face
+ {font-family:Verdana;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:536871559 0 0 0 415 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoHeader, li.MsoHeader, div.MsoHeader
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ tab-stops:center 3.0in right 6.0in;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoFooter, li.MsoFooter, div.MsoFooter
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ tab-stops:center 3.0in right 6.0in;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+ /* Page Definitions */
+ @page
+ {mso-footnote-separator:url("oopsla2002-script_files/header.html") fs;
+ mso-footnote-continuation-separator:url("oopsla2002-script_files/header.html") fcs;
+ mso-endnote-separator:url("oopsla2002-script_files/header.html") es;
+ mso-endnote-continuation-separator:url("oopsla2002-script_files/header.html") ecs;}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:.5in 1.25in .5in 1.25in;
+ mso-header-margin:.2in;
+ mso-footer-margin:.2in;
+ mso-header:url("oopsla2002-script_files/header.html") h1;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+ /* List Definitions */
+ @list l0
+ {mso-list-id:68115525;
+ mso-list-type:hybrid;
+ mso-list-template-ids:858938398 1703206876 -2139089146 -2064071216 1691643238 1804361448 1106935208 795498688 1114022646 513440110;}
+@list l0:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+@list l1
+ {mso-list-id:149487999;
+ mso-list-type:hybrid;
+ mso-list-template-ids:996163290 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l1:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:40.5pt;
+ mso-level-number-position:left;
+ margin-left:40.5pt;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l2
+ {mso-list-id:285232438;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1431031654 -726899658 -63553996 -873671648 -1949522634 -2029475690 883689166 1438958244 -911152764 -143889788;}
+@list l2:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+@list l3
+ {mso-list-id:666597725;
+ mso-list-type:hybrid;
+ mso-list-template-ids:1496319566 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l3:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:40.5pt;
+ mso-level-number-position:left;
+ margin-left:40.5pt;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l4
+ {mso-list-id:829760420;
+ mso-list-type:hybrid;
+ mso-list-template-ids:697599534 737209016 718337656 126128176 699144238 -186582856 2015656828 -573567698 -98694796 -102872622;}
+@list l4:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+@list l5
+ {mso-list-id:1175682958;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1913763548 1683933168 -207477172 -1896716198 -1685027206 1819944446 78184194 2140690680 2113166228 -1703233950;}
+@list l5:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+@list l6
+ {mso-list-id:1372803880;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1464406574 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l6:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:40.5pt;
+ mso-level-number-position:left;
+ margin-left:40.5pt;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l7
+ {mso-list-id:1447773079;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1699440192 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l7:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l8
+ {mso-list-id:1451361852;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1759205440 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l8:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:40.5pt;
+ mso-level-number-position:left;
+ margin-left:40.5pt;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l9
+ {mso-list-id:1524708695;
+ mso-list-type:hybrid;
+ mso-list-template-ids:343073212 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l9:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l10
+ {mso-list-id:1659534521;
+ mso-list-type:hybrid;
+ mso-list-template-ids:291794924 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
+@list l10:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:\F0B7;
+ mso-level-tab-stop:40.5pt;
+ mso-level-number-position:left;
+ margin-left:40.5pt;
+ text-indent:-.25in;
+ font-family:Symbol;}
+@list l11
+ {mso-list-id:1796213947;
+ mso-list-type:hybrid;
+ mso-list-template-ids:286165626 -348468910 -768843216 1184416038 1188434802 1919294230 -1935737384 -448084024 -1107797042 -1968251254;}
+@list l11:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+@list l12
+ {mso-list-id:1823081790;
+ mso-list-type:hybrid;
+ mso-list-template-ids:-1570481774 -1554755134 -381011836 -1997633904 -940664112 -1372821974 -923489310 2081716164 235678500 2136529842;}
+@list l12:level1
+ {mso-level-number-format:bullet;
+ mso-level-text:•;
+ mso-level-tab-stop:.5in;
+ mso-level-number-position:left;
+ text-indent:-.25in;
+ font-family:"Times New Roman";}
+ol
+ {margin-bottom:0in;}
+ul
+ {margin-bottom:0in;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
+ mso-para-margin:0in;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<div align=center>
+
+<table class=MsoNormalTable border=0 cellspacing=3 cellpadding=0 width=709
+ style='width:531.65pt;mso-cellspacing:2.2pt;margin-left:-7.95pt;mso-padding-alt:
+ 1.5pt 1.5pt 1.5pt 1.5pt'>
+ <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:14.3pt'>
+ <td width=703 colspan=3 style='width:527.25pt;background:#C8CEDC;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:14.3pt'>
+ <p class=MsoNormal align=center style='mso-margin-top-alt:auto;margin-right:
+ 7.5pt;mso-margin-bottom-alt:auto;margin-left:4.5pt;text-align:center;
+ line-height:130%'><b><span style='font-size:8.5pt;line-height:130%;
+ font-family:Verdana;color:#383E4C'>demo: object-oriented IDE</span></b><span
+ style='font-size:8.5pt;line-height:130%;font-family:Verdana'><o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:1;height:33.45pt'>
+ <td width=703 colspan=3 style='width:527.25pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <ul style='margin-top:0in' type=disc>
+ <li class=MsoNormal style='mso-list:l9 level1 lfo7;tab-stops:list .5in'><span
+ style='font-size:10.0pt;font-family:Tahoma'>good at showing hierarchical
+ OO structure…<o:p></o:p></span></li>
+ </ul>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:2;height:10.45pt'>
+ <td width=703 colspan=3 style='width:527.25pt;background:#C8CEDC;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:10.45pt'>
+ <p class=MsoNormal align=center style='mso-margin-top-alt:auto;margin-right:
+ 7.5pt;mso-margin-bottom-alt:auto;margin-left:4.5pt;text-align:center;
+ line-height:130%'><b><span style='font-size:8.5pt;line-height:130%;
+ font-family:Verdana;color:#383E4C'>demo: modularize concern</span></b><span
+ style='font-size:8.5pt;line-height:130%;font-family:Verdana'><o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:3;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l8 level1 lfo8;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Show FigureEd running<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l8 level1 lfo8;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Inspect Point.java<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l8 level1 lfo8;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Use joinpoint probe to find<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>call(void figures.Canvas.updateHistory())
+ &amp;&amp; within(*)<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:4;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l1 level1 lfo9;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Describe places that it’s called<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l1 level1 lfo9;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>create aspect (defines a special class that can crosscut other
+ classes)<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l1 level1 lfo9;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>aspect HistoryUpdating <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l1 level1 lfo9;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>write pointcut (has name and parameters)<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>pointcut moves(): <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><span style='mso-tab-count:1'>    </span>call(void
+ Line.setP1(Point)) || <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><span style='mso-tab-count:1'>    </span>call(void
+ Line.setP2(Point));<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:5;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>write after advice (runs “on the way back out”)<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>after() returning: move() { <br>
+ <span style='mso-spacerun:yes'>   </span>&lt;runs after each move&gt; }<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:6;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>extend advice to Point setters (multi-class)<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>call(void FigureElement+.set*(..))<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:7;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>capture context &amp; use interface<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>move(FigureElement fe): target(fe) &amp;&amp;..<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:8;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Show structure, note that SlothfulPoint is now included<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Run &amp; show effect<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><o:p>&nbsp;</o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:9;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Show Point.moveBy history violoation<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l6 level1 lfo10;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Want to make sure that sets of private fields of classes implementing
+ FigureElement only happen from within the set methods<b style='mso-bidi-font-weight:
+ normal'><o:p></o:p></b></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'>declare warning: <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><span style='mso-spacerun:yes'>   
+ </span>set(private * FigureElement+.*) <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><span style='mso-spacerun:yes'>   
+ </span>&amp;&amp; !(withincode(* FigureElement+.set*(..)) || <span
+ style='mso-tab-count:1'>     </span><span style='mso-spacerun:yes'>  </span><span
+ style='mso-tab-count:2'>        </span><span
+ style='mso-spacerun:yes'>  </span>withincode(FigureElement+.new(..))):<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:Courier;
+ mso-bidi-font-family:Tahoma'><span style='mso-spacerun:yes'>   
+ </span>&quot;should only assign to fields from set methods&quot;;<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:10;height:33.45pt'>
+ <td width=253 style='width:189.7pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l3 level1 lfo13;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Write before advice that does precondition checking on Points.<o:p></o:p></span></p>
+ </td>
+ <td width=447 colspan=2 style='width:335.35pt;background:#F7F7F7;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:33.45pt'>
+ <p class=MsoNormal style='margin-left:7.5pt'><span style='font-family:"Courier New"'>before(int
+ newValue): <br>
+ <span style='mso-spacerun:yes'>    </span>set(int Point.*) &amp;&amp;
+ args(newValue) {<br>
+ &nbsp;&nbsp;&nbsp; if (newValue &lt; 0) {<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new IAE(&quot;too
+ small&quot;);<br>
+ &nbsp;&nbsp;&nbsp; } <br>
+ }</span><span style='font-size:10.0pt;font-family:Tahoma'><o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:11;height:15.85pt'>
+ <td width=703 colspan=3 style='width:527.25pt;background:#C8CEDC;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:15.85pt'>
+ <p class=MsoNormal align=center style='mso-margin-top-alt:auto;margin-right:
+ 7.5pt;mso-margin-bottom-alt:auto;margin-left:4.5pt;text-align:center;
+ line-height:130%'><b><span style='font-size:8.5pt;line-height:130%;
+ font-family:Verdana;color:#383E4C'>demo: pluggable aspects</span></b><span
+ style='font-size:8.5pt;line-height:130%;font-family:Verdana'><o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:12;height:33.45pt'>
+ <td width=350 colspan=2 style='width:262.5pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l10 level1 lfo12;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>World’s first fully interactive video game, now 41 years old..<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l10 level1 lfo12;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Explain spacewar <o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:40.5pt;text-indent:-.25in;mso-list:
+ l10 level1 lfo12;tab-stops:list 40.5pt'><![if !supportLists]><span
+ style='font-size:10.0pt;font-family:Symbol;mso-fareast-font-family:Symbol;
+ mso-bidi-font-family:Symbol'><span style='mso-list:Ignore'>·<span
+ style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ </span></span></span><![endif]><span style='font-size:10.0pt;font-family:
+ Tahoma'>Launch with Ship.java and &quot;Release.lst&quot; selected and compiled.<span
+ style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
+ </td>
+ <td width=350 style='width:262.55pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <ul style='margin-top:0in' type=disc>
+ <li class=MsoNormal style='mso-list:l7 level1 lfo11;tab-stops:list .5in'><span
+ style='font-size:10.0pt;font-family:Tahoma'>Run <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l7 level1 lfo11;tab-stops:list .5in'><span
+ style='font-size:10.0pt;font-family:Tahoma'>Show debug configuration in
+ config designer<o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l7 level1 lfo11;tab-stops:list .5in'><span
+ style='font-size:10.0pt;font-family:Tahoma'>Select
+ &quot;Debug.lst&quot;, compile, and run again <o:p></o:p></span></li>
+ <li class=MsoNormal style='mso-list:l7 level1 lfo11;tab-stops:list .5in'><span
+ style='font-size:10.0pt;font-family:Tahoma'>Show debug window, menu, and
+ method tracing<o:p></o:p></span></li>
+ </ul>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:13;height:13.15pt'>
+ <td width=703 colspan=3 style='width:527.25pt;background:#C8CEDC;padding:
+ 1.5pt 1.5pt 1.5pt 1.5pt;height:13.15pt'>
+ <p class=MsoNormal align=center style='mso-margin-top-alt:auto;margin-right:
+ 7.5pt;mso-margin-bottom-alt:auto;margin-left:4.5pt;text-align:center;
+ line-height:130%'><b><span style='font-size:8.5pt;line-height:130%;
+ font-family:Verdana;color:#383E4C'>demo: crosscutting structure</span></b><span
+ style='font-size:8.5pt;line-height:130%;font-family:Verdana'><o:p></o:p></span></p>
+ </td>
+ </tr>
+ <tr style='mso-yfti-irow:14;mso-yfti-lastrow:yes;height:33.45pt'>
+ <td width=350 colspan=2 style='width:262.5pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Explain
+ annotations over program structure<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Explain
+ links and associations, inheritance links<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Explain
+ model genericity, different views<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Show
+ inline annotations<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Show
+ history navigation<o:p></o:p></span></p>
+ </td>
+ <td width=350 style='width:262.55pt;background:#F7F7F7;padding:1.5pt 1.5pt 1.5pt 1.5pt;
+ height:33.45pt'>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Show
+ global views (multiple views of your code)<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Show
+ refactoring by changing helmCommandsCut<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Show view
+ synchronization, task-oriented views<o:p></o:p></span></p>
+ <p class=MsoNormal style='margin-left:4.5pt'><span style='font-size:10.0pt;
+ font-family:Tahoma'>•<span style='mso-tab-count:1'>         </span>Discuss
+ how it is harder in AJ (implicit invocation)<o:p></o:p></span></p>
+ <p class=MsoNormal><span style='font-size:10.0pt;font-family:Tahoma'><span
+ style='mso-spacerun:yes'>  </span>•<span style='mso-tab-count:1'>         </span>Show
+ fluid documents (ISTL project)<o:p></o:p></span></p>
+ </td>
+ </tr>
+ <![if !supportMisalignedColumns]>
+ <tr height=0>
+ <td width=257 style='border:none'></td>
+ <td width=97 style='border:none'></td>
+ <td width=354 style='border:none'></td>
+ </tr>
+ <![endif]>
+</table>
+
+</div>
+
+<p class=MsoNormal style='margin-right:-45.0pt'><o:p>&nbsp;</o:p></p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/docs/modules/ROOT/pages/teaching/demos/oopsla2002.ppt b/docs/modules/ROOT/pages/teaching/demos/oopsla2002.ppt
new file mode 100644
index 000000000..a805574e8
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/oopsla2002.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/demos/oopsla2003.ppt b/docs/modules/ROOT/pages/teaching/demos/oopsla2003.ppt
new file mode 100644
index 000000000..41948b827
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/oopsla2003.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/demos/oopsla2004.ppt b/docs/modules/ROOT/pages/teaching/demos/oopsla2004.ppt
new file mode 100644
index 000000000..e289528a5
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/oopsla2004.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/demos/readme.txt b/docs/modules/ROOT/pages/teaching/demos/readme.txt
new file mode 100644
index 000000000..24b267deb
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/readme.txt
@@ -0,0 +1,6 @@
+
+The following folders can be checked out as Eclipse projects:
+
+* figures: refactoring a simple modularity problem in a figure editor
+
+* spacewar: pluggable debug aspect is good for showing build configurations \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/debug.lst b/docs/modules/ROOT/pages/teaching/demos/spacewar/debug.lst
new file mode 100644
index 000000000..fc161a751
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/debug.lst
@@ -0,0 +1,27 @@
+src/coordination/Condition.java
+src/coordination/CoordinationAction.java
+src/coordination/Coordinator.java
+src/coordination/Exclusion.java
+src/coordination/MethodState.java
+src/coordination/Mutex.java
+src/coordination/Selfex.java
+src/coordination/TimeoutException.java
+src/spacewar/Bullet.java
+src/spacewar/Debug.java
+src/spacewar/Display.java
+src/spacewar/Display1.java
+src/spacewar/Display2.java
+src/spacewar/EnergyPacket.java
+src/spacewar/EnergyPacketProducer.java
+src/spacewar/EnsureShipIsAlive.java
+src/spacewar/Game.java
+src/spacewar/GameSynchronization.java
+src/spacewar/Pilot.java
+src/spacewar/Player.java
+src/spacewar/Registry.java
+src/spacewar/RegistrySynchronization.java
+src/spacewar/Robot.java
+src/spacewar/SWFrame.java
+src/spacewar/Ship.java
+src/spacewar/SpaceObject.java
+src/spacewar/Timer.java
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/readme.html b/docs/modules/ROOT/pages/teaching/demos/spacewar/readme.html
new file mode 100644
index 000000000..7b1a75e3e
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/readme.html
@@ -0,0 +1,157 @@
+
+<head>
+<style>
+<!--
+ table.MsoNormalTable
+ {mso-style-parent:"";
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ }
+-->
+</style>
+<STYLE TYPE="text/css">
+<!--
+
+ /* FOR THE SDA PAGE */
+
+ /*
+ BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;}
+ */
+
+ A:link {
+ color:#4756AC;
+ }
+ A:visited {
+ color:#60657B;
+ }
+ A:hover {
+ color:red
+ }
+
+ INPUT {font:12px "Courier New", sans-serif;}
+
+ H2 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H3 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H4 {
+ font:15px/16px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:140%;
+ }
+ P {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .paragraph {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ LI {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ /*
+ UL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }*/
+
+ DL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ B { font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:140%;
+ }
+ .footer {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#888888;
+ text-align:left
+ }
+ .figureTitle {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ text-align:center
+ }
+ .copyrightNotice {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#999999;
+ line-height:110%;
+ }
+ .smallHeading {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:110%;
+ }
+ .tinyHeading {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:120%;
+ }
+ .newsText {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .fancyHeading {
+ font:20px/20px Chantilly, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ color:#6f7a92;
+ margin-left: 10px;
+ line-height:130%;
+ }
+
+-->
+</STYLE>
+</head>
+
+<h2 align="center">AspectJ Spacewar Demo Instructions</h2>
+<h4>Script</h4>
+<p>Many possible things to show here, the following focuses on pluggable aspects
+and build configurations:</p>
+<ul>
+ <li>World’s first fully interactive video game, now 41 years old.</li>
+ <li>Explain spacewar </li>
+ <li>Launch with Ship.java and &quot;Release.lst&quot; selected and compiled. </li>
+ <li>Run </li>
+ <li>Show debug configuration in config designer</li>
+ <li>Select &quot;Debug.lst&quot;, compile, and run again </li>
+ <li>Show debug window, menu, and method tracing</li>
+</ul>
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/release.lst b/docs/modules/ROOT/pages/teaching/demos/spacewar/release.lst
new file mode 100644
index 000000000..a6b75a000
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/release.lst
@@ -0,0 +1,26 @@
+src/coordination/Condition.java
+src/coordination/CoordinationAction.java
+src/coordination/Coordinator.java
+src/coordination/Exclusion.java
+src/coordination/MethodState.java
+src/coordination/Mutex.java
+src/coordination/Selfex.java
+src/coordination/TimeoutException.java
+src/spacewar/Bullet.java
+src/spacewar/Display.java
+src/spacewar/Display1.java
+src/spacewar/Display2.java
+src/spacewar/EnergyPacket.java
+src/spacewar/EnergyPacketProducer.java
+src/spacewar/EnsureShipIsAlive.java
+src/spacewar/Game.java
+src/spacewar/GameSynchronization.java
+src/spacewar/Pilot.java
+src/spacewar/Player.java
+src/spacewar/Registry.java
+src/spacewar/RegistrySynchronization.java
+src/spacewar/Robot.java
+src/spacewar/SWFrame.java
+src/spacewar/Ship.java
+src/spacewar/SpaceObject.java
+src/spacewar/Timer.java
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Condition.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Condition.java
new file mode 100644
index 000000000..18bbafee2
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Condition.java
@@ -0,0 +1,37 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+/**
+ * Interface for pre-conditions that are passed to guardedEntry methods of
+ * Coordinator.
+ * Conditions should be passed as anonymous classes that simply implement
+ * the checkit method.
+ *
+ */
+public interface Condition {
+
+ /**
+ * This method is called automatically by Coordinator.guardedEntry(...)
+ * and it's called everytime the coordination state changes.
+ */
+
+ public boolean checkit();
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/CoordinationAction.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/CoordinationAction.java
new file mode 100644
index 000000000..7825b95b7
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/CoordinationAction.java
@@ -0,0 +1,37 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+/**
+ * Interface for coordination actions that are passed to guardedEntry methods of
+ * Coordinator.
+ * Coordination actions should be passed as anonymous classes that simply
+ * implement the doit method.
+ *
+ */
+public interface CoordinationAction {
+ /**
+ * This method is called by Coordinator.guardedEntry(...) and
+ * Coordinator.guardedExit(...). Use it for changing coordination state
+ * upon entering and exiting methods.
+ */
+
+ public void doit();
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Coordinator.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Coordinator.java
new file mode 100644
index 000000000..ea0522d6b
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Coordinator.java
@@ -0,0 +1,449 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.util.*; //!!!
+
+/**
+ * The Coordinator class provides the basic functionality for synchronizing
+ * and coordinating different threads upon entering and exiting methods.
+ * It can be used in two different ways:
+ * 1) by instantiating regular coordinator objects that are used by aspects; or
+ * 2) by extending it (sub-classing) with coordinator aspects.
+ * <P>
+ * Method invocations are the smallest units for defining critical sections
+ * and pre-conditions. The use of coordinators, either regular objects or aspect
+ * instances, should always end up by invoking guardedEntry(...) in a
+ * before weave and guardedExit(...) in an after weave for all methods that
+ * need coordination. guardedEntry and guardedExit are the methods that
+ * actually manage the synchronization and coordination constraints given
+ * by their parameters and by pre-existent exclusion markers.
+ * <P>
+ * The synchronization of threads for the execution of critical section
+ * methods in an object is done by marking those methods as self- and/or
+ * mutually-exclusive (addSelfex, addMutex).
+ * Just by itself, addSelfex("M") does not enforce the self-exclusion
+ * of method M - enforcement is done by invoking guardedEntry before
+ * M is executed. Similarly, addMutex(new String[] {"M1", "M2"}) does
+ * not enforce the mutual exclusion between methods M1 and M2.
+ * <P>
+ * A guardedEntry on a method that has been marked as self-exclusive
+ * ensures that the method is executed in the invoked object by only one thread
+ * at a time. A guardedEntry on a method that has been marked has mutually-
+ * exclusive with other methods ensures that the execution of that method
+ * by a thread in the invoked object temporarily blocks the execution by
+ * other threads of the methods that are in the same mutex set.
+ * <P>
+ * The coordination of threads, i.e. their explicit suspension and
+ * resumption, is done through the use of pre-conditions and coordination
+ * actions that are passed as parameters to guardedEntry and guardedExit
+ * with the form of anonymous classes.
+ */
+public abstract aspect Coordinator {
+ private Hashtable methods = null;
+ private Vector exclusions = null;
+
+ abstract protected pointcut synchronizationPoint();
+
+ public Coordinator() {
+ methods = new Hashtable();
+ exclusions = new Vector(5);
+ }
+
+ before (): synchronizationPoint() {
+ this.guardedEntry(thisJoinPointStaticPart.getSignature().getName());
+ }
+
+ after (): synchronizationPoint() {
+ this.guardedExit(thisJoinPointStaticPart.getSignature().getName());
+ }
+
+ /**
+ * Takes a multi-part method name (eg "BoundedBuffer.put")
+ * and marks that method as self-exclusive.
+ * No checks are made with respect to the existence of the method
+ * whose name is given.
+ */
+ public synchronized void addSelfex(String methName) {
+ Selfex sex = new Selfex (methName);
+
+ // update db of all exclusions in this coordinator
+ exclusions.addElement(sex);
+
+ // update local info in method
+ Method aMeth = getOrSetMethod(methName);
+ aMeth.addExclusion(sex);
+ }
+
+ /**
+ * Takes a multi-part method name (e.g. "BoundedBuffer.put")
+ * and removes that method from the list of self-exclusive methods.
+ */
+ public synchronized void removeSelfex(String methName) {
+ for (int i = 0; i < exclusions.size(); i++) {
+ Exclusion sex = (Exclusion)exclusions.elementAt(i);
+ if ((sex instanceof Selfex) &&
+ (((Selfex)sex).methodName.equals(methName))) {
+
+ // update db of all exclusions in this coordinator
+ exclusions.removeElementAt(i);
+
+ // update local info in method
+ Method aMeth = getOrSetMethod(methName);
+ aMeth.removeExclusion(sex);
+ }
+ }
+ }
+
+ /**
+ * Takes an array of multi-part method names and marks those
+ * methods as mutually exclusive.
+ * No checks are made with respect to the existence of the methods
+ * whose names are given.
+ */
+ public synchronized void addMutex(String[] methNames) {
+ Mutex mux = new Mutex(methNames);
+
+ // update db of all exclusions in this coordinator
+ exclusions.addElement(mux);
+
+ // update local info in each method
+ for (int i = 0; i < methNames.length; i++) {
+ Method aMeth = getOrSetMethod(methNames[i]);
+ aMeth.addExclusion(mux);
+ }
+ }
+
+ /**
+ * Takes an array of multi-part method names that correspond
+ * to an existing mutex set and remove the mutual exclusion constraint.
+ * If the given mutex set does not exist, removeMutex does nothing.
+ */
+ public synchronized void removeMutex(String[] methNames) {
+ for (int i = 0; i < exclusions.size(); i++) {
+ Exclusion mux = (Exclusion)exclusions.elementAt(i);
+ if (mux instanceof Mutex) {
+ boolean same = true;
+ for (int j = 0; j < methNames.length; j++)
+ if (!methNames[j].equals(((Mutex)mux).methodNames[j]))
+ same = false;
+ if (same) {
+ // update db of all exclusions in this coordinator
+ exclusions.removeElementAt(i);
+
+ // update local info in each method involved
+ for (int j = 0; j < methNames.length; j++) {
+ Method aMeth = getOrSetMethod(methNames[j]);
+ aMeth.removeExclusion(mux);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, only the method name is given. The only constraints
+ * checked are the exclusion constraints.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ */
+ public synchronized void guardedEntry(String methName) {
+ guardedEntry(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, null);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but the given method is executed
+ * only when the given condition is true.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a condition.
+ * The constraints checked are the exclusion constraints and whether
+ * the given condition is true.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * If the condition is false, guardedEntry suspends the current thread.
+ * That thread remains suspended until the condition becomes true, in
+ * which case all constraints are rechecked before the method is executed.
+ * When all exclusion constraints are checked and the given condition is
+ * true, the given method is executed.
+ */
+ public synchronized void guardedEntry(String methName, Condition condition) {
+ guardedEntry(methName, condition, null);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but with an additional
+ * coordination action that is executed before the given method is
+ * executed.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a coordination action.
+ * The only constraints checked are the exclusion constraints.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * The given coordination action is executed just before the given method
+ * is executed.
+ */
+ public synchronized void guardedEntry(String methName,
+ CoordinationAction action) {
+ guardedEntry(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ },
+ action);
+ }
+
+ /**
+ * Just like guardedEntry(String methName), but the given method is executed
+ * only when the given condition is true; the additional
+ * coordination action that is executed before the given method is
+ * executed.
+ * guardedEntry is the guard for enforcing all synchronization and
+ * coordination constraints of a given method, and it should be called
+ * just before the method is executed.
+ * In this form, the method name is given along with a condition and
+ * a coordination action.
+ * The constraints checked are the exclusion constraints and whether the
+ * given condition is true.
+ * If the method was previousely marked as selfex (through addSelfex),
+ * guardedEntry ensures that the method is executed only when no other
+ * thread is executing it.
+ * If the method was previousely marked as being in one or more mutex
+ * sets, guardedEntry ensures that the method is executed only when no other
+ * thread is executing any of the methods with which the give method is
+ * mutexed.
+ * If the condition is false, guardedEntry suspends the current thread.
+ * That thread remains suspended until the condition becomes true, in
+ * which case all constraints are rechecked before the method is executed.
+ * When all exclusion constraints are checked and the given condition is
+ * true, the given method is executed.
+ * The given coordination action is executed just before the given method
+ * is executed.
+ */
+ public synchronized void guardedEntry(String methName,
+ Condition condition,
+ CoordinationAction action) {
+ Method aMeth = getOrSetMethod(methName);
+ boolean canGo = false;
+
+ // test pre-conditions for entering the method
+ while (!canGo) {
+ canGo = true;
+ for (int i = 0; i < aMeth.exes.size() && canGo; i++)
+ if (!((Exclusion)aMeth.exes.elementAt(i)).testExclusion(aMeth.name)) {
+ canGo = false;
+ }
+ if (canGo && !condition.checkit()) {
+ canGo = false;
+ }
+ if (!canGo)
+ try {
+ wait();
+ } catch (InterruptedException e) { }
+ }
+
+ // OK.
+ enterMethod(aMeth, action);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, null, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ Condition condition,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, condition, null, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ CoordinationAction action,
+ long millis)
+ throws TimeoutException {
+ guardedEntryWithTimeout(methName, new Condition() {
+ public boolean checkit() {
+ return true;
+ }
+ }, action, millis);
+ }
+
+ /**
+ * This method is similar to guardedEntry, but it takes
+ * an additional parameter - the milliseconds after which any suspension
+ * will abort with a timeout.
+ */
+ public synchronized void guardedEntryWithTimeout(String methName,
+ Condition condition,
+ CoordinationAction action,
+ long millis)
+ throws TimeoutException {
+
+ Method aMeth = getOrSetMethod(methName);
+ boolean canGo = false;
+ long waitTime = millis;
+ long startTime = System.currentTimeMillis();
+
+ // test pre-conditions for entering the method
+ while (!canGo) {
+ canGo = true;
+ for (int i = 0; i < aMeth.exes.size() && canGo; i++)
+ if ((!((Exclusion)aMeth.exes.elementAt(i)).testExclusion(aMeth.name)) ||
+ (!condition.checkit())) {
+ canGo = false;
+ }
+ if (!canGo) {
+ try {
+ wait(waitTime);
+ } catch (InterruptedException e) {}
+
+ long now = System.currentTimeMillis();
+ long timeSoFar = now - startTime;
+ if (timeSoFar >= millis) // timeout!
+ throw new TimeoutException(timeSoFar);
+ else // adjust time
+ waitTime = millis - timeSoFar;
+ }
+ }
+
+ // OK.
+ enterMethod(aMeth, action);
+ }
+
+ /**
+ * This method provides the means for updating all synchronization and
+ * coordination state after the execution of a given method, and it should be
+ * called after the method is executed.
+ * In this form, only the method name is given.
+ * The synchronization state for self- and mutual-exclusion is
+ * automatically upadted.
+ */
+ public synchronized void guardedExit(String methName) {
+ guardedExit(methName, null);
+ }
+
+ /**
+ * Just like guardedExit(String methName) but with an additional
+ * coordination action that is executed.
+ * guardedExit provides the means for updating all synchronization and
+ * coordination state after the execution of a given method, and it should be
+ * called after the method is executed.
+ * In this form, the method name is given along with a coordination action.
+ * The synchronization state for self- and mutual-exclusion is
+ * automatically upadted.
+ * The given coordination action is executed.
+ */
+ public synchronized void guardedExit(String methName,
+ CoordinationAction action) {
+ Method aMeth = getOrSetMethod(methName);
+
+ for (int i = 0; i < aMeth.exes.size(); i++)
+ ((Exclusion)aMeth.exes.elementAt(i)).exitExclusion(methName);
+ if (action != null) action.doit();
+ notifyAll();
+ }
+
+ private Method getOrSetMethod(String methName) {
+ Method aMeth = null;
+ if (!methods.containsKey(methName)) {
+ methods.put(methName, (aMeth = new Method(methName)));
+ }
+ else {
+ aMeth = (Method) methods.get(methName);
+ }
+ return aMeth;
+ }
+
+ private void enterMethod(Method aMeth, CoordinationAction action) {
+ for (int i = 0; i < aMeth.exes.size(); i++)
+ ((Exclusion)aMeth.exes.elementAt(i)).enterExclusion(aMeth.name);
+
+ if (action != null) action.doit();
+ }
+
+
+
+}
+
+class Method {
+ String name;
+ Vector exes = new Vector(3);
+
+ Method(String n) {
+ name = n;
+ }
+
+ void addExclusion(Exclusion ex) {
+ exes.addElement(ex);
+ }
+
+ void removeExclusion(Exclusion ex) {
+ for (int i = 0; i < exes.size(); i++) {
+ if (exes.elementAt(i) == ex)
+ exes.removeElementAt(i);
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Exclusion.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Exclusion.java
new file mode 100644
index 000000000..9179cd6e0
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Exclusion.java
@@ -0,0 +1,33 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+interface Exclusion {
+
+ boolean testExclusion(String methodName);
+
+ void enterExclusion(String methodName);
+
+ void exitExclusion(String methodName);
+
+ // for debug !!!
+ void printNames();
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/MethodState.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/MethodState.java
new file mode 100644
index 000000000..03a44378a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/MethodState.java
@@ -0,0 +1,45 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+
+class MethodState {
+
+ Vector threads=new Vector();
+
+ void enterInThread (Thread t) {
+ threads.addElement(t);
+ }
+
+ void exitInThread(Thread t) {
+ threads.removeElement(t);
+ }
+
+ boolean hasOtherThreadThan(Thread t) {
+ Enumeration e = threads.elements();
+ while (e.hasMoreElements())
+ if (e.nextElement() != t)
+ return(true);
+ return (false);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Mutex.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Mutex.java
new file mode 100644
index 000000000..2472137c6
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Mutex.java
@@ -0,0 +1,86 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+import java.lang.String;
+
+
+class Mutex implements Exclusion {
+ String[] methodNames;
+ MethodState[] methodStates;
+
+ String prettyName;
+
+ Mutex (String[] _methodNames) {
+ methodNames = _methodNames;
+ methodStates = new MethodState[methodNames.length];
+ for (int i = 0; i < methodNames.length; i++) {
+ methodStates[i] = new MethodState();
+ }
+ }
+
+ private boolean isMethodIn (String _methodName) {
+ for (int i = 0; i < methodNames.length; i++) {
+ if (_methodName.equals(methodNames[i]))
+ return(true);
+ }
+ return(false);
+ }
+
+ private MethodState getMethodState (String _methodName) {
+ for (int i = 0; i < methodNames.length; i++) {
+ if (_methodName.equals(methodNames[i]))
+ return(methodStates[i]);
+ }
+ return(null);
+ }
+
+ public boolean testExclusion (String _methodName) {
+ Thread ct = Thread.currentThread();
+ //
+ // Loop through each of the other methods in this exclusion set, to be sure
+ // that no other thread is running them. Note that we have to be careful
+ // about selfex.
+ //
+ for (int i = 0; i < methodNames.length; i++) {
+ if (!_methodName.equals(methodNames[i])) {
+ if (methodStates[i].hasOtherThreadThan(ct))
+ return(false);
+ }
+ }
+ return (true);
+ }
+
+ public void enterExclusion (String _methodName) {
+ MethodState methodState = getMethodState(_methodName);
+ methodState.enterInThread(Thread.currentThread());
+ }
+
+ public void exitExclusion (String _methodName) {
+ MethodState methodState = getMethodState(_methodName);
+ methodState.exitInThread(Thread.currentThread());
+ }
+
+ public void printNames() {
+ System.out.print("Mutex names: ");
+ for (int i = 0; i < methodNames.length; i++)
+ System.out.print(methodNames[i] + " ");
+ System.out.println();
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Selfex.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Selfex.java
new file mode 100644
index 000000000..ff73afd61
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/Selfex.java
@@ -0,0 +1,55 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+import java.lang.String;
+
+class Selfex implements Exclusion {
+ String methodName;
+ Thread thread;
+ int count = 0;
+
+ Selfex (String _methodName) {
+ methodName = _methodName;
+ }
+
+ public boolean testExclusion (String _methodName) {
+ if (count == 0)
+ return(true);
+ return (thread == Thread.currentThread());
+ }
+
+ public void enterExclusion (String _methodName) {
+ count++;
+ thread = Thread.currentThread(); // note that if count wasn't 0
+ // we aren't changing thread
+ }
+
+ public void exitExclusion (String _methodName) {
+ count--;
+ if (count == 0) // not stricly necessary, but...
+ thread = null;
+ }
+
+ public void printNames() {
+ System.out.println("Selfex name: " + methodName);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/TimeoutException.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/TimeoutException.java
new file mode 100644
index 000000000..e16aa7f09
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/coordination/TimeoutException.java
@@ -0,0 +1,27 @@
+/* -*- Mode: Java; -*-
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+*/
+
+package coordination;
+
+
+public class TimeoutException extends Exception {
+ long time;
+ TimeoutException(long _time) {
+ time = _time;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Bullet.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Bullet.java
new file mode 100644
index 000000000..6581dbbf7
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Bullet.java
@@ -0,0 +1,48 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Bullet.java
+Part of the Spacewar game.
+
+*/
+
+package spacewar;
+
+class Bullet extends SpaceObject {
+
+ static private final int SIZE = 3; //Can't be changed for now!!!
+ static private int LIFETIME = 50;
+
+ private int lifeLeft;
+
+ Bullet (Game theGame, double xP, double yP, double xV, double yV) {
+ super(theGame, xP, yP, xV, yV);
+ lifeLeft = LIFETIME;
+ }
+
+ int getSize() { return SIZE; }
+
+ void handleCollision(SpaceObject obj) {
+ die();
+ }
+
+ void clockTick() {
+ if (--lifeLeft == 0)
+ die();
+ super.clockTick();
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Debug.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Debug.java
new file mode 100644
index 000000000..d22a2f507
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Debug.java
@@ -0,0 +1,198 @@
+package spacewar;
+
+import java.awt.Menu;
+import java.awt.CheckboxMenuItem;
+import java.awt.Frame;
+import java.awt.TextArea;
+import java.awt.Dimension;
+
+/**
+ * This aspect specifies debugging information to be output to the
+ * information window.
+ *
+ * When the debug aspect is compiled in the Frame menu has several checkbox
+ * items that can be used to control the amount of tracing information
+ * displayed. (By default the first three are off, because they generate
+ * so much information.)
+ *
+ * There are two reasons to gather all this debugging code into an aspect
+ * like this:
+ *
+ * (1) It makes it easier to understand when it is all in one place.
+ *
+ * (2) It means that we can "plug and debug". We can enable/disable
+ * the debugging code simply by weaving or not weaving this
+ * aspect in.
+ *
+ * All in all, this is a lot better than the usual practice of writing
+ * complex debugging code and then deleting it when the bug is found,
+ * only to regret it a month later when a related bug surfaces. (Or even
+ * the same bug!)
+ *
+ * This file also defines a class InfoWin, which it uses to display all the
+ * debugging information.
+ */
+aspect Debug {
+
+ private static InfoWin infoWin = new InfoWin();
+
+ private static Menu menu = new Menu("Debug");
+
+ private static CheckboxMenuItem traceConstructors =
+ new CheckboxMenuItem("trace constructors", false);
+ private static CheckboxMenuItem traceInitializations =
+ new CheckboxMenuItem("trace initializations", false);
+ private static CheckboxMenuItem traceMethods =
+ new CheckboxMenuItem("trace methods", false);
+ private static CheckboxMenuItem traceClockTick =
+ new CheckboxMenuItem("trace clock tick", false);
+ private static CheckboxMenuItem traceRegistry =
+ new CheckboxMenuItem("trace registry", true);
+ private static CheckboxMenuItem traceFireCollideDamage =
+ new CheckboxMenuItem("trace fire, collide, damage", true);
+
+ after() returning (SWFrame frame): call(SWFrame+.new(..)) {
+ menu.add(traceConstructors);
+ menu.add(traceInitializations);
+ menu.add(traceMethods);
+ menu.add(traceClockTick);
+ menu.add(traceRegistry);
+ menu.add(traceFireCollideDamage);
+ frame.getMenuBar().add(menu);
+ }
+
+ /*
+ * all constructors
+ */
+ pointcut allConstructorsCut():
+ call((spacewar.* && !(Debug+ || InfoWin+)).new(..));
+
+ before(): allConstructorsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("begin constructing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ after() returning: allConstructorsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("done constructing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * All dynamic initializations
+ */
+ pointcut allInitializationsCut():
+ initialization((spacewar.* && !(Debug+ || InfoWin+)).new(..));
+
+ before(): allInitializationsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("begin initializing " + thisJoinPoint.getSignature());
+ }
+ }
+ after() returning : allInitializationsCut() {
+ if (traceConstructors.getState()) {
+ infoWin.println("done initializing " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * all methods
+ */
+ pointcut allMethodsCut():
+ execution(* (spacewar.* && !(Debug+ || InfoWin+)).*(..));
+
+ before(): allMethodsCut() {
+ if (traceMethods.getState()) {
+ infoWin.println("entering " + thisJoinPoint.getSignature());
+ }
+ }
+ after() returning : allMethodsCut() {
+ if (traceMethods.getState()) {
+ infoWin.println("exiting " + thisJoinPoint.getSignature());
+ }
+ }
+
+ /*
+ * clock ticks
+ */
+ after(Object obj) returning :
+ (target(obj) && (target(Game) ||
+ target(Registry) ||
+ target(SpaceObject)))
+ && call(void clockTick()) {
+ if (traceClockTick.getState())
+ infoWin.println("ticking " + obj);
+ }
+
+ /*
+ * registry contents
+ */
+ after(Registry registry) returning :
+ target(registry) && (call(void register(..)) ||
+ call(void unregister(..))) {
+ if (traceRegistry.getState())
+ infoWin.println(registry.getTable().size() +
+ " space objects in the registry.");
+ }
+
+ /*
+ * fire, collide, damage
+ */
+ after() returning : call(void Ship.fire()) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println("firing");
+ }
+
+ after(Ship ship, SpaceObject obj) returning :
+ call(void Ship.handleCollision(SpaceObject)) && target(ship) && args(obj) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println(ship + " collides with " + obj);
+ }
+
+ after(Ship shipA, Ship shipB) returning :
+ execution(void Ship.bounce(Ship, Ship)) && args(shipA, shipB) {
+ if (traceFireCollideDamage.getState())
+ infoWin.println(shipA + " bounces with " + shipB);
+ }
+
+ before(Ship ship, double amount):
+ call(void Ship.inflictDamage(double)) && target(ship) && args(amount) {
+ if (traceFireCollideDamage.getState())
+ if (amount > 0)
+ infoWin.println(ship + "gets " +
+ amount + " damage (" +
+ ship.getDamage() + ")");
+ }
+
+}
+
+class InfoWin {
+ private Frame frame;
+ private TextArea info;
+
+ InfoWin() {
+ frame = new Frame("debugging info for spacewar game");
+ info = new TextArea();
+ info.setEditable(false);
+
+ Dimension screenSize = frame.getToolkit().getScreenSize();
+ frame.setSize(250, 600);
+ frame.setLocation(screenSize.width - 250, 0);
+ frame.add(info);
+ frame.show();
+ frame.toFront();
+ }
+
+ void clear() {
+ info.setText("");
+ }
+
+ void println(String line) {
+ info.append(line + "\n");
+ }
+
+ void print(String line) {
+ info.append(line);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display.java
new file mode 100644
index 000000000..b5b9c9421
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display.java
@@ -0,0 +1,166 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.awt.Graphics;
+import java.awt.Canvas;
+import java.awt.Image;
+import java.awt.event.KeyListener;
+
+/**
+ * The display aspects capture the look and feel of the Game in modular
+ * pluggable units.
+ *
+ * The model is that constructing a concrete subclass of Display attaches that
+ * kind of display to the game. It will Display the game as it goes along.
+ * A game can have any number of displays. Any of the displays will accept
+ * keyboard input.
+ *
+ */
+
+class Display extends Canvas {
+
+ private static Vector DISPLAYS = new Vector(2);
+ private static Vector PLAYERS = new Vector(2);
+ private static Pilot pilot1, pilot2;
+
+ Game game;
+ SWFrame frame;
+ Image offImage;
+ Graphics offGraphics;
+
+ Game getGame() { return game; }
+ static Pilot getPilot1() { return pilot1; }
+ static Pilot getPilot2() { return pilot2; }
+
+ Display(Game g) {
+ super();
+ game = g;
+
+ frame = new SWFrame(game, this);
+ DISPLAYS.addElement(this);
+ }
+
+
+ void noticeSizeChange() {
+ initializeOffImage();
+ }
+
+ private void initializeOffImage () {
+ int w = getSize().width;
+ int h = getSize().height;
+ if ( w > 0 & h > 0) {
+ offImage = createImage(w, h);
+ offGraphics = offImage.getGraphics();
+ }
+ }
+
+ /*
+ * In our double buffering scheme, painting just means copying the buffer
+ * to the screen. The Display aspect draws into the buffer.
+ */
+ public void paint(Graphics g) {
+ if (offImage != null)
+ g.drawImage(offImage, 0, 0, null);
+ }
+
+ public void update(Graphics g) {
+ /*
+ * There are 4 steps to this:
+ * - clear the double buffer
+ * - paint the objects into the double buffer
+ * - paint the status into the double buffer
+ * - paint the doublebuffer into the buffer
+ */
+ offGraphics.setColor(getBackground());
+ offGraphics.fillRect(0, 0, getBounds().width, getBounds().height);
+ paintObjects(offGraphics);
+ paintStatus(offGraphics);
+ g.drawImage(offImage, 0, 0, null);
+ }
+
+ void paintObjects(Graphics g) { }
+ void paintStatus(Graphics g) {}
+
+ static aspect DisplayAspect {
+
+ after (String mode) returning (Game game): call(Game+.new(String)) && args(mode) {
+ new Display1(game);
+// new Display2(game);
+
+ if ( mode.equals("1") ) {
+ pilot1 = game.newPlayer(1);
+ }
+ else if ( mode.equals("2") ) {
+ pilot1 = game.newPlayer(1);
+ pilot2 = game.newPlayer(2);
+ }
+ else if (mode. equals("demo")) {
+ pilot1 = game.newRobot(1);
+ pilot2 = game.newRobot(2);
+ } else {
+ game.error("Invalid mode: " + mode);
+ game.quit();
+ }
+ }
+
+
+ /*
+ * I'm not really sure this belongs here.
+ *
+ * Being here what it does is makes the Display aspect
+ * responsible for having the Players couple up to it. That's
+ * kind of nice, but its a bit incomplete, since Player is
+ * really part of the GUI, not part of the core Game.
+ *
+ * In a future re-factoring this will get worked out better.
+ * What will happen is that GUI will be an aspect that has the
+ * core GUI. Each of the different kinds of displays will be
+ * aspects that tie themselves in.
+ */
+ after () returning (Player player): call(Player+.new(..)) {
+ Enumeration elements = DISPLAYS.elements();
+ while ( elements.hasMoreElements() ) {
+ Display display = (Display)elements.nextElement();
+ display.addKeyListener(player);
+ }
+ }
+
+ after() returning (Display display): call(Display+.new(..)) {
+ display.noticeSizeChange();
+ }
+
+ after(Display display) returning (): call(void setSize(..)) && target(display) {
+ display.noticeSizeChange();
+ }
+
+ after() returning : call(void Game.clockTick()) {
+ Enumeration elements = DISPLAYS.elements();
+ while ( elements.hasMoreElements() ) {
+ Display display = (Display)elements.nextElement();
+ display.repaint();
+ }
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display1.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display1.java
new file mode 100644
index 000000000..484a2342a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display1.java
@@ -0,0 +1,203 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display1.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.awt.Graphics;
+import java.awt.Color;
+import java.util.Random;
+
+/**
+ * This is the standard display aspect.
+ */
+class Display1 extends Display {
+ /*
+ * Here's the color scheme for the game. No other places in this file
+ * should say Color.xxx. Instead, that color should be given a symbolic
+ * name here.
+ */
+ private static Color backgroundColor = Color.black;
+ private static Color player1ShipColor = Color.white;
+ private static Color player2ShipColor = Color.gray;
+ private static Color robotShipColor = new Color(0xa00000);
+ private static Color flameColor = Color.red;
+ private static Color shipExplosionColor = Color.red;
+ private static Color bulletColor = Color.green;
+ private static Color energyPacketOuterColor = Color.blue;
+ private static Color energyPacketInnerColor = new Color(0x7070FF);
+ private static Color statusLabelsColor = Color.white;
+ private static Color statusMeterBorderColor = Color.white;
+ private static Color energyStatusMeterColor = Color.blue;
+ private static Color damageStatusMeterColor = Color.red;
+
+
+ Display1(Game game) {
+ super(game);
+ frame.setLocation(20, 20);
+ }
+
+ void noticeSizeChange() {
+ super.noticeSizeChange();
+ setBackground(backgroundColor);
+ }
+
+ void paintObjects(Graphics g) {
+ SpaceObject[] objects = game.getRegistry().getObjects();
+ final int len = objects.length;
+ for (int i = 0; i < len; i++) {
+ objects[i].paint(g);
+ }
+ }
+
+ static aspect SpaceObjectPainting {
+
+ abstract private void SpaceObject.paint(Graphics g);
+
+ /*
+ * Ships are by far and away the most complex of the space Objects
+ * to paint. First off, we need to set the color when the ship
+ * is made.
+ */
+ private Color Ship.color;
+
+ after(Pilot pilot) returning (Ship ship): call(Ship Game.newShip(Pilot)) && args(pilot) {
+ if (pilot.getNumber() == 1)
+ ship.color = player1ShipColor;
+ else if (pilot.getNumber() == 2)
+ ship.color = player2ShipColor;
+ else
+ ship.color = robotShipColor;
+ }
+
+ private void Ship.paint(Graphics g) {
+ final double PI = Math.PI;
+ int[] radius = {15, 12, -4, 12, -9, -15, -9};
+ double[] angle = {0, PI * 3/4, 0, -PI * 3/4, PI/8, 0, -PI/8};
+ int[] x;
+ int[] y;
+
+ Random random = new Random();
+
+ if (this.getDamage() >= this.MAX_DAMAGE) {
+ int lines = 20;
+ x = new int[lines];
+ y = new int[lines];
+ g.setColor(shipExplosionColor);
+ for (int i = 0; i < lines; i++) {
+ x[i] = (int)(this.getXPos()) + random.nextInt() % 20;
+ y[i] = (int)(this.getYPos()) + random.nextInt() % 20;
+ }
+ for (int i = 0; i < lines; i++)
+ g.drawLine(x[i], y[i], x[(i + 1) % lines], y[(i + 1) % lines]);
+ } else {
+ x = new int[7];
+ y = new int[7];
+
+ g.setColor(this.color);
+
+ radius[5] += random.nextInt() % 3;
+ // convert coordinates from polar to cartesian
+ for (int i = 0; i < 7; i++) {
+ x[i] = (int)
+ (this.getXPos() +
+ Math.cos(this.getOrientation() + angle[i]) * radius[i]);
+ y[i] = (int)
+ (this.getYPos() +
+ Math.sin(this.getOrientation() + angle[i]) * radius[i]);
+ }
+
+ // draw the body as a polygon
+ g.drawPolygon(x, y, 4);
+
+ // if the ship is accelerating, draw in a flame
+ if (this.getRAcc() != 0) {
+ g.setColor(flameColor);
+ g.drawLine(x[4], y[4], x[5], y[5]);
+ g.drawLine(x[5], y[5], x[6], y[6]);
+ }
+ }
+ }
+
+ /*
+ * Bullets
+ */
+ private void Bullet.paint(Graphics g) {
+ g.setColor(bulletColor);
+ g.fillOval((int)this.getXPos() - 1,
+ (int)this.getYPos() - 1,
+ 3,
+ 3);
+ }
+
+ /*
+ * energy packets
+ */
+ private void EnergyPacket.paint(Graphics g) {
+ g.setColor(energyPacketOuterColor);
+ g.fillOval((int)this.getXPos() - 5,
+ (int)this.getYPos() - 5,
+ 10, 10);
+ g.setColor(energyPacketInnerColor);
+ g.fillOval((int)this.getXPos() - 2,
+ (int)this.getYPos() - 2,
+ 3, 3);
+ }
+ }
+
+
+ void paintStatus(Graphics g) {
+ int left1 = 60;
+ int top1 = 0;
+
+ int left2 = 200;
+ int top2 = 0;
+
+ g.setColor(statusLabelsColor);
+ g.drawString("energy:", 5, top1 + 15);
+ g.drawString("damage:", 5, top1 + 30);
+
+ if (getPilot1() != null)
+ paintLevels(g, getPilot1().getShip(), top1, left1);
+ if (getPilot2() != null)
+ paintLevels(g, getPilot2().getShip(), top2, left2);
+ }
+
+ static void paintLevels(Graphics g, Ship ship, int top, int left) {
+ if (ship == null)
+ return;
+ else if (ship.isAlive()) {
+ g.setColor(statusMeterBorderColor);
+ g.drawRect(left, top + 6, 101, 10);
+ g.drawRect(left, top + 21, 101, 10);
+ g.setColor(energyStatusMeterColor);
+ g.fillRect(left + 1, top + 7, (int)(ship.getEnergyLevel()*100), 9);
+ g.setColor(damageStatusMeterColor);
+ g.fillRect(left + 1, top + 22, (int)(ship.getDamageLevel()*100), 9);
+ }
+ else {
+ g.setColor(damageStatusMeterColor);
+ g.drawString("Ship is destroyed", left+1, top+15);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display2.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display2.java
new file mode 100644
index 000000000..d2dbeb40e
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Display2.java
@@ -0,0 +1,138 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Display2.java
+Part of the Spacewar system.
+*/
+
+package spacewar;
+
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.awt.Graphics;
+import java.awt.Color;
+
+
+/**
+ * This is the cheap Display aspect.
+ */
+class Display2 extends Display {
+
+ Display2(Game game) {
+ super(game);
+ frame.setLocation(540, 20);
+ }
+
+ void noticeSizeChange() {
+ super.noticeSizeChange();
+ setBackground(Color.darkGray);
+ }
+
+ void paintObjects(Graphics g) {
+ SpaceObject[] objects = game.getRegistry().getObjects();
+ final int len = objects.length;
+ for (int i = 0; i < len; i++) {
+ objects[i].paint(g);
+ }
+ }
+
+ static aspect SpaceObjectPainting {
+
+ abstract private void SpaceObject.paint(Graphics g);
+
+ /*
+ * Ships are by far and away the most complex of the space Objects
+ * to paint.
+ */
+ private Color Ship.color;
+
+ after(Pilot pilot) returning (Ship ship): call(Ship Game.newShip(Pilot)) && args(pilot) {
+ if (pilot.getNumber() == 1)
+ ship.color = Color.white;
+ else if (pilot.getNumber() == 2)
+ ship.color = Color.gray;
+ else
+ ship.color = new Color(0xa00000);
+ }
+
+ private void Ship.paint(Graphics g) {
+ if (this.getDamage() < this.MAX_DAMAGE) {
+ double x = this.getXPos();
+ double y = this.getYPos();
+ double sinTheta = Math.sin(this.getOrientation());
+ double cosTheta = Math.cos(this.getOrientation());
+
+ g.setColor(color);
+ g.drawLine((int)(x + 8*cosTheta), (int)(y + 8*sinTheta),
+ (int)(x - 8*cosTheta), (int)(y - 8*sinTheta));
+
+ // if the ship is accelerating, draw thruster
+ if (this.getRAcc() != 0) {
+ g.setColor(Color.red);
+ g.fillOval((int)(x - 8*cosTheta), (int)(y - 8*sinTheta), 6, 6);
+ }
+ }
+ }
+
+ private void Bullet.paint(Graphics g) {
+ g.setColor(Color.green);
+ g.fillOval((int)this.getXPos() - 1,
+ (int)this.getYPos() - 1,
+ 3,
+ 3);
+ }
+
+ private void EnergyPacket.paint(Graphics g) {
+ g.setColor(Color.white);
+ g.fillOval((int)this.getXPos() - 5,
+ (int)this.getYPos() - 5,
+ 10,
+ 10);
+ }
+ }
+
+ void paintStatus(Graphics g) {
+ int left1 = 60;
+ int top1 = 0;
+
+ int left2 = 200;
+ int top2 = 0;
+
+ g.setColor(Color.white);
+ g.drawString("energy:", 5, top1 + 15);
+ g.drawString("damage:", 5, top1 + 30);
+
+ if (getPilot1() != null)
+ paintLevels(g, getPilot1().getShip(), top1, left1);
+ if (getPilot2() != null)
+ paintLevels(g, getPilot2().getShip(), top2, left2);
+ }
+
+ void paintLevels(Graphics g, Ship ship, int top, int left) {
+ if (ship == null)
+ return;
+ else if (ship.isAlive()) {
+ g.drawString(Float.toString(ship.getEnergyLevel()*100), left+1, top+15);
+ g.drawString(Float.toString(ship.getDamageLevel()*100), left+1, top+30);
+ }
+ else {
+ g.setColor(Color.red);
+ g.drawString("Ship is destroyed", left+1, top+15);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacket.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacket.java
new file mode 100644
index 000000000..d7bc4f9ec
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacket.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+EnergyPacket.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+class EnergyPacket extends SpaceObject {
+
+ static private final int SIZE = 5; //Can't be changed for now!!!
+ int getSize() { return SIZE; }
+
+ private double energy;
+
+ double getEnergy() { return energy; }
+
+ EnergyPacket(Game theGame,
+ double xP, double yP, double xV, double yV, double e) {
+ super(theGame, xP, yP, xV, yV);
+ energy = e;
+ }
+
+ void handleCollision(SpaceObject obj) {
+ die();
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacketProducer.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacketProducer.java
new file mode 100644
index 000000000..efd276042
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnergyPacketProducer.java
@@ -0,0 +1,63 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+EnergyPacketProducer.java
+Part of the Spacewar system.
+
+ This implementation creates booby-trapped packets 20% of the time.
+
+*/
+
+package spacewar;
+
+
+class EnergyPacketProducer extends Thread {
+ private final static int MIN = -20;
+ private final static int MAX = 80;
+ private final static int EXPECTEDINTERVAL = 15;
+
+ private Game game;
+
+ Game getGame() { return game; }
+
+ EnergyPacketProducer(Game theGame) {
+ super("EnergyPacketProducer");
+ game = theGame;
+ }
+
+ public void run() {
+ while(true) {
+ produceAPacket();
+ waitForABit();
+ }
+ }
+
+ void waitForABit() {
+ try { Thread.sleep((int)(Math.random() * EXPECTEDINTERVAL * 2000)); }
+ catch (InterruptedException e) {}
+ }
+
+ void produceAPacket() {
+ EnergyPacket pkt =
+ new EnergyPacket(game,
+ Math.random() * getGame().getWidth(),
+ Math.random() * getGame().getHeight(),
+ Math.random() * 2 - 1,
+ Math.random() * 2 - 1,
+ Math.random() * (MAX - MIN) + MIN);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnsureShipIsAlive.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnsureShipIsAlive.java
new file mode 100644
index 000000000..f7b949a92
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/EnsureShipIsAlive.java
@@ -0,0 +1,35 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+Ship.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+/**
+ * This aspect makes sure that the ship is alive before performing any console
+ * commands.
+ *
+ */
+aspect EnsureShipIsAlive {
+ void around (Ship ship): Ship.helmCommandsCut(ship) {
+ if ( ship.isAlive() ) {
+ proceed(ship);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Game.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Game.java
new file mode 100644
index 000000000..54b1bf2ac
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Game.java
@@ -0,0 +1,215 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Game.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.awt.Dimension;
+
+/**
+ * The Game class is the root of the spacewar game. To start a spacewar
+ * game, you can either call the main method, or instantiate this class
+ * directly.
+ *
+ * Synchronization is done by the GameSynchronization aspect.
+ */
+public class Game extends Thread {
+
+ /**
+ * To run the game from top level, simply say Java Game, as usual. Passing
+ * an argument makes the game run in demo mode. Without an argument it runs
+ * in the normal player mode.
+ */
+ public static void main(String[] args) {
+ if ( args.length == 0 )
+ new Game("1").run();
+ new Game(args[0]).run();
+ }
+
+
+ private Timer timer;
+ private EnergyPacketProducer ePP;
+
+ private Registry registry;
+ private Pilot pilot1, pilot2;
+
+ private Dimension screenSize = new Dimension(500, 500);
+
+ Registry getRegistry() { return registry; }
+ Pilot getPilot1() { return pilot1; }
+ Pilot getPilot2() { return pilot2; }
+
+ /** returns the width of the screen, delegating to screenSize */
+ int getWidth() { return screenSize.width; }
+
+ /** returns the height of the screen, delegating to screenSize */
+ int getHeight() { return screenSize.height; }
+
+ /**
+ * To run the game, simply instantiate this class. It runs in its own
+ * thread. You can instantiate multiple games at once. For the time being
+ * the only way to end the game is to exit from the Java VM.
+ *
+ * @param mode Controls whether the game runs in demo mode or not. True
+ * means it is a demo, false means it runs in normal 2 player mode.
+ */
+ public Game(String mode) {
+ timer = new Timer(this);
+ ePP = new EnergyPacketProducer(this);
+ registry = new Registry(this);
+ }
+
+ public void run() {
+ timer.start();
+ ePP.start();
+
+ while(true) {
+ try {
+ newRobot(3);
+ Thread.sleep(15000);
+ }
+ catch (InterruptedException e) {}
+ }
+ }
+
+
+ /**
+ * add a robot to the game. This is a menu command.
+ */
+ void addRobot() {
+ newRobot(3);
+ }
+
+ /**
+ * resurrect the ships in the game. This is a menu command.
+ */
+ void resetShips() {
+ Ship[] ships = registry.getShips();
+
+ for (int i = 0; i < ships.length; i++) {
+ Ship ship = ships[i];
+ Pilot pilot = ship.getPilot();
+ newShip(pilot);
+ }
+ }
+
+ /**
+ * leave the game. This is a menu command.
+ */
+ void quit() {
+ System.exit(0);
+ }
+
+ void error(Object o) {
+ System.err.println(o);
+ }
+
+
+ /**
+ * returns a new player. With {@link #newRobot} and {@link
+ * #newShip}, the only ways to make a Player, a Robot, or a Ship.
+ * The structural invariant is that there should be no calls to
+ * new of one of these three classes outside these three methods.
+ */
+ Player newPlayer(int number) {
+ Player player = new Player(this, number);
+ newShip(player);
+ return player;
+ }
+
+ /**
+ * returns a new robot. With {@link #newPlayer} and {@link
+ * #newShip}, the only ways to make a Player, a Robot, or a Ship.
+ * The structural invariant is that there should be no calls to
+ * new of one of these three classes outside these three methods.
+ */
+ Robot newRobot(int number) {
+ Robot robot = new Robot(this, number);
+ newShip(robot);
+ robot.start();
+ return robot;
+ }
+
+ /**
+ * returns a new ship. With {@link #newRobot} and {@link
+ * #newPlayer}, the only ways to make a Player, a Robot, or a
+ * Ship. The structural invariant is that there should be no
+ * calls to new of one of these three classes outside these three
+ * methods.
+ */
+ Ship newShip(Pilot pilot) {
+ //
+ // If there is an old ship (we're doing a reset), then remove it from
+ // the registry.
+ //
+ Ship oldShip = pilot.getShip();
+ if (! (oldShip == null))
+ oldShip.die();
+
+ Ship newShip = new Ship(this,
+ Math.random() * getWidth(),
+ Math.random() * getHeight(),
+ Math.random() * Math.PI * 2);
+ pilot.setShip(newShip);
+ newShip.setPilot(pilot);
+
+ return newShip;
+ }
+
+ void clockTick() {
+ registry.clockTick();
+ handleCollisions();
+ }
+
+ // collision detection
+
+ void handleCollisions() {
+ SpaceObject[] objects = registry.getObjects();
+
+ SpaceObject objI, objJ;
+ for (int i = 0; i < objects.length; i++) {
+ objI = objects[i];
+ for (int j = i + 1; j < objects.length; j++) {
+ objJ = objects[j];
+ if (objI instanceof Bullet && objJ instanceof Bullet)
+ continue;
+ if (isCollision(objI, objJ)) {
+ if (objI instanceof Ship && objJ instanceof Ship)
+ Ship.bounce((Ship)(objI), (Ship)(objJ));
+ else {
+ objI.handleCollision(objJ);
+ objJ.handleCollision(objI);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Is the distance between the two centers less than the sum of the two
+ * radii. This is a cheap and dirty (i.e. wrong) implementation of this.
+ */
+ static boolean isCollision(SpaceObject a, SpaceObject b) {
+ return (Math.abs(a.getXPos() - b.getXPos()) +
+ Math.abs(a.getYPos() - b.getYPos())) <
+ (a.getSize()/2 + b.getSize()/2);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/GameSynchronization.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/GameSynchronization.java
new file mode 100644
index 000000000..dcf42e904
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/GameSynchronization.java
@@ -0,0 +1,54 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+RegistrySynchronization.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import coordination.Coordinator;
+
+/**
+ * This aspect ensures synchronized access to methods of the Game in the
+ * presence of several threads.
+ *
+ * It uses the Coordinator class, from the AspectJ coordination library.
+ * (This case is right on the borderline of being too simple to use the
+ * coordination library, but we use it anyways to keep the similarity
+ * with the RegistrySynchronizer.)
+ *
+ * It uses a per-Game coordination scheme, so there is one instance of
+ * this class for each instance of the Game class. When this class is
+ * constructed, it registers appropriate mutexes and selfexes using
+ * the behavior inherited from Coordinator.
+ *
+ * The coordination constraints for the Game are simple. We just need to
+ * make sure that newShip and handleCollisions are mutually exclusive. That
+ * ensures that they we can't destroy a ship that has just been replaced.
+ */
+aspect GameSynchronization extends Coordinator perthis(this(Game)) {
+
+ protected pointcut synchronizationPoint():
+ call(void Game.handleCollisions(..)) || call(Ship Game.newShip(..));
+
+ public GameSynchronization() {
+ addMutex(new String[] {"handleCollisions", "newShip"});
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Pilot.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Pilot.java
new file mode 100644
index 000000000..330d860bf
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Pilot.java
@@ -0,0 +1,44 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+*/
+
+package spacewar;
+
+
+/**
+ * Pilot is the abstract superclass of Player and Robot.
+ *
+ */
+
+abstract class Pilot {
+ private Game game;
+ private int number;
+ protected Ship ship = null;
+
+ Game getGame() { return game; }
+ int getNumber() { return number; }
+ Ship getShip() { return ship; }
+
+ void setShip(Ship s) { ship = s; }
+
+ Pilot (Game g, int n) {
+ super();
+ game = g;
+ number = n;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Player.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Player.java
new file mode 100644
index 000000000..ebde6d5c4
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Player.java
@@ -0,0 +1,122 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+*/
+
+package spacewar;
+
+import java.util.Enumeration;
+import java.awt.event.KeyListener;
+import java.awt.event.KeyEvent;
+
+class Player extends Pilot implements KeyListener {
+
+ private KeyMapping keyMapping;
+
+ /** current rotation key */
+ private int rotation_direction = Ship.STOP; // current rotation key
+
+ /** current thrust */
+ private boolean thrust_on = false;
+
+ Player(Game theGame, int number) {
+ super(theGame,number);
+
+ if (getNumber() == 1)
+ keyMapping = KeyMapping.keyMapping1;
+ else if (getNumber() == 2)
+ keyMapping = KeyMapping.keyMapping2;
+
+ }
+
+ public void keyPressed(KeyEvent e) {
+ int keyCode = e.getKeyCode();
+ boolean consumed = true;
+
+ if (keyCode == keyMapping.fire) {
+ ship.fire();
+ }
+ else if (keyCode == keyMapping.thrust && !thrust_on) {
+ ship.thrust(true);
+ thrust_on = true;
+ }
+ else if (keyCode == keyMapping.right &&
+ rotation_direction != Ship.COUNTERCLOCKWISE) {
+ //start rotating clockwise unless already rotating in the
+ //opposite direction
+ rotation_direction = Ship.CLOCKWISE;
+ ship.rotate(Ship.CLOCKWISE);
+ }
+ else if (keyCode == keyMapping.left &&
+ rotation_direction != Ship.CLOCKWISE) {
+ //start rotating counterclockwise unless already rotating in the
+ //opposite direction
+ rotation_direction = Ship.COUNTERCLOCKWISE;
+ ship.rotate(Ship.COUNTERCLOCKWISE);
+ }
+ else {
+ consumed = false;
+ }
+
+ if (consumed) e.consume();
+ }
+
+ public void keyReleased(KeyEvent e) {
+ int keyCode = e.getKeyCode();
+
+ if (keyCode == keyMapping.thrust) {
+ ship.thrust(false); //engine off
+ thrust_on = false;
+ }
+ else if (keyCode == keyMapping.right &&
+ rotation_direction == Ship.CLOCKWISE
+ ||
+ keyCode == keyMapping.left &&
+ rotation_direction == Ship.COUNTERCLOCKWISE) {
+ ship.rotate(Ship.STOP); //stop rotation
+ rotation_direction = Ship.STOP;
+ }
+ }
+
+ public void keyTyped(KeyEvent e) {
+ // have to implement this because it's in KeyListener
+ }
+}
+
+class KeyMapping {
+
+ static final KeyMapping keyMapping1 =
+ new KeyMapping(KeyEvent.VK_LEFT,
+ KeyEvent.VK_RIGHT,
+ KeyEvent.VK_UP,
+ KeyEvent.VK_SPACE);
+
+ static final KeyMapping keyMapping2 =
+ new KeyMapping(KeyEvent.VK_X,
+ KeyEvent.VK_V,
+ KeyEvent.VK_D,
+ KeyEvent.VK_ALT);
+
+ int left, right, thrust, fire;
+
+ KeyMapping(int k_left, int k_right, int k_thrust, int k_fire) {
+ left = k_left;
+ right = k_right;
+ thrust = k_thrust;
+ fire = k_fire;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Registry.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Registry.java
new file mode 100644
index 000000000..a9cec0418
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Registry.java
@@ -0,0 +1,126 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Registry.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * The Registry keeps track of all the space objects that are floating around.
+ * It basically supports register, unregister and contents type operations.
+ *
+ * The synchronization is done by the RegistrySynchronization aspect.
+ */
+
+class Registry {
+
+ private Hashtable table;
+ private Game game;
+
+ Game getGame() { return game; }
+
+ Registry (Game theGame) {
+ game = theGame;
+ table = new Hashtable();
+ }
+
+
+ void register(SpaceObject object) {
+ table.put(object, object);
+ }
+
+ void unregister(SpaceObject object) {
+ table.remove(object);
+ }
+
+ /*
+ * It is an invariant of the design that only two points in SpaceObject
+ * should call register and unregister. This aspect enforces that.
+ *
+ * Unfortunately, in the current compiler, we get a static warning when
+ * there are no illegal calls that this advice has no targets. That will
+ * be fixed in a future release. For the time being the dummy method
+ * just below this fixes that.
+ */
+ static aspect RegistrationProtection {
+ after() returning():
+ (call(void Registry.register(SpaceObject)) ||
+ call(void Registry.unregister(SpaceObject))) &&
+ !(within(SpaceObject) && (withincode(new(..)) ||
+ withincode(void die()))) {
+ throw new IllegalAccessError(
+ "This is an illegal call to " + thisJoinPoint + "\n" +
+ "Only the constructor and the die() on SpaceObject\n" +
+ "should call the primitive registry operations.");
+ }
+ }
+
+ void dummy() { // see comment above
+ register(getObjects()[0]);
+ unregister(getObjects()[0]);
+ }
+
+
+ SpaceObject[] getObjects() {
+ SpaceObject[] allObjects = new SpaceObject[table.size()];
+ Enumeration elements = table.elements();
+ for(int i = 0; elements.hasMoreElements(); i++) {
+ allObjects[i] = (SpaceObject)(elements.nextElement());
+ }
+ return allObjects;
+ }
+
+ Ship[] getShips() {
+ //
+ // First we have to put just the Ships into a vector, then we can put
+ // them into an array of exactly the right length.
+ //
+ Ship[] arrayOfShips;
+ Vector vectorOfShips = new Vector();
+ Enumeration elements = table.elements();
+ while (elements.hasMoreElements()) {
+ Object object = elements.nextElement();
+ if (object instanceof Ship) {
+ vectorOfShips.addElement(object);
+ }
+ }
+
+ arrayOfShips = new Ship[(vectorOfShips.size())];
+ vectorOfShips.copyInto(arrayOfShips);
+ return arrayOfShips;
+ }
+
+ Hashtable getTable() { return table; }
+
+ //
+ // The protocol for clockTick is that it automatically cascades.
+ //
+ void clockTick() {
+ Enumeration elements = table.elements();
+ while (elements.hasMoreElements()) {
+ ((SpaceObject)elements.nextElement()).clockTick();
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/RegistrySynchronization.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/RegistrySynchronization.java
new file mode 100644
index 000000000..986e4bd30
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/RegistrySynchronization.java
@@ -0,0 +1,58 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+RegistrySynchronization.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import coordination.Coordinator;
+
+
+/**
+ * This aspect ensures synchronized access to methods of the Registry in
+ * the presence of several threads.
+ *
+ * It uses the Coordinator class, from the AspectJ coordination library.
+ *
+ * It uses a per-Registry coordination scheme, so there is one instance of
+ * this class for each instance of the Registry class. When this class is
+ * constructed, it registers appropriate mutexes and selfexes using the
+ * behavior inherited from Coordinator.
+ *
+ * The mutating methods (register and unregister) should be self-exclusive.
+ * Each reader method should be mutually exclusive with the mutating
+ * methods. But the readers can run concurrently. */
+aspect RegistrySynchronization extends Coordinator perthis(this(Registry)) {
+
+ protected pointcut synchronizationPoint():
+ call(void Registry.register(..)) ||
+ call(void Registry.unregister(..)) ||
+ call(SpaceObject[] Registry.getObjects(..)) ||
+ call(Ship[] Registry.getShips(..));
+
+ public RegistrySynchronization() {
+ addSelfex("register");
+ addSelfex("unregister");
+
+ addMutex(new String[] {"register", "unregister", "getObjects"});
+ addMutex(new String[] {"register", "unregister", "getShips"});
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Robot.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Robot.java
new file mode 100644
index 000000000..05f276108
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Robot.java
@@ -0,0 +1,201 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Robot.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.util.Random;
+
+/**
+ * Robot is an automatic pilot that now has quite a bit of intelligence.
+ * So, beware !
+ */
+class Robot extends Pilot implements Runnable {
+
+ private static final int FIRE_INTERVAL = 60;
+ private static final int REBIRTH_DELAY = 900;
+
+ private final Random random = new Random();
+
+ private Thread runner;
+ private boolean runnable = true;
+
+ Robot(Game theGame, int number) {
+ super(theGame, number);
+ }
+
+ void start() {
+ if (runner == null) {
+ runner = new Thread(this);
+ runner.start();
+ }
+ }
+
+ void destroy() {
+ if (runner != null) {
+ runnable = false;
+ runner = null;
+ }
+ }
+
+
+ // A Robot tracks User-controlled ships and fires at them
+ public void run() {
+ Ship target = null;
+
+ while(runnable) {
+ // find target ship
+ do {
+ Ship[] potentials = getGame().getRegistry().getShips();
+ if(potentials.length != 0)
+ target = potentials[Math.abs(random.nextInt() % potentials.length)];
+ sleepForABit(25);
+ } while (target == ship);
+ // main loop
+ int currentRotation = Ship.STOP;
+ int time;
+ boolean currentlyAccelerating = false;
+ double dx, dy, angleA, angleB, theta, dtheta, d,
+ targetVel, a, b, c, targetXVel, targetYVel;
+
+ while(true) {
+ sleepForABit(FIRE_INTERVAL);
+
+ // if my ship is destroyed, give me a new one
+ if (!ship.isAlive()) {
+ sleepForABit(REBIRTH_DELAY);
+ getGame().newShip(this);
+ }
+
+ // find direction and distance from target to me
+ dx = ship.getXPos() - target.getXPos();
+ if (dx < - getGame().getWidth() / 2)
+ dx += getGame().getWidth();
+ if (dx > getGame().getWidth() / 2)
+ dx -= getGame().getWidth();
+ dy = ship.getYPos() - target.getYPos();
+ if (dy < - getGame().getHeight() / 2)
+ dy += getGame().getHeight();
+ if (dy > getGame().getHeight() / 2)
+ dy -= getGame().getHeight();
+ d = Math.sqrt(dx * dx + dy * dy);
+ angleA = Math.atan(dy / dx);
+ if (dx < 0)
+ angleA += Math.PI;
+
+ // find relative velocity and trajectory of target
+ targetXVel = target.getXVel() - ship.getXVel();
+ targetYVel = target.getYVel() - ship.getYVel();
+ targetVel = Math.sqrt(targetXVel * targetXVel +
+ targetYVel * targetYVel);
+ angleB = Math.atan(targetYVel / targetXVel);
+ if (targetXVel < 0)
+ angleB+=Math.PI;
+
+ // find angle between line to target and taget's direction of travel
+ theta = (angleA - angleB) % (2 * Math.PI);
+ if (theta < -Math.PI)
+ theta += 2 * Math.PI;
+ if (theta > Math.PI)
+ theta -= 2 * Math.PI;
+
+ // calculate time to bullet impact using law of cosines
+ a = targetVel * targetVel + Ship.BULLET_SPEED * Ship.BULLET_SPEED;
+ b = d * targetVel * Math.cos(theta);
+ c = - d * d;
+ time = (int)((-b + Math.sqrt(b * b - 4 * a * c)) / 2 / a);
+
+ // calculate angle and distance to bullet impact location
+ dx = targetXVel * time - dx;
+ dy = targetYVel * time - dy;
+ theta = Math.atan(dy / dx);
+ if(dx < 0)
+ theta += Math.PI;
+
+ // find desired change in rotation
+ dtheta = (theta - ship.getOrientation()) % (2 * Math.PI);
+ // find the shortest path to the desired orientation;
+ if(dtheta < - Math.PI)
+ dtheta += 2 * Math.PI;
+ if(dtheta > Math.PI)
+ dtheta -= 2 * Math.PI;
+
+ // turn if nessecary
+ if (dtheta > Ship.DEFAULT_ANGULAR_VELOCITY / 2) {
+ if (currentRotation != Ship.CLOCKWISE)
+ ship.rotate(currentRotation = Ship.CLOCKWISE);
+ }
+ else if (dtheta < -Ship.DEFAULT_ANGULAR_VELOCITY / 2) {
+ if (currentRotation != Ship.COUNTERCLOCKWISE)
+ ship.rotate(currentRotation = Ship.COUNTERCLOCKWISE);
+ } // otherwise, fire, maybe even a burst
+ else {
+ if(currentRotation != Ship.STOP)
+ ship.rotate(currentRotation = Ship.STOP);
+ if (random.nextInt() % 40 == 0) {
+ ship.fire();
+ }
+ }
+
+ // randomly accelerate
+ if (currentlyAccelerating && random.nextInt() % 2 == 0)
+ ship.thrust(currentlyAccelerating = false);
+ else {
+ if (ship.getXVel() == 0)
+ angleA = 0;
+ else
+ angleA = Math.atan(ship.getYVel() / ship.getXVel());
+
+ if (ship.getXVel() < 0)
+ angleA+=Math.PI;
+ angleB = (angleA - ship.getOrientation()) % (2 * Math.PI);
+ if (angleB < -Math.PI)
+ angleB += 2 * Math.PI;
+ if (angleB > Math.PI)
+ angleB -= 2 * Math.PI;
+ angleB = Math.abs(angleB);
+
+ // angleB now represents the angle between the ship's
+ // orientation and velocity vector. This will be used to
+ // determine the probably that the ship will thrust to
+ // prevent ships from accelerating too much in one direction
+ if (random.nextInt() % (int)(12 * (Math.PI - angleB) + 1) == 0)
+ ship.thrust(currentlyAccelerating = true);
+ }
+
+ // switch targets if current one has been destroyed
+ if (target.getDamage() == 100)
+ break;
+
+ // randomly switch targets
+ if (random.nextInt() % 4000 == 0)
+ break;
+ }
+ }
+ }
+
+ void sleepForABit (int time) {
+ try {
+ runner.sleep(time);
+ }
+ catch (InterruptedException e) {}
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SWFrame.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SWFrame.java
new file mode 100644
index 000000000..6dfb9f6f6
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SWFrame.java
@@ -0,0 +1,92 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+SWFrame.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.MenuShortcut;
+import java.awt.Dimension;
+import java.awt.Insets;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+class SWFrame extends Frame implements ActionListener {
+ private Game game;
+ private Display display;
+ private Menu menu;
+
+ Game getGame() { return game; }
+ Display getDisplay() { return display; }
+ Menu getMenu() { return menu; }
+
+ SWFrame(Game theGame, Display d) {
+ super("Space War!");
+
+ game = theGame;
+
+ display = d;
+ add(display);
+
+ // create menu
+ menu = new Menu("Game");
+ MenuItem item1 = new MenuItem("Add Robot", new MenuShortcut('a'));
+ MenuItem item2 = new MenuItem("Reset Ships", new MenuShortcut('r'));
+ MenuItem item3 = new MenuItem("Quit", new MenuShortcut('q'));
+ item1.setActionCommand("Add Robot");
+ item2.setActionCommand("Reset Ships");
+ item3.setActionCommand("Quit");
+ menu.add(item1);
+ menu.add(item2);
+ menu.add(item3);
+ menu.addActionListener(this);
+
+ setMenuBar(new MenuBar());
+ getMenuBar().add(menu);
+
+ Dimension screenSize = new Dimension(500, 500);
+ setSize(screenSize);
+ setVisible(true);
+ toFront();
+
+ Insets inset = getInsets();
+ int displayWidth = screenSize.width - inset.left - inset.right;
+ int displayHeight = screenSize.height - inset.top - inset.bottom;
+ display.setSize(displayWidth, displayHeight);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ String s = e.getActionCommand();
+ if (s.equals("Add Robot")) {
+ getGame().addRobot();
+ }
+ else if (s.equals("Reset Ships")) {
+ getGame().resetShips();
+ }
+ else if (s.equals("Quit")) {
+ getGame().quit();
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Ship.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Ship.java
new file mode 100644
index 000000000..8f016fe27
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Ship.java
@@ -0,0 +1,298 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+Ship.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+class Ship extends SpaceObject {
+
+ pointcut helmCommandsCut(Ship ship):
+ target(ship) && ( call(void rotate(int)) ||
+ call(void thrust(boolean)) ||
+ call(void fire()) );
+
+ Ship(Game theGame, double xPos, double yPos, double orientation) {
+ super(theGame, xPos, yPos, 0, 0);
+ xAcc = 0;
+ yAcc = 0;
+ this.orientation = orientation;
+ angularVel = 0;
+
+ energy = MAX_ENERGY;
+ damage = 0;
+ countdown = EXPLOSION_LENGTH;
+ }
+
+
+ int getSize() { return SIZE; }
+
+ double getEnergy() { return energy; }
+ double getDamage() { return damage; }
+ double getOrientation() { return orientation; }
+ double getRAcc() { return rAcc; }
+
+ Pilot getPilot() { return pilot; }
+ void setPilot (Pilot p) { pilot = p; }
+
+ float getEnergyLevel() {
+ return (float)energy / (float)MAX_ENERGY;
+ }
+ float getDamageLevel() {
+ return (float)damage / (float)MAX_DAMAGE;
+ }
+
+ /** returns false if energy is out, otherwise decrements energy by amount
+ * and returns true
+ */
+ boolean expendEnergy(double amount) {
+ if (amount <= energy) {
+ energy -= amount;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /** increments damage by amount and handles the destruction of a ship if
+ * damage reaches MAX_DAMAGE.
+ */
+ void inflictDamage(double amount) {
+ if (amount < 0) // shouldn't happen
+ return;
+ damage = Math.min(MAX_DAMAGE, damage + amount);
+ if (damage == MAX_DAMAGE)
+ setIsAlive(false);
+ }
+
+ /** repairs some damage
+ */
+ void repairDamage(double amount) {
+ if (amount < 0) // shouldn't happen
+ return;
+ if (damage == 0)
+ return;
+ damage = Math.max(0, damage - amount);
+ }
+
+ public void clockTick() {
+ if (! isAlive()) {
+ //
+ // If we aren't alive, but we are still in the registry, it means
+ // we are exploding. countdown counts the length of the explosion.
+ //
+ if (--countdown == 0)
+ die();
+ }
+ else {
+ if (angularVel != 0) {
+ orientation += angularVel;
+ xAcc = rAcc * Math.cos(orientation);
+ yAcc = rAcc * Math.sin(orientation);
+ }
+ setXVel(getXVel() + xAcc);
+ setYVel(getYVel() + yAcc);
+
+ //expend energy
+ if (!expendEnergy(rAcc * ACCELERATION_COST_FACTOR))
+ rAcc = xAcc = yAcc = 0;
+
+ // fix damage
+ if (energy > 10 && damage > REPAIR_RATE) {
+ expendEnergy(REPAIR_RATE);
+ repairDamage(REPAIR_RATE);
+ }
+ }
+ super.clockTick();
+ }
+
+ /**
+ * First check to make sure we have enough energy to accelerate. If
+ * we do, then go ahead and do so. Acceleration is in the direction
+ * we are already facing (i.e. orientation).
+ */
+ void setAcceleration(double acc) {
+ if (acc * ACCELERATION_COST_FACTOR <= energy) {
+ rAcc = acc;
+ xAcc = rAcc * Math.cos(orientation);
+ yAcc = rAcc * Math.sin(orientation);
+ }
+ }
+
+ /**
+ * First check to make sure we have enough energy to rotate. If
+ * we do, then go ahead and do so.
+ */
+ void setAngularVelocity(double omega) {
+ // changing direction of rotation takes energy
+ if (!expendEnergy(Math.abs(omega - angularVel) / 2))
+ return;
+ //sets amount of degree rotation per clock tick, in radians;
+ //clockwise is positive
+ angularVel = omega;
+ }
+
+ /** affect rotation thrusters. Direction can be one of {@link
+ * #CLOCKWISE}, {@link #COUNTERCLOCKWISE}, or zero for turning off
+ * the thrusters.
+ */
+ void rotate(int direction) {
+ setAngularVelocity(
+ direction == CLOCKWISE ? DEFAULT_ANGULAR_VELOCITY :
+ direction == COUNTERCLOCKWISE ? -DEFAULT_ANGULAR_VELOCITY :
+ 0);
+ }
+
+ /** turn on acceleration */
+ void thrust(boolean onOff) {
+ setAcceleration(onOff ? DEFAULT_ACCELERATION : 0);
+ }
+
+ /** create a bullet and fire it */
+ void fire() {
+ // firing a shot takes energy
+ if (!expendEnergy(BULLET_ENERGY))
+ return;
+
+ //create a bullet object so it doesn't hit the ship that's firing it
+ double xV = getXVel() + BULLET_SPEED * (Math.cos(orientation));
+ double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation));
+
+ // create the actual bullet
+ new Bullet(
+ getGame(),
+ (getXPos() + ((getSize()/2 + 2) * (Math.cos(orientation))) + xV),
+ (getYPos() + ((getSize()/2 + 2) * (Math.sin(orientation))) + yV),
+ xV,
+ yV);
+ }
+
+
+ void handleCollision(SpaceObject obj) {
+ if (obj instanceof Ship) {
+ // should never be called. ship - ship collisions are handled in
+ // Ship.bounce(Ship shipA, Ship shipB)
+ }
+ else if (obj instanceof Bullet) {
+ inflictDamage(BULLET_DAMAGE);
+ }
+ else if (obj instanceof EnergyPacket) {
+ double packetEnergy = ((EnergyPacket)obj).getEnergy();
+ energy = Math.max(0, Math.min(energy + packetEnergy, MAX_ENERGY));
+ }
+ else {
+ System.err.println("collision with UFO!");
+ }
+ }
+
+ static void bounce(Ship shipA, Ship shipB) {
+ double dx, dy, denominator,
+ xAccA, yAccA, xAccB, yAccB, damage,
+ xComp, yComp, dvx, dvy;
+
+ dx = Math.abs(shipA.getXPos() - shipB.getXPos());
+ dy = Math.abs(shipA.getYPos() - shipB.getYPos());
+ denominator = Math.sqrt(dx * dx + dy * dy);
+ xComp = dx / denominator;
+ yComp = dy / denominator;
+ xAccA = shipB.getXVel() * xComp + shipA.getXVel() * (1 - xComp) -
+ shipA.getXVel();
+ yAccA = shipB.getYVel() * yComp + shipA.getYVel() * (1 - yComp) -
+ shipA.getYVel();
+ xAccB = shipA.getXVel() * xComp + shipB.getXVel() * (1 - xComp) -
+ shipB.getXVel();
+ yAccB = shipA.getYVel() * yComp + shipB.getYVel() * (1 - yComp) -
+ shipB.getYVel();
+ shipA.accelerate(xAccA, yAccA);
+ shipB.accelerate(xAccB, yAccB);
+ dvx = shipA.getXVel() - shipB.getXVel();
+ dvy = shipA.getYVel() - shipA.getYVel();
+ damage = COLLISION_DAMAGE_FACTOR * (dvx * dvx + dvy * dvy);
+ shipA.inflictDamage(damage);
+ shipB.inflictDamage(damage);
+
+ // !!!
+ // !!! poopers! this does a local time warp. this has to be a
+ // !!! violation of the clockTick protocol
+ // !!!
+ while (Game.isCollision(shipA, shipB)) {
+ shipA.clockTick();
+ shipB.clockTick();
+ }
+ }
+
+
+
+ /**
+ * Energy and Damage are key values in the state of a ship. Energy is
+ * basically about fuel, and damage is about how bad a shape we are in.
+ *
+ * The energy related values are:
+ * <ul>
+ * <li>MAX_ENERGY</li>
+ * <li>BULLET_ENERGY</li>
+ * <li>ACCELERATION_ENERGY_FACTOR</li>
+ * <li>energy</li>
+ * </ul>
+ * The damage related values are:
+ * <ul>
+ * <li>MAX_DAMAGE</li>
+ * <li>BULLET_DAMAGE</li>
+ * <li>COLLISION_DAMAGE_FACTOR</li>
+ * <li>damage</li>
+ * </ul>
+ * Finally, REPAIR_RATE is the rate at which energy is consumed to fix
+ * damage.
+ *
+ */
+ private static final int MAX_ENERGY = 100;
+ private static final int BULLET_ENERGY= 2;
+ private static final double ACCELERATION_COST_FACTOR = 0.05;
+
+ //XXX was private
+ static final int MAX_DAMAGE = 100;
+ private static final int BULLET_DAMAGE = 15;
+ private static final double COLLISION_DAMAGE_FACTOR = 0.1;
+
+ private static final double REPAIR_RATE = 0.08;
+
+
+ private static final int EXPLOSION_LENGTH = 10;
+
+ static final int BULLET_SPEED = 10;
+
+ static final int CLOCKWISE = 1;
+ static final int STOP = 0;
+ static final int COUNTERCLOCKWISE = (-1);
+
+ static final double DEFAULT_ANGULAR_VELOCITY = 0.2;
+ static final double DEFAULT_ACCELERATION = .4;
+
+ static private final int SIZE = 30; //Can't be changed for now!!!
+
+ private double energy; // range: 0 to MAX_ENERGY
+ private double damage; // range: 0 to MAX_DAMAGE
+ private double orientation; // in degrees
+ private double angularVel; // in ???
+ private double xAcc, yAcc, rAcc; //
+ private int countdown; // remaining explosion time
+
+ private Pilot pilot;
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SpaceObject.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SpaceObject.java
new file mode 100644
index 000000000..ee3afabcc
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/SpaceObject.java
@@ -0,0 +1,106 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+SpaceObject.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+/**
+ * SpaceObjects are objects that float around in space. They support the
+ * minimal SpaceObject protocol, having to do with position, velocity,
+ * size and liveness. They are constructed with game, position, velocity
+ * and size. When constructed, a spaceobject adds itself to the registry.
+ *
+ * When it dies, a spaceobject removes itself from the registry. But note
+ * that it doesn't decide when to die, subclasses do that.
+ *
+ * The display aspects actually draw the space object on the screen and say
+ * how much space it takes up there.
+ */
+abstract class SpaceObject {
+
+ private Game game;
+ private double xPos, yPos, oldXPos, oldYPos, xVel, yVel;
+ private boolean alive;
+
+ SpaceObject (Game theGame, double xP, double yP, double xV, double yV) {
+ game = theGame;
+ xPos = xP;
+ yPos = yP;
+ oldXPos = xP;
+ oldYPos = yP;
+ xVel = xV;
+ yVel = yV;
+
+ alive = true;
+ getGame().getRegistry().register(this);
+ }
+
+ Game getGame() { return game; }
+
+ double getXPos() { return xPos; }
+ double getYPos() { return yPos; }
+
+ double getOldXPos() { return oldXPos; }
+ double getOldYPos() { return oldYPos; }
+
+ double getXVel() { return xVel; }
+ double getYVel() { return yVel; }
+
+ void setXVel (double n) { xVel = n; }
+ void setYVel (double n) { yVel = n; }
+
+ boolean isAlive() { return alive; }
+ void setIsAlive(boolean n) { alive = n; }
+
+
+ /**
+ * Move 1 unit of time's worth of distance. I.e. increment xPos by xVel
+ * and yPos by yVel. If we move off an edge of the screen move us back
+ * in the opposite edge.
+ */
+ void clockTick() {
+ oldXPos = xPos;
+ oldYPos = yPos;
+ xPos = (xPos + xVel) % getGame().getWidth();
+ if(xPos < 0)
+ xPos += getGame().getWidth();
+ yPos = (yPos + yVel) % getGame().getHeight();
+ if(yPos < 0)
+ yPos += getGame().getHeight();
+ }
+
+ void accelerate(double dXVel, double dYVel) {
+ xVel += dXVel;
+ yVel += dYVel;
+ }
+
+ void die() {
+ getGame().getRegistry().unregister(this);
+ }
+
+ abstract int getSize();
+
+ /** resolve the effects of colliding with a space object.
+ * @param obj the space object that this object is colliding with.
+ */
+ abstract void handleCollision(SpaceObject obj);
+}
diff --git a/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Timer.java b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Timer.java
new file mode 100644
index 000000000..1f4a992a7
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/demos/spacewar/src/spacewar/Timer.java
@@ -0,0 +1,53 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+|<--- this code is formatted to fit into 80 columns --->|
+
+
+Timer.java
+Part of the Spacewar system.
+
+*/
+
+package spacewar;
+
+
+class Timer extends Thread {
+
+ private final static int TICK_PERIOD = 40; // time between ticks in millis
+
+ private Game game;
+
+ Game getGame() { return game; }
+
+ Timer (Game theGame) {
+ super("Timer");
+ game = theGame;
+ }
+
+ public void run() {
+ long t1, tdiff;
+ while (true) {
+ t1 = System.currentTimeMillis();
+ getGame().clockTick();
+ tdiff = System.currentTimeMillis() - t1;
+ if (tdiff < TICK_PERIOD) {
+ try {
+ sleep (Math.max(0 , TICK_PERIOD - tdiff));
+ }
+ catch (InterruptedException e) { }
+ }
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/README.txt b/docs/modules/ROOT/pages/teaching/exercises/README.txt
new file mode 100644
index 000000000..91c8c3e52
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/README.txt
@@ -0,0 +1,124 @@
+AspectJ Figures Exercises
+------------------------------
+
+This file is really out-of-date. We're in the middle of recovery
+from OOPSLA 2004, and we need to move stuff around in this
+package. In particular, we need to build in a new structure.
+
+One idea is that we should have _four_ projects within the
+workspace, one for each problem set. There's still a bit of work
+necessary to avoid duplicating code here (in CVS) even though we
+want to duplicate code in the generated workspaces.
+
+------------------------------
+Generated Structure
+
+We want a particular _generated_ structure for users. We're
+eventually going to dump to a zip file or a CD.
+
+Folder: aj-<event>:
+ /eclipse (arch)
+ /workspace (noarch)
+ /packages (noarch)
+ j2sdk for win, linux
+ aspectj for everybody
+
+------------------------------
+Requirements for users:
+
+* We learned at OOPSLA 2004 that the system doesn't work well at
+ all under linux using the blackdown JDK. Use Sun's jdk!
+
+
+------------------------------
+------------------------------
+
+THIS FILE IS OUT-OF-DATE !!! (2003-3-17)
+
+These exercises are designed to be used with AspectJ 1.0.6.
+
+THEY MUST NOT BE DISTRIBUTED ELECTRONICALLY WITHOUT THINKING FIRST!!!
+There may be licence issues with just sticking the junit jar in there
+that I don't understand.
+
+To build distribution zips, use ant -f build.xml. This will create
+
+ EV-exercises.zip -- the contents of these exercises, minus AspectJ
+ EV-answers.zip -- some answers to these exercises.
+ EV-setup.zip -- the exercises bundled with AspectJ
+ EV-allcontent.zip -- the exercises bundled with the answers
+
+
+If you don't want to be bothered with specifying where AspectJ is,
+feel free to just do ant -f build.xml answers.zip. By default it will
+build both exercises and answers.
+
+------------------------------
+Required environment
+
+In order to actually do the exercises, the three very important files
+to have are:
+
+ EV-exercises.zip
+ aspectj-tools-1.0.6.jar
+ <some installer of java>
+
+It is almost certainly a good idea to hope that Java is already
+installed on the students' systems, but to provide two installers
+(windows and linux) anyway.
+
+ http://java.sun.com
+
+You may want to also include the rest of the AspectJ installers as
+well, but that might be a bit of a distraction
+
+ http://aspectj.org/dl
+
+These require junit.jar. I've included a copy in with the two zip
+files, but they might want to be refreshed every now and again.
+
+ http://junit.org
+
+
+------------------------------
+Printing
+
+It would be really nice to have an automated solution to generate the
+documents, but no such luck.
+
+* index.html should print out with useful page breaks. It should be
+ separated into four chunks if possible.
+
+* answers in four chunks.
+
+* quick reference sheets.
+
+Remember to have a one-sided copy of everything as a separate
+clean-copy.
+
+
+------------------------------
+Distribution
+
+ /j2sdk-1_4_1_01-linux-i586.bin
+ /j2sdk-1_4_1_01-windows-i586.exe
+ /exercises.zip containing:
+ aj-EV/src/figures.zip
+ aj-EV/src/aspectj-tools-1.0.6.jar
+ aj-EV/src/aspectj-docs-1.0.6.jar
+ aj-EV/<exploded version of figures.zip>
+ aj-EV/aspectj/<exploded version of aspectj-tools>
+ aj-EV/aspectj/<exploded version of aspectj-docs>
+ aj-EV/setpaths
+ aj-EV/setpaths.bat
+
+/bin/ajc, are edited to make sure that JAVA_HOME is used, as the
+defaults will almost certainly be wrong. setpaths scripts do what
+they look like they do. All six of these scripts are stored in
+scripts under CVS.
+
+---- Instructors
+
+Since the only difference is the answers, just overwrite the
+extraction directory with answers.zip.
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer.java
new file mode 100644
index 000000000..d2030d398
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer.java
@@ -0,0 +1,7 @@
+package answers;
+
+import figures.*;
+
+aspect Answer {
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1a.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1a.java
new file mode 100644
index 000000000..09c41a28d
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1a.java
@@ -0,0 +1,22 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.*;
+
+aspect Answer1a {
+ declare error
+ : get(java.io.PrintStream System.out)
+ && within(figures..*)
+ : "illegal access to System.out";
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1b.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1b.java
new file mode 100644
index 000000000..95c6e130d
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1b.java
@@ -0,0 +1,21 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+aspect Answer1b {
+ declare warning
+ : set(private * *)
+ && !withincode(* set*(..))
+ && within(figures.*)
+ : "bad field set";
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1c.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1c.java
new file mode 100644
index 000000000..f90dc8bcc
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer1c.java
@@ -0,0 +1,21 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+aspect Answer1c {
+ declare error
+ : set(private * *)
+ && !(withincode(* set*(..)) || withincode(new(..)))
+ && within(figures.*)
+ : "bad field set";
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2a.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2a.java
new file mode 100644
index 000000000..46519a83e
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2a.java
@@ -0,0 +1,24 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.Point;
+import figures.FigureElement;
+
+public aspect Answer2a {
+ before(int newValue): set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2b.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2b.java
new file mode 100644
index 000000000..c9ba82bee
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2b.java
@@ -0,0 +1,26 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.Group;
+import figures.FigureElement;
+
+public aspect Answer2b {
+ before(FigureElement newValue):
+ call(void Group.add(FigureElement))
+ && args(newValue) {
+ if (newValue == null) {
+ throw new IllegalArgumentException("null not allowed");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2c.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2c.java
new file mode 100644
index 000000000..2364aaeb0
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2c.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.Group;
+import figures.FigureElement;
+
+public aspect Answer2c {
+ before(FigureElement newValue, Group g):
+ call(void Group.add(FigureElement))
+ && args(newValue)
+ && target(g) {
+ if (newValue == null) {
+ throw new IllegalArgumentException("null not allowed");
+ }
+ if (newValue == g) {
+ throw new IllegalArgumentException("self not allowed");
+ }
+
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2d.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2d.java
new file mode 100644
index 000000000..0d99f537f
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2d.java
@@ -0,0 +1,24 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.*;
+
+aspect Answer2d {
+ void around(int val): (set(int Point._x) || set(int Point._y))
+ && args(val) {
+ if (val < 0)
+ val = 0;
+ proceed(val);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2e.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2e.java
new file mode 100644
index 000000000..7da69c313
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2e.java
@@ -0,0 +1,34 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.*;
+
+import java.awt.Rectangle;
+
+aspect Answer2e {
+ void around(Point p, int dx, int dy):
+ target(p) && call(void move(int, int)) && args(dx, dy) {
+ int preX = p.getX();
+ int preY = p.getY();
+
+ proceed(p, dx, dy);
+
+ int postX = p.getX();
+ int postY = p.getY();
+
+ if ((postX != preX + dx) || (postY != preY + dy)) {
+ throw new IllegalStateException("point didn't move properly");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2f.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2f.java
new file mode 100644
index 000000000..f8992ccf9
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer2f.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.*;
+
+import java.awt.Rectangle;
+
+aspect Answer2f {
+ void around(FigureElement fe, int dx, int dy):
+ target(fe) && call(void move(int, int)) && args(dx, dy) {
+
+ Rectangle preBounds = new Rectangle(fe.getBounds());
+ proceed(fe, dx, dy);
+
+ preBounds.translate(dx, dy);
+
+ if (!preBounds.equals(fe.getBounds())) {
+ throw new IllegalStateException("bounds don't match move");
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3a.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3a.java
new file mode 100644
index 000000000..d48924ee8
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3a.java
@@ -0,0 +1,21 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import support.Log;
+
+aspect Answer3a {
+ before(): execution(public * *(..)) && within(figures.*) {
+ Log.write(thisJoinPoint);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3b.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3b.java
new file mode 100644
index 000000000..4fe3072fa
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3b.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import support.Log;
+
+import figures.Point;
+import figures.Group;
+import figures.FigureElement;
+
+aspect Answer3b {
+ before(Object o):
+ execution(public * *(..))
+ && !execution(public String toString(..))
+ // or perhaps !cflow(adviceexecution())
+ && within(figures.*)
+ && target(o)
+ {
+ Log.write(thisJoinPoint + " at " + o);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3c.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3c.java
new file mode 100644
index 000000000..198558d06
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3c.java
@@ -0,0 +1,25 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import support.Log;
+
+import figures.*;
+
+aspect Answer3c {
+ before():
+ execution(void Group.add(FigureElement))
+ && args(Point) {
+ Log.write("adding Point");
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3d.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3d.java
new file mode 100644
index 000000000..b2e74218c
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3d.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import support.Log;
+
+import figures.*;
+
+aspect Answer3d {
+
+ private boolean Point.inGroup = false;
+
+ before(Point p):
+ execution(void Group.add(FigureElement))
+ && args(p) {
+ if (p.inGroup) {
+ throw new IllegalStateException();
+ } else {
+ p.inGroup = true;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3e.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3e.java
new file mode 100644
index 000000000..505aa22c6
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer3e.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import support.Log;
+
+import figures.*;
+
+aspect Answer3e {
+
+ private Group Point.containingGroup = null;
+
+ before(Group g, Point p):
+ execution(void Group.add(FigureElement))
+ && this(g)
+ && args(p) {
+ if (p.containingGroup != null) {
+ throw new IllegalStateException(p.containingGroup.toString());
+ } else {
+ p.containingGroup = g;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4a.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4a.java
new file mode 100644
index 000000000..99fa96cc1
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4a.java
@@ -0,0 +1,23 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.FigureElement;
+import figures.Group;
+import java.awt.Rectangle;
+
+aspect Answer4a {
+ Rectangle around(): execution(Rectangle Group.getBounds()) {
+ return FigureElement.MAX_BOUNDS;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4b.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4b.java
new file mode 100644
index 000000000..2e77fd862
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4b.java
@@ -0,0 +1,30 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.FigureElement;
+import figures.Group;
+import java.awt.Rectangle;
+
+aspect Answer4b {
+ private Rectangle Group.cache = null;
+
+ Rectangle around(Group g):
+ execution(Rectangle Group.getBounds())
+ && this(g) {
+ if (g.cache == null) {
+ g.cache = proceed(g);
+ }
+ return g.cache;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4c.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4c.java
new file mode 100644
index 000000000..c9d0e8415
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4c.java
@@ -0,0 +1,36 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.FigureElement;
+import figures.Group;
+import java.awt.Rectangle;
+
+aspect Answer4c {
+ private Rectangle Group.cache = null;
+
+ Rectangle around(Group g):
+ execution(Rectangle Group.getBounds())
+ && this(g) {
+ if (g.cache == null) {
+ g.cache = proceed(g);
+ }
+ return g.cache;
+ }
+
+ before(Group g):
+ call(void move(int, int))
+ && target(g) {
+ g.cache = null;
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4d.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4d.java
new file mode 100644
index 000000000..2f019c249
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4d.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.FigureElement;
+import figures.Group;
+import figures.Point;
+import java.awt.Rectangle;
+
+aspect Answer4d {
+ private Rectangle Group.cache = null;
+ private Group Point.enclosingGroup = null;
+
+ before(Point p, Group g):
+ execution(void add(FigureElement))
+ && args(p)
+ && target(g) {
+ p.enclosingGroup = g;
+ }
+
+ Rectangle around(Group g):
+ execution(Rectangle Group.getBounds())
+ && this(g) {
+ if (g.cache == null) {
+ g.cache = proceed(g);
+ }
+ return g.cache;
+ }
+
+ before(Point p):
+ set(* Point.*)
+ && target(p) {
+ if (p.enclosingGroup != null) {
+ p.enclosingGroup.cache = null;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4e.java b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4e.java
new file mode 100644
index 000000000..e3d6fa3d4
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/answers/Answer4e.java
@@ -0,0 +1,49 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package answers;
+
+import figures.FigureElement;
+import figures.Group;
+import figures.Point;
+import java.awt.Rectangle;
+
+aspect Answer4e {
+ private Rectangle Group.cache = null;
+ private Group FigureElement.enclosingGroup = null;
+
+ before(FigureElement p, Group g):
+ execution(void add(FigureElement))
+ && args(p)
+ && target(g) {
+ p.enclosingGroup = g;
+ }
+
+ Rectangle around(Group g):
+ execution(Rectangle Group.getBounds())
+ && this(g) {
+ if (g.cache == null) {
+ g.cache = proceed(g);
+ }
+ return g.cache;
+ }
+
+ before(Point p):
+ set(* Point.*)
+ && target(p) {
+ FigureElement fe = p;
+ while (fe.enclosingGroup != null) {
+ fe.enclosingGroup.cache = null;
+ fe = fe.enclosingGroup;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/base.lst b/docs/modules/ROOT/pages/teaching/exercises/base.lst
new file mode 100644
index 000000000..cb6914637
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/base.lst
@@ -0,0 +1,29 @@
+figures/Box.java
+figures/FigureElement.java
+figures/Group.java
+figures/Line.java
+figures/Point.java
+figures/ShapeFigureElement.java
+figures/SlothfulPoint.java
+
+support/Log.java
+
+answers/Answer.java
+
+tests/Test.java
+tests/Test2a.java
+tests/Test2b.java
+tests/Test2c.java
+tests/Test2d.java
+tests/Test2e.java
+tests/Test2f.java
+tests/Test3a.java
+tests/Test3b.java
+tests/Test3c.java
+tests/Test3d.java
+tests/Test3e.java
+tests/Test4a.java
+tests/Test4b.java
+tests/Test4c.java
+tests/Test4d.java
+tests/Test4e.java
diff --git a/docs/modules/ROOT/pages/teaching/exercises/build.xml b/docs/modules/ROOT/pages/teaching/exercises/build.xml
new file mode 100644
index 000000000..d35fd5e2a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/build.xml
@@ -0,0 +1,120 @@
+<!--
+
+This build script will create a directory called burn that is
+_almost_ suitable for burning onto a CD. However, there
+are a number of things that should be done to this directory
+before actually burning:
+
+The PDFs in the print directory need to be manually generated.
+Use the content of foo.pdf.contents to generate foo.pdf, and
+and then delete the foo.pdf.contents directory.
+
+The powerpoint and packages directory should be populated
+with whatever you want to populate it with. The
+packages directory is typically filled with Linux installers
+and a clean AspectJ installer.
+-->
+
+<project name="build" default="burn" basedir=".">
+ <description>
+ Build a CD image containing AspectJ exercises.
+ </description>
+
+ <!-- CUSTOMIZE THESE PROPERTIES -->
+
+ <!-- this directory should hold a clean unpacked AspectJ release -->
+ <property name="aj.home" value="c:/apps/aspectj" />
+
+ <!-- this is the name of the event -->
+ <property name="aj.event" value="oopsla2004" />
+
+ <!-- NO CUSTOMIZABLE PROPERTIES BELOW HERE -->
+
+ <property name="burndir" value="burn" />
+ <property name="eventdir" value="${burndir}/aj-${aj.event}" />
+ <property name="packagedir" value="${burndir}/packages" />
+ <property name="printdir" value="${burndir}/print" />
+ <property name="powerpointdir" value="${burndir}/powerpoint" />
+
+ <!-- now real targets -->
+ <target name="burn" depends="clean,skeleton,event,answers,printables" />
+
+ <target name="printables" depends="skeleton">
+ <delete dir="${printdir}/answers.pdf.contents" />
+ <mkdir dir="${printdir}/answers.pdf.contents" />
+ <copy toDir="${printdir}/answers.pdf.contents">
+ <fileset dir="answers" includes="*.java" excludes="Answer.java"/>
+ </copy>
+
+ <delete dir="${printdir}/exercises.pdf.contents" />
+ <mkdir dir="${printdir}/exercises.pdf.contents" />
+ <copy toDir="${printdir}/exercises.pdf.contents" file="index.html" />
+ <copy toDir="${printdir}/exercises.pdf.contents" file="figures_classes.pdf" />
+ <copy toDir="${printdir}/exercises.pdf.contents" file="${aj.home}/doc/quick.pdf" />
+
+ <delete dir="${printdir}/install.pdf.contents" />
+ <mkdir dir="${printdir}/install.pdf.contents" />
+ <copy toDir="${printdir}/install.pdf.contents" file="install.txt" />
+ </target>
+
+ <target name="answers" depends="skeleton">
+ <zip destfile="${packagedir}/${aj.event}-answers.zip">
+ <zipfileset dir="answers"
+ prefix="aj-${aj.event}/answers"
+ includes="*.java"
+ excludes="Answer.java"
+ />
+ </zip>
+ </target>
+
+ <target name="event" depends="tools,exercises">
+ <filter token="aj.event" value="${aj.event}" />
+ <copy file="install.txt" toDir="${eventdir}" filtering="yes" />
+ </target>
+
+ <target name="exercises" depends="skeleton">
+ <copy toDir="${eventdir}">
+ <fileset dir="."
+ includes="junit.jar,base.lst,guibase.lst,*.html,support/**/*.java,figures/**/*.java,tests/**/*.java,answers/Answer.java"
+ />
+ </copy>
+ </target>
+
+ <target name="tools" depends="skeleton">
+ <mkdir dir="${eventdir}/aspectj" />
+ <filter token="aj.event" value="${aj.event}" />
+
+ <copy toDir="${eventdir}/aspectj">
+ <fileset dir="${aj.home}" excludes="bin/**" />
+ </copy>
+ <copy toDir="${eventdir}/aspectj/bin" filtering="yes">
+ <fileset dir="scripts" excludes="setpaths*" />
+ </copy>
+ <copy toDir="${eventdir}" filtering="yes">
+ <fileset dir="scripts" includes="setpaths*" />
+ </copy>
+ <fixcrlf srcDir="${eventdir}"
+ includes="setpaths.bat,aspectj/bin/ajbrowser.bat,aspectj/bin/ajc.bat"
+ eol="crlf" />
+ <fixcrlf srcDir="${eventdir}"
+ includes="setpaths.sh,setpaths.csh,aspectj/bin/ajbrowser,aspectj/bin/ajc"
+ eol="lf" />
+ </target>
+
+ <target name="skeleton">
+ <mkdir dir="${burndir}" />
+ <mkdir dir="${eventdir}" />
+ <mkdir dir="${packagedir}" />
+ <mkdir dir="${printdir}" />
+ <mkdir dir="${powerpointdir}" />
+ </target>
+
+ <target name="clean">
+ <delete dir="burn" />
+ </target>
+
+ <target name="javaclean">
+ <delete dir="burn" />
+ </target>
+
+</project>
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures.zargo b/docs/modules/ROOT/pages/teaching/exercises/figures.zargo
new file mode 100644
index 000000000..c042c5969
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures.zargo
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/Box.java b/docs/modules/ROOT/pages/teaching/exercises/figures/Box.java
new file mode 100644
index 000000000..2db991a21
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/Box.java
@@ -0,0 +1,64 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Box extends ShapeFigureElement {
+ private Point _p0;
+ private Point _p1;
+ private Point _p2;
+ private Point _p3;
+
+ public Box(int x0, int y0, int width, int height) {
+ _p0 = new Point(x0, y0);
+ _p1 = new Point(x0+width, y0);
+ _p2 = new Point(x0+width, y0+height);
+ _p3 = new Point(x0, y0+height);
+ }
+
+ public Point getP0() { return _p0; }
+ public Point getP1() { return _p1; }
+ public Point getP2() { return _p2; }
+ public Point getP3() { return _p3; }
+
+ public void move(int dx, int dy) {
+ _p0.move(dx, dy);
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ _p3.move(dx, dy);
+ }
+
+ public void checkBoxness() {
+ if ((_p0.getX() == _p3.getX()) &&
+ (_p1.getX() == _p2.getX()) &&
+ (_p0.getY() == _p1.getY()) &&
+ (_p2.getY() == _p3.getY()))
+ return;
+ throw new IllegalStateException("This is not a square.");
+ }
+
+ public String toString() {
+ return "Box(" + _p0 + ", " + _p1 + ", " + _p2 + ", " + _p3 + ")";
+ }
+
+ public Shape getShape() {
+ return new Rectangle(getP1().getX(),
+ getP1().getY(),
+ getP3().getX() - getP1().getX(),
+ getP3().getY() - getP1().getY());
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/FigureElement.java b/docs/modules/ROOT/pages/teaching/exercises/figures/FigureElement.java
new file mode 100644
index 000000000..ac588f94d
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/FigureElement.java
@@ -0,0 +1,30 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public interface FigureElement {
+ public static final Rectangle MAX_BOUNDS =
+ new Rectangle(0, 0, 500, 500);
+
+ public abstract void move(int dx, int dy);
+
+ public abstract Rectangle getBounds();
+
+ public abstract boolean contains(Point2D p);
+
+ public abstract void paint(Graphics2D g2);
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/Group.java b/docs/modules/ROOT/pages/teaching/exercises/figures/Group.java
new file mode 100644
index 000000000..f8ec65556
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/Group.java
@@ -0,0 +1,97 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Group implements FigureElement {
+ private Collection _members;
+ private String _identifier;
+
+ public Group(FigureElement first) {
+ this._members = new ArrayList();
+ add(first);
+ }
+
+ public void add(FigureElement fe) {
+ _members.add(fe);
+ }
+
+ public Iterator members() {
+ return _members.iterator();
+ }
+
+ public void move(int dx, int dy) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.move(dx, dy);
+ }
+ }
+
+ public void setIdentifier(String identifier) {
+ _identifier = identifier;
+ }
+
+ public String toString() {
+ if (_identifier != null) {
+ return _identifier;
+ }
+
+ StringBuffer buf = new StringBuffer("Group(");
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ buf.append(i.next().toString());
+ if (i.hasNext()) {
+ buf.append(", ");
+ }
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ public Rectangle getBounds() {
+ Rectangle previous = null;
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ Rectangle rect = fe.getBounds();
+ if (previous != null) {
+ previous = previous.union(rect);
+ } else {
+ previous = rect;
+ }
+ }
+ return previous;
+ }
+
+ public boolean contains(Point2D p) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return true;
+ }
+ return false;
+ }
+
+ public void paint(Graphics2D g2) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.paint(g2);
+ }
+ }
+
+ public int size() {
+ return _members.size();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/Line.java b/docs/modules/ROOT/pages/teaching/exercises/figures/Line.java
new file mode 100644
index 000000000..fb3b86b65
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/Line.java
@@ -0,0 +1,64 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Line extends ShapeFigureElement {
+ private Point _p1;
+ private Point _p2;
+
+ public Line(Point p1, Point p2) {
+ _p1 = p1;
+ _p2 = p2;
+ }
+
+ public Point getP1() { return _p1; }
+ public Point getP2() { return _p2; }
+
+ public void move(int dx, int dy) {
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ }
+
+ public String toString() {
+ return "Line(" + _p1 + ", " + _p2 + ")";
+ }
+
+ /**
+ * Used to determine if this line {@link contains(Point2D)} a point.
+ */
+ final static int THRESHHOLD = 5;
+
+ /**
+ * Returns <code>true</code> if the point segment distance is less than
+ * {@link THRESHHOLD}.
+ */
+ public boolean contains(Point2D p) {
+ return getLine2D().ptLineDist(p) < THRESHHOLD;
+ }
+
+ private Line2D getLine2D() {
+ return new Line2D.Float((float)getP1().getX(),
+ (float)getP1().getY(),
+ (float)getP2().getX(),
+ (float)getP2().getY());
+ }
+
+ public Shape getShape() {
+ return getLine2D();
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/Point.java b/docs/modules/ROOT/pages/teaching/exercises/figures/Point.java
new file mode 100644
index 000000000..95bd63994
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/Point.java
@@ -0,0 +1,58 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Point extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public Point(int x, int y) {
+ _x = x;
+ _y = y;
+ }
+
+ public int getX() { return _x; }
+
+ public int getY() { return _y; }
+
+ public void setX(int x) { _x = x; }
+
+ public void setY(int y) { _y = y; }
+
+ public void move(int dx, int dy) {
+ _x += dx;
+ _y += dy;
+ }
+
+ public String toString() {
+ return "Point(" + _x + ", " + _y + ")";
+ }
+
+ /** The height of displayed {@link Point}s. */
+ private final static int HEIGHT = 10;
+
+ /** The width of displayed {@link Point}s. -- same as {@link HEIGHT}. */
+ private final static int WIDTH = Point.HEIGHT;
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)getX()-Point.WIDTH/2,
+ (float)getY()-Point.HEIGHT/2,
+ (float)Point.HEIGHT,
+ (float)Point.WIDTH);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/ShapeFigureElement.java b/docs/modules/ROOT/pages/teaching/exercises/figures/ShapeFigureElement.java
new file mode 100644
index 000000000..8e7bd34c2
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/ShapeFigureElement.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public abstract class ShapeFigureElement implements FigureElement {
+ public abstract void move(int dx, int dy);
+
+ public abstract Shape getShape();
+
+ public Rectangle getBounds() {
+ return getShape().getBounds();
+ }
+
+ public boolean contains(Point2D p) {
+ return getShape().contains(p);
+ }
+
+ public Color getLineColor() {
+ return Color.black;
+ }
+
+ public Color getFillColor() {
+ return Color.red;
+ }
+
+ public final void paint(Graphics2D g2) {
+ Shape shape = getShape();
+ g2.setPaint(getFillColor());
+ g2.fill(shape);
+ g2.setPaint(getLineColor());
+ g2.draw(shape);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/SlothfulPoint.java b/docs/modules/ROOT/pages/teaching/exercises/figures/SlothfulPoint.java
new file mode 100644
index 000000000..89f80d700
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/SlothfulPoint.java
@@ -0,0 +1,50 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+/**
+ * This class makes mistakes to be caught by invariant checkers.
+ */
+public class SlothfulPoint extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public SlothfulPoint(int x, int y) {
+ }
+
+ public int getX() { return _x; }
+
+ public int getY() { return _y; }
+
+ public void setX(int x) { }
+
+ public void setY(int y) { }
+
+ public void move(int dx, int dy) {
+ System.out.println("Slothful moving");
+ }
+
+ public String toString() {
+ return "SlothfulPoint";
+ }
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)_x,
+ (float)_y, 1.0f, 1.0f);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/gui/FigurePanel.java b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/FigurePanel.java
new file mode 100644
index 000000000..6b264f42a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/FigurePanel.java
@@ -0,0 +1,181 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures.gui;
+
+import figures.Point;
+import figures.Line;
+import figures.FigureElement;
+import figures.Group;
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+
+public class FigurePanel extends JComponent {
+
+ ButtonsPanel bp = new ButtonsPanel();
+ FigureSurface fs = new FigureSurface();
+ ConsolePanel cp = new ConsolePanel();
+
+
+ public FigurePanel() {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(fs);
+ panel.add(bp);
+ JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, cp);
+ sp.setPreferredSize(new Dimension(500, 400));
+ sp.setDividerLocation(250);
+ add(BorderLayout.CENTER, sp);
+ }
+
+ class ButtonsPanel extends JPanel {
+ JLabel msgs = new JLabel("click to add a point or line");
+ public ButtonsPanel() {
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+ add(new JButton(new AbstractAction("Main") {
+ public void actionPerformed(ActionEvent e) {
+ Main.main(new String[]{});
+ fs.repaint();
+ }
+ }));
+ add(msgs);
+ }
+
+ public void log(String msg) {
+ msgs.setText(msg);
+ }
+ }
+
+ static class ConsolePanel extends JPanel {
+
+ JTextArea text = new JTextArea();
+
+ public ConsolePanel() {
+ super(new BorderLayout());
+ text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10));
+ JScrollPane scroller = new JScrollPane(text);
+ scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ add(BorderLayout.CENTER, scroller);
+ }
+
+ public void println(String msg) {
+ text.append(msg + '\n');
+ }
+ }
+
+ final static Color BACKGROUND = Color.white;
+
+ static class FigureSurface extends JPanel implements MouseListener, MouseMotionListener {
+ Group canvas;
+
+ public FigureSurface() {
+ canvas = new Group(new Point(250, 250));
+ addMouseMotionListener(this);
+ addMouseListener(this);
+ setPreferredSize(new Dimension(500,500));
+ }
+
+ private Point addPoint(int x, int y) {
+ Point p = new Point(x, y);
+ canvas.add(p);
+ repaint();
+ return p;
+ }
+
+ private Line addLine(Point p1, Point p2) {
+ if (Math.abs(p1.getX()-p2.getX()) < 5 ||
+ Math.abs(p1.getY()-p2.getY()) < 5) {
+ return null;
+ }
+
+ Line line = null;
+ if (p1 != null && p2 != null) {
+ line = new Line(p1, p2);
+ canvas.add(line);
+ }
+ repaint();
+ return line;
+ }
+
+ public void paint(Graphics g) {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setPaint(BACKGROUND);
+ g2.fill(new Rectangle2D.Float(0f, 0f, (float)g2.getClipBounds().width, (float)g2.getClipBounds().height));
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ canvas.paint(g2);
+ }
+
+
+ int lastX, lastY;
+ int pressX, pressY;
+
+ FigureElement first = null;
+ Point point1 = null;
+
+ public void mousePressed(MouseEvent e){
+ int x = e.getX(), y = e.getY();
+ pressX = lastX = x; pressY = lastY = y;
+ first = findFigureElement(x, y);
+ if (first == null) {
+ point1 = addPoint(x, y);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ int x = e.getX(), y = e.getY(), dx = lastX-x, dy = lastY-y;
+ lastX = x;
+ lastY = y;
+ if (first == null) {
+ Line line = addLine(point1, new Point(x, y));
+ if (line != null) {
+ canvas.add(line.getP2());
+ first = line.getP2();
+ canvas.add(line);
+ }
+ } else {
+ first.move(-dx, -dy);
+ }
+ repaint();
+ }
+
+ public void mouseReleased(MouseEvent e){
+ mouseDragged(e);
+ first = null;
+ point1 = null;
+ }
+
+
+ public void mouseMoved(MouseEvent e){}
+ public void mouseClicked(MouseEvent e){}
+ public void mouseExited(MouseEvent e){}
+ public void mouseEntered(MouseEvent e){}
+
+ private FigureElement findFigureElement(int x, int y) {
+ Point2D p = new Point2D.Float((float)x, (float)y);
+ for (Iterator i = canvas.members(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return fe;
+ }
+ return null;
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/gui/LogAdapter.java b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/LogAdapter.java
new file mode 100644
index 000000000..dbacd37ca
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/LogAdapter.java
@@ -0,0 +1,25 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures.gui;
+
+import support.Log;
+
+aspect LogAdapter {
+
+ before(String s): call(void Log.log(String)) && args(s) {
+ if (Main.panel != null) {
+ Main.panel.cp.println(s);
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures/gui/Main.java b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/Main.java
new file mode 100644
index 000000000..23330ca8a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures/gui/Main.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package figures.gui;
+
+import javax.swing.*;
+import support.Log;
+
+public class Main {
+ static FigurePanel panel;
+
+ public static void main(String[] args) {
+ JFrame figureFrame = new JFrame("Figure Editor");
+ panel = new FigurePanel();
+ figureFrame.setContentPane(panel);
+ figureFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ figureFrame.pack();
+ figureFrame.setVisible(true);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures_classes.png b/docs/modules/ROOT/pages/teaching/exercises/figures_classes.png
new file mode 100644
index 000000000..0e3c65065
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures_classes.png
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/figures_classes.svg b/docs/modules/ROOT/pages/teaching/exercises/figures_classes.svg
new file mode 100644
index 000000000..1e2587a82
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/figures_classes.svg
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20001102//EN' 'http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd'>
+<svg xmlns="http://www.w3.org/2000/svg" width="1007" height="675">
+<rect x="148" y="14" width="148" height="108" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="148" y="14" width="147" height="107" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="149" y1="122" x2="296" y2="122" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="296" y1="15" x2="296" y2="121" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="148" y="14" width="148" height="19" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="148" y="14" width="147" height="18" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="189" y="29" style="font-family:Dialog; font-size:10;">
+&lt;&lt;Interface&gt;&gt;</text>
+<rect x="148" y="32" width="148" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="148" y="32" width="147" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="187" y="47" style="font-family:Dialog; font-size:10;">
+FigureElement</text>
+<rect x="149" y="32" width="146" height="2" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="149" y="32" width="145" height="1" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="148" y="52" width="148" height="70" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="148" y="52" width="147" height="69" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="150" y="68" style="font-family:Dialog; font-size:10; font-style:italic;">
+move(dx: int,dy: int) : void</text>
+<text x="150" y="85" style="font-family:Dialog; font-size:10; font-style:italic;">
+getBounds() : Rectangle</text>
+<text x="150" y="102" style="font-family:Dialog; font-size:10; font-style:italic;">
+contains(p: Point2D) : boolean</text>
+<text x="150" y="119" style="font-family:Dialog; font-size:10; font-style:italic;">
+paint(g2: Graphics2D) : void</text>
+<rect x="14" y="202" width="148" height="159" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="202" width="147" height="158" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="15" y1="361" x2="162" y2="361" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="162" y1="203" x2="162" y2="360" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="14" y="202" width="148" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="202" width="147" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="38" y="217" style="font-family:Dialog; font-size:10; font-style:italic;">
+ShapeFigureElement</text>
+<rect x="14" y="222" width="148" height="18" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="222" width="147" height="17" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<rect x="14" y="239" width="148" height="122" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="239" width="147" height="121" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="16" y="255" style="font-family:Dialog; font-size:10; font-style:italic;">
+move(dx: int,dy: int) : void</text>
+<text x="16" y="272" style="font-family:Dialog; font-size:10; font-style:italic;">
+getShape() : Shape</text>
+<text x="16" y="289" style="font-family:Dialog; font-size:10;">
+getBounds() : Rectangle</text>
+<text x="16" y="306" style="font-family:Dialog; font-size:10;">
+contains(p: Point2D) : boolean</text>
+<text x="16" y="323" style="font-family:Dialog; font-size:10;">
+getLineColor() : Color</text>
+<text x="16" y="340" style="font-family:Dialog; font-size:10;">
+getFillColor() : Color</text>
+<text x="16" y="357" style="font-family:Dialog; font-size:10;">
+paint(g2: Graphics2D) : void</text>
+<rect x="242" y="202" width="188" height="192" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="242" y="202" width="187" height="191" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="243" y1="394" x2="430" y2="394" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="430" y1="203" x2="430" y2="393" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="242" y="202" width="188" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="242" y="202" width="187" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="321" y="217" style="font-family:Dialog; font-size:10;">
+Group</text>
+<rect x="242" y="222" width="188" height="172" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="242" y="222" width="187" height="171" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="244" y="238" style="font-family:Dialog; font-size:10;">
+&lt;&lt;create&gt;&gt; Group(first: FigureElement)</text>
+<text x="244" y="255" style="font-family:Dialog; font-size:10;">
+add(fe: FigureElement) : void</text>
+<text x="244" y="272" style="font-family:Dialog; font-size:10;">
+members() : Iterator</text>
+<text x="244" y="289" style="font-family:Dialog; font-size:10;">
+move(dx: int,dy: int) : void</text>
+<text x="244" y="306" style="font-family:Dialog; font-size:10;">
+setIdentifier(identifier: String) : void</text>
+<text x="244" y="323" style="font-family:Dialog; font-size:10;">
+toString() : String</text>
+<text x="244" y="340" style="font-family:Dialog; font-size:10;">
+getBounds() : Rectangle</text>
+<text x="244" y="357" style="font-family:Dialog; font-size:10;">
+contains(p: Point2D) : boolean</text>
+<text x="244" y="374" style="font-family:Dialog; font-size:10;">
+paint(g2: Graphics2D) : void</text>
+<text x="244" y="391" style="font-family:Dialog; font-size:10;">
+size() : int</text>
+<rect x="14" y="490" width="141" height="158" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="490" width="140" height="157" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="15" y1="648" x2="155" y2="648" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="155" y1="491" x2="155" y2="647" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="14" y="490" width="141" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="490" width="140" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="72" y="505" style="font-family:Dialog; font-size:10;">
+Point</text>
+<rect x="14" y="510" width="141" height="138" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="14" y="510" width="140" height="137" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="16" y="526" style="font-family:Dialog; font-size:10;">
+&lt;&lt;create&gt;&gt; Point(x: int,y: int)</text>
+<text x="16" y="543" style="font-family:Dialog; font-size:10;">
+getX() : int</text>
+<text x="16" y="560" style="font-family:Dialog; font-size:10;">
+getY() : int</text>
+<text x="16" y="577" style="font-family:Dialog; font-size:10;">
+setX(x: int) : void</text>
+<text x="16" y="594" style="font-family:Dialog; font-size:10;">
+setY(y: int) : void</text>
+<text x="16" y="611" style="font-family:Dialog; font-size:10;">
+move(dx: int,dy: int) : void</text>
+<text x="16" y="628" style="font-family:Dialog; font-size:10;">
+toString() : String</text>
+<text x="16" y="645" style="font-family:Dialog; font-size:10;">
+getShape() : Shape</text>
+<rect x="259" y="474" width="177" height="158" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="259" y="474" width="176" height="157" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="260" y1="632" x2="436" y2="632" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="436" y1="475" x2="436" y2="631" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="259" y="474" width="177" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="259" y="474" width="176" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="337" y="489" style="font-family:Dialog; font-size:10;">
+Line</text>
+<rect x="259" y="494" width="177" height="138" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="259" y="494" width="176" height="137" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="261" y="510" style="font-family:Dialog; font-size:10;">
+&lt;&lt;create&gt;&gt; Line(p1: Point,p2: Point)</text>
+<text x="261" y="527" style="font-family:Dialog; font-size:10;">
+getP1() : Point</text>
+<text x="261" y="544" style="font-family:Dialog; font-size:10;">
+getP2() : Point</text>
+<text x="261" y="561" style="font-family:Dialog; font-size:10;">
+move(dx: int,dy: int) : void</text>
+<text x="261" y="578" style="font-family:Dialog; font-size:10;">
+toString() : String</text>
+<text x="261" y="595" style="font-family:Dialog; font-size:10;">
+contains(p: Point2D) : boolean</text>
+<text x="261" y="612" style="font-family:Dialog; font-size:10;">
+getLine2D() : Line2D</text>
+<text x="261" y="629" style="font-family:Dialog; font-size:10;">
+getShape() : Shape</text>
+<rect x="492" y="474" width="243" height="175" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="492" y="474" width="242" height="174" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="493" y1="649" x2="735" y2="649" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="735" y1="475" x2="735" y2="648" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="492" y="474" width="243" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="492" y="474" width="242" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="604" y="489" style="font-family:Dialog; font-size:10;">
+Box</text>
+<rect x="492" y="494" width="243" height="155" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="492" y="494" width="242" height="154" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="494" y="510" style="font-family:Dialog; font-size:10;">
+&lt;&lt;create&gt;&gt; Box(x0: int,y0: int,width: int,height: int)</text>
+<text x="494" y="527" style="font-family:Dialog; font-size:10;">
+getP0() : Point</text>
+<text x="494" y="544" style="font-family:Dialog; font-size:10;">
+getP1() : Point</text>
+<text x="494" y="561" style="font-family:Dialog; font-size:10;">
+getP2() : Point</text>
+<text x="494" y="578" style="font-family:Dialog; font-size:10;">
+getP3() : Point</text>
+<text x="494" y="595" style="font-family:Dialog; font-size:10;">
+move(dx: int,dy: int) : void</text>
+<text x="494" y="612" style="font-family:Dialog; font-size:10;">
+checkBoxness() : void</text>
+<text x="494" y="629" style="font-family:Dialog; font-size:10;">
+toString() : String</text>
+<text x="494" y="646" style="font-family:Dialog; font-size:10;">
+getShape() : Shape</text>
+<rect x="815" y="474" width="178" height="158" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="815" y="474" width="177" height="157" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="816" y1="632" x2="993" y2="632" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="993" y1="475" x2="993" y2="631" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="815" y="474" width="178" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="815" y="474" width="177" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="873" y="489" style="font-family:Dialog; font-size:10;">
+SlothfulPoint</text>
+<rect x="815" y="494" width="178" height="138" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="815" y="494" width="177" height="137" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="817" y="510" style="font-family:Dialog; font-size:10;">
+&lt;&lt;create&gt;&gt; SlothfulPoint(x: int,y: int)</text>
+<text x="817" y="527" style="font-family:Dialog; font-size:10;">
+getX() : int</text>
+<text x="817" y="544" style="font-family:Dialog; font-size:10;">
+getY() : int</text>
+<text x="817" y="561" style="font-family:Dialog; font-size:10;">
+setX(x: int) : void</text>
+<text x="817" y="578" style="font-family:Dialog; font-size:10;">
+setY(y: int) : void</text>
+<text x="817" y="595" style="font-family:Dialog; font-size:10;">
+move(dx: int,dy: int) : void</text>
+<text x="817" y="612" style="font-family:Dialog; font-size:10;">
+toString() : String</text>
+<text x="817" y="629" style="font-family:Dialog; font-size:10;">
+getShape() : Shape</text>
+<rect x="630" y="86" width="139" height="108" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="630" y="86" width="138" height="107" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="631" y1="194" x2="769" y2="194" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<line x1="769" y1="87" x2="769" y2="193" style="fill:#1a1a1a; stroke:#1a1a1a; stroke-width:1"/>
+<rect x="630" y="86" width="139" height="21" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="630" y="86" width="138" height="20" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<text x="690" y="101" style="font-family:Dialog; font-size:10;">
+Log</text>
+<rect x="630" y="106" width="139" height="18" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="630" y="106" width="138" height="17" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="632" y1="123" x2="678" y2="123" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="632" y="122" style="font-family:Dialog; font-size:10;">
+data : List</text>
+<rect x="630" y="123" width="139" height="71" style="fill:#ffffff; stroke:#ffffff; stroke-width:1"/>
+<rect x="630" y="123" width="138" height="70" style="fill:#ffffff; stroke:#000000; stroke-width:1"/>
+<line x1="632" y1="140" x2="767" y2="140" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="632" y="139" style="font-family:Dialog; font-size:10;">
+traceObject(o: Object) : void</text>
+<line x1="632" y1="157" x2="720" y2="157" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="632" y="156" style="font-family:Dialog; font-size:10;">
+log(s: String) : void</text>
+<line x1="632" y1="174" x2="700" y2="174" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="632" y="173" style="font-family:Dialog; font-size:10;">
+getData() : List</text>
+<line x1="632" y1="191" x2="691" y2="191" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="632" y="190" style="font-family:Dialog; font-size:10;">
+clear() : void</text>
+<line x1="98" y1="202" x2="98" y2="197" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="98" y1="192" x2="98" y2="187" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="98" y1="182" x2="98" y2="177" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="98" y1="172" x2="98" y2="167" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="98" y1="162" x2="98" y2="157" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="98" y1="154" x2="103" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="108" y1="154" x2="113" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="118" y1="154" x2="123" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="128" y1="154" x2="133" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="138" y1="154" x2="143" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="148" y1="154" x2="153" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="158" y1="154" x2="163" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="168" y1="154" x2="173" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="178" y1="154" x2="183" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="188" y1="154" x2="193" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="198" y1="154" x2="203" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="208" y1="154" x2="213" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="218" y1="154" x2="223" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="228" y1="154" x2="232" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="154" x2="232" y2="149" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="144" x2="232" y2="139" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="134" x2="232" y2="129" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="124" x2="232" y2="122" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="232,123 239,135 225,135"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="232,123 239,135 225,135"/>
+<line x1="346" y1="202" x2="346" y2="197" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="346" y1="192" x2="346" y2="187" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="346" y1="182" x2="346" y2="177" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="346" y1="172" x2="346" y2="167" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="346" y1="162" x2="346" y2="157" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="346" y1="154" x2="341" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="336" y1="154" x2="331" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="326" y1="154" x2="321" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="316" y1="154" x2="311" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="306" y1="154" x2="301" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="296" y1="154" x2="291" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="286" y1="154" x2="281" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="276" y1="154" x2="271" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="266" y1="154" x2="261" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="256" y1="154" x2="251" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="246" y1="154" x2="241" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="236" y1="154" x2="232" y2="154" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="154" x2="232" y2="149" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="144" x2="232" y2="139" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="134" x2="232" y2="129" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="232" y1="124" x2="232" y2="122" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="232,123 239,135 225,135"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="232,123 239,135 225,135"/>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="84,490 84,442 88,442 88,361"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="88,362 95,374 81,374"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="88,362 95,374 81,374"/>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="323,474 323,442 88,442 88,361"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="88,362 95,374 81,374"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="88,362 95,374 81,374"/>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="613,474 613,442 88,442 88,361"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="88,362 95,374 81,374"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="88,362 95,374 81,374"/>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="904,474 904,442 88,442 88,361"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="88,362 95,374 81,374"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="88,362 95,374 81,374"/>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="296,202 296,122"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="296,202 291,192 296,182 301,192"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="296,202 291,192 296,182 301,192"/>
+<line x1="303" y1="135" x2="296" y2="123" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="289" y1="135" x2="296" y2="123" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<text x="279" y="193" style="font-family:Dialog; font-size:10;">
+*</text>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="155,566 259,566"/>
+<line x1="167" y1="559" x2="155" y2="566" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="167" y1="573" x2="155" y2="566" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="258,566 248,571 238,566 248,561"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="258,566 248,571 238,566 248,561"/>
+<text x="241" y="557" style="font-family:Dialog; font-size:10;">
+2</text>
+<polyline style="fill:none; stroke:#000000; stroke-width:1" points="155,646 492,646"/>
+<line x1="167" y1="639" x2="155" y2="646" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<line x1="167" y1="653" x2="155" y2="646" style="fill:#000000; stroke:#000000; stroke-width:1"/>
+<polygon style="fill:#ffffff; stroke:#ffffff; stroke-width:1" points="491,646 481,651 471,646 481,641"/>
+<polygon style="fill:#ffffff; stroke:#000000; stroke-width:1" points="491,646 481,651 471,646 481,641"/>
+<text x="474" y="637" style="font-family:Dialog; font-size:10;">
+4</text>
+</svg>
diff --git a/docs/modules/ROOT/pages/teaching/exercises/guibase.lst b/docs/modules/ROOT/pages/teaching/exercises/guibase.lst
new file mode 100644
index 000000000..0a9371462
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/guibase.lst
@@ -0,0 +1,5 @@
+-argfile
+base.lst
+figures/gui/FigurePanel.java
+figures/gui/Main.java
+figures/gui/LogAdapter.java \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/teaching/exercises/index.html b/docs/modules/ROOT/pages/teaching/exercises/index.html
new file mode 100644
index 000000000..5212f6e42
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/index.html
@@ -0,0 +1,689 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<!-- This file represents the Exercises for the hands-on AspectJ
+ tutorial. It is commonly checked into CVS with identifying
+ information for the latest conference (such as presenters
+ and publication information).
+
+ When you use it for your own purposes, don't forget to
+ modify at the very least anything that says
+ id="copyright" or class="presenter". If you're in an A4
+ country, don't forget to modify the paper size.
+
+ The gif included at the end is somewhat fragile,
+ so be careful with different paper sizes.
+
+ TODO: There is currently something weird about PDF generation
+ from this: If generated from a windows machine, it will
+ generate mac-unfriendly PDF because of the requested windows
+ font. If the PDF is only used for immediate printing,
+ that's fine, but if it's used for distribution, bad.
+-->
+
+<head>
+ <title>Hands-on Programming with AspectJ&reg; &mdash; Exercises</title>
+ <style type="text/css">
+div.instruction { padding: 0.5em; border-width: 1px; border-style: solid }
+body { background-color: #FFF; margin: 2em }
+body { font-family: "Gill Sans MT", "Gill sans", "Trebuchet ms", Verdana, sans-serif; }
+.newpage { page-break-before: always }
+pre { margin-left: 1em; border-left-style: solid; border-width: 1px; padding-left: 1em;}
+h2 { margin-top: 4ex; }
+h3 { margin-top: 4ex; border-bottom-style: solid; border-width: 1px }
+.presenter { text-align: right }
+@page {
+ size: 8.5in 11in;
+ margin: 3in;
+ marks: cross
+}
+@media print {
+ body { font-size: 10pt }
+ #copyright {
+ font-family: "Times New Roman", "Times Roman", fixed;
+ font-size: 8pt;
+ display: normal;
+ position: absolute;
+ bottom: 1in;
+ border-style: none
+ }
+}
+@media screen {
+ #copyright { display: none }
+}
+ </style>
+</head>
+
+<body>
+
+<h1>Hands-on Programming with AspectJ<sup>&reg;</sup></h1>
+
+<div class="presenter">Erik Hilsdale</div>
+<div class="presenter">Mik Kersten</div>
+<div class="presenter">http://www.eclipse.com/aspectj</div>
+
+<h2>Overview</h2>
+
+<p> In this tutorial you will solve some canonical programming
+tasks using AspectJ. The tasks progress from writing
+non-functional, development-only aspects to writing aspects that
+augment a deployed program with crosscutting features. This
+follows the same progression most users see in their own adoption
+of AspectJ. </p>
+
+<p> Since this is a hands-on tutorial, you will be working with a
+live AspectJ distribution. The example code we will be working
+with is a simple figure editor, along with JUnit tests for each
+exercise. We will break up into groups of two to three people
+per computer to foster discussion within the group as well as
+with the presenters. </p>
+
+<p> If you have a laptop running a recent version of Windows,
+MacOS or Linux, feel free to bring it along. We will provide CDs
+and other installation media for a standalone AspectJ system,
+including the figure editor code these exercises are based on and
+unit tests for the exercises. If you don't have a laptop with
+you, don't worry about it. </p>
+
+<p> These notes consist of four sections of exercises, a quick
+reference to AspectJ syntax, and a UML diagram of a figure editor
+program. </p>
+
+<div class="instruction"> If you receive these tutorial notes
+early, feel free to have a quick look, especially at the UML
+diagram and quick reference. But you'll be cheating yourself if
+you try to do the exercises early; you'll learn a lot more by
+working through it in groups during the tutorial proper. </div>
+
+<!--
+This space is used for a copyright that appears on the
+bottom of the _printed_ page. It's suppressed when viewed on
+a computer screen by the stylesheet.
+
+<div id="copyright">
+Copyright is held by the author/owner(s). <br />
+OOPSLA’04, October 24-28, 2004, Vancouver, British Columbia, Canada <br />
+2004 ACM 04/0010
+</div>
+-->
+
+<h3 class="newpage">Command-line usage</h3>
+
+<p> While the AspectJ system is well integrated with a number of
+IDEs, it can also be used as a command-line compiler. The
+standalone package we provide (containing the tests, the base
+code, JUnit, and a distribution of AspectJ) needs information
+about where Java lives (so set your JAVA_HOME environment
+variable). It assumes that you unzip it in c:\ (on Windows) or
+in your home directory (on Linux): If you put it somewhere else,
+edit <code>setpaths</code> or <code>setpaths.bat</code>, as
+appropriate.
+</p>
+
+<p> Each time you open a new shell window run
+<code>setpaths.bat</code> or <code>source setpaths</code> to
+export some other needed environment variables. </p>
+
+<p> In general, all the files in the program are listed in
+<code>base.lst</code>, including test cases and an empty answer
+aspect, <code>answers/Answer.java</code>. Therefore, if you
+write your answers there, all you need to do is compile
+<code>base.lst</code>, either in an IDE or with </p>
+
+<pre>
+$ ajc -argfile base.lst
+</pre>
+
+<p> Before you move onto another exercise, though, make sure to copy
+your answer into a different file so we can discuss the answers
+together:
+</p>
+
+<pre>
+&gt; copy answers/Answer.java answers/2a.java (Windows)
+$ cp answers/Answer.java answers/2a.java (Unix)
+</pre>
+
+<p> After building the system, you should invoke Java on the compiled
+test class. On the command-line, this this would be </p>
+
+<pre>
+$ java tests.Test2a
+</pre>
+
+<p> The default test, <code>tests.CoreTest</code>, performs some
+rudimentary tests on figure elements, and so is a useful test to run
+periodically. You should also look at the JUnit tests for each
+exercise as you do it. </p>
+
+<p> Again, we will be looking at solutions and having discussion,
+which is much more difficult without incremental solutions. So
+when you go from one exercise to the next, <strong>save your
+work</strong> in a file before going on to the next exercise
+even if you plan to duplicate some code. </p>
+
+<div class="instruction"> When we give examples of execution in
+these exercises we will show the command-line use, but of course
+you should use the appropriate compile and execute tools if you
+are using the AspectJ browser, Emacs, or Eclipse. </div>
+
+<!-- ============================== -->
+
+<h2 class="newpage">1. Static Invariants</h2>
+
+<p> The easiest way to get started with AspectJ is to use it to
+enforce static invariants.
+</p>
+
+<h3>1.a. Find old tracing</h3>
+
+<div class="instruction"> <strong>Sample Exercise</strong>: The
+main point of this exercise is to make sure your configuration
+works. Type in the answer below into your answer file, make sure
+you get the desired compile-time error, remove the offending
+line, and make sure you pass the JUnit test. </div>
+
+<p> <strong>Task:</strong> Signal an error for calls to
+<code>System.out.println</code>.
+</p>
+
+<p> The way that we are all taught to print "hello world" from Java is
+to use <code>System.out.println()</code>, so that is what we typically
+use for one-off debugging traces. It's a common mistake to leave
+these in your system far longer than is necessary. Type in the aspect
+below to signal an error at compile time if this mistake is made.
+</p>
+
+<p> <strong>Answer:</strong>
+</p>
+
+<pre>
+package answers;
+
+import figures.*;
+
+aspect Answer1a {
+ declare error
+ : get(java.io.PrintStream System.out) &amp;&amp; within(figures..*)
+ : "illegal access to System.out";
+}
+</pre>
+
+<p> When you use this on the given system, you'll find one incorrect
+trace in <code>SlothfulPoint</code>.
+</p>
+
+<pre>
+$ ajc -argfile base.lst
+./figures/SlothfulPoint.java:38 illegal access to System.out
+
+1 error
+</pre>
+
+<p> Note that this answer does not say that the <em>call</em> to the
+<code>println()</code> method is incorrect, rather, that the field get
+of the <code>out</code> field is illegal. This will also catch those
+users who bind System.out to a static field to save typing. </p>
+
+<p> After you have successfully used this aspect, edit your
+program to remove the illegal tracing call. </p>
+
+<p> Make sure your program still passes the JUnit test
+<code>tests.CoreTest</code> (which it should also pass at the beginning of
+all exercises) before continuing. </p>
+
+<pre>
+$ java tests.CoreTest
+....
+Time: 0.03
+
+OK (4 tests)
+</pre>
+
+<h3 class="newpage">1.b. Mandate setters</h3>
+
+<p> <strong>Task:</strong> Signal a warning for assignments outside
+of setter methods. </p>
+
+<p> <strong>Tools:</strong> <code>set</code>, <code>withincode</code>,
+the <code>void set*(..)</code> pattern
+</p>
+
+<p> One common coding convention is that no private field should
+be assigned to outside of setter methods. Write an aspect to
+signal a warning at compile time for these illegal assignment
+expressions. </p>
+
+<p> This is going to look like
+</p>
+
+<pre>
+aspect A {
+ declare warning: <em>&lt;pointcut here&gt;</em> : "bad field set";
+}
+</pre>
+
+<p> where the pointcut picks out join points of private field sets
+outside of setter methods. "Outside", here, means that the code for
+the assignment is outside the <em>text</em> of the setter.
+
+<p> Make sure your program still passes the JUnit test
+<code>tests.CoreTest</code> before continuing. Make sure you get eleven
+warnings from this. Wait to fix them until the next exercise. </p>
+
+<h3>1.c. Refine setters mandate</h3>
+
+<p> <strong>Task:</strong> Allow assignmnents inside of constructors.
+</p>
+
+<p> <strong>Tools:</strong> the <code>new(..)</code> pattern</p>
+
+<p> Look at some of the warnings from the previous exercise. Notice
+that a lot of them are from within constructors. Actually, the common
+coding convention is that no private field should be assigned to outside of
+setter methods <em>or constructors</em>. Modify your answer to signal
+an actual error at compile time (rather than just a warning) when such
+an illegal assignment expression exists. </p>
+
+<p>You'll want to add another <code>withincode</code> primitive
+pointcut to deal with the constructors.
+</p>
+
+<p>After you specify your pointcut correctly, you'll still find that
+the convention is violated twice in the figures package. You should see
+the following two errors:</p>
+
+<pre>
+.\figures\Point.java:37 bad field set
+.\figures\Point.java:38 bad field set
+
+2 errors
+</pre>
+
+<p>Rewrite these two occurrences so as not to violate
+the convention. Make sure your program still passes the JUnit test
+<code>tests.CoreTest</code> before continuing. </p>
+
+<div class="instruction"> Congratulations, you've taken your
+first steps. At this point, check the people to your left and
+right. If they're stuck somewhere, see if you can help them.
+Try to resist moving on to the next section until we discuss
+solutions as a group. </div>
+
+<!-- ============================== -->
+
+<h2 class="newpage">2. Dynamic invariants</h2>
+
+<p> The next step in AspectJ adoption is often to augment a test suite
+by including additional dynamic tests.
+</p>
+
+<div class="instruction"> Tutorial attendees typically progress
+at different speeds through these exercises. Throughout this
+tutorial, if you finish early, see what the people around you are
+doing and if they need help. Don't help them out of charity,
+help them out of naked self-interest&mdash;we promise you'll learn a
+lot about using AspectJ by explaining it. </div>
+
+<h3>2.a. Check a simple precondition</h3>
+
+<div class="instruction"> <strong>Sample Exercise</strong>: We've
+provided the answer to this exercise to get you started. Feel
+free to think a bit, but don't get stuck on this one. </div>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test2a</code>.
+</p>
+
+<p> <strong>Tools:</strong> <code>args</code>, <code>before</code>
+</p>
+
+<p> Write an aspect to throw an <code>IllegalArgumentException</code>
+whenever an attempt is made to set one of <code>Point</code>'s
+<code>int</code> fields to a value that is less than zero. </p>
+
+<p> This should make the test case of <code>tests.Test2a</code> pass,
+which wouldn't without your aspect. So before compiling in the
+aspect,
+</p>
+
+<pre>
+$ java tests.Test2a
+.F..F....
+Time: 0.04
+There were 2 failures:
+1) testTooSmall(tests.Test2a)junit.framework.AssertionFailedError: should have thrown IllegalArgumentException
+2) testMove(tests.Test2a)junit.framework.AssertionFailedError: should have thrown IllegalArgumentException
+
+FAILURES!!!
+Tests run: 7, Failures: 2, Errors: 0
+</pre>
+
+<p> But after compiling in the aspect...
+</p>
+
+<pre>
+$ ajc -argfile base.lst answers/Answer.java
+
+$ java tests.Test2a
+.......
+Time: 0.04
+
+OK (7 tests)
+</pre>
+
+<p> <strong>Answer:</strong>
+</p>
+
+<pre>
+package answers;
+
+import figures.*;
+
+aspect Answer2a {
+ before(int newValue): set(int Point.*) &amp;&amp; args(newValue) {
+ if (newValue &lt; 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
+</pre>
+
+<h3>2.b. Check another precondition</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test2b</code>. </p>
+
+<p> <strong>Tools: </strong> <code>call</code>.
+</p>
+
+<p> <code>Group</code> is a <code>FigureElement</code> class that
+encapsulates groups of other figure elements. As such, only actual
+figure element objects should be added to <code>Group</code> objects.
+Write an aspect to throw an <code>IllegalArgumentException</code>
+whenever <code>Group.add()</code> is called with a <code>null</code>
+value. </p>
+
+<p> Look at <code>tests/Test2b.java</code> to see exactly what we're
+testing for. </p>
+
+<h3>2.c. Check yet another precondition</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test2c</code>. </p>
+
+<p> <strong>Tools:</strong> <code>target</code>
+</p>
+
+<p> Another constraint on a well-formed group is that it should not
+contain itself as a member (though it may contain other groups). Write
+an aspect to throw an <code>IllegalArgumentException</code> whenever
+an attempt is made to call <code>Group.add()</code> on a
+<code>null</code> value, or on the group itself. </p>
+
+<p> You will want to use a <code>target</code> pointcut to expose the
+<code>Group</code> object that is the target of the <code>add</code>
+call.
+</p>
+
+<h3>2.d. Assure input</h3>
+
+<p> <strong>Task: </strong> Pass <code>tests.Test2d</code>.
+</p>
+
+<p> <strong>Tools: </strong> around advice
+</p>
+
+<p> Instead of throwing an exception when one of <code>Point</code>'s
+<code>int</code> fields is set to a negative value, write an aspect
+to trim the value to zero. You'll want to use <code>around</code>
+advice that exposes the new value of the field assignment with an
+<code>args</code> pointcut, and <code>proceed</code> with the trimmed
+value. </p>
+
+<p> This is going to look something like
+</p>
+
+<pre>
+aspect A {
+ void around(int val): <var>&lt;Pointcut&gt;</var> {
+ <var>&lt;Do something with val&gt;</var>
+ proceed(val);
+ }
+}
+</pre>
+
+<h3 class="newpage">2.e. Check a postcondition</h3>
+
+<p> <strong>Task: </strong> Pass <code>tests.Test2e</code>
+</p>
+
+<p> <strong>Tools: </strong> around advice
+</p>
+
+<p> A postcondition of a <code>Point</code>'s <code>move</code>
+operation is that the <code>Point</code>'s coordinates should change.
+If a call to move didn't actually move a point by the desired
+offset, then the point is in an illegal state and so an
+<code>IllegalStateException</code> should be thrown.
+</p>
+
+<p> Note that because we're dealing with how the coordinates change
+during move, we need some way of getting access to the coordinates
+both before <em>and</em> after the move, in one piece of advice. </p>
+
+<h3>2.f. Check another postcondition</h3>
+
+<p> <strong>Task: </strong> Pass <code>tests.Test2f</code>
+</p>
+
+<p> <strong>Tools:</strong> the <code> Rectangle(Rectangle)</code>
+constructor, the <code>Rectangle.translate(int, int)</code> method.
+</p>
+
+<p> <code>FigureElement</code> objects have a <code>getBounds()</code>
+method that returns a <code>java.awt.Rectangle</code> representing the
+bounds of the object. An important postcondition of the general
+<code>move</code> operation on a figure element is that the figure
+element's bounds rectangle should move by the same amount as the
+figure itself. Write an aspect to check for this postcondition --
+throw an <code>IllegalStateException</code> if it is violated. </p>
+
+<!-- ============================== -->
+
+<h2 class="newpage">3. Tracing</h2>
+
+<p> Tracing is one of the classic AspectJ applications, and is often
+the first where AspectJ is used on deployed code.
+</p>
+
+<h3>3.a. Simple tracing</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test3a</code>.</p>
+
+<p> <strong>Tools:</strong>
+ <code>Log.write(String)</code>,
+ <code>thisJoinPoint.toString()</code>,
+ <code>execution</code>,
+ <code>within</code>
+</p>
+
+<p> Write an aspect to log the execution of all public methods
+in the figures package. To do this, use the utility class
+<code>Log</code> (this is in the <code>support</code> package, so
+remember to import it into your answer aspect). Write a message
+into the log with the static <code>write(String)</code> method.</p>
+
+<h3>3.b. Exposing a value</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test3b</code>.</p>
+
+<p> <strong>Tools:</strong> <code>target</code>
+</p>
+
+<p> AspectJ can expose the target object at a join point for tracing.
+In this exercise, you will print not only the join point information,
+but also the target object, with the form
+</p>
+
+<pre>
+<em>thisJoinPointInfo</em> at <em>targetObject</em>
+</pre>
+
+
+<h3>3.c. More specialized logging</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test3c</code>.</p>
+
+<p> <strong>Tools:</strong> <code>args</code>.
+</p>
+
+<p> Write an aspect to log whenever a <code>Point</code> is added to a
+group. The <code>args</code> pointcut allows you to select join points
+based on the type of a parameter to a method call. </p>
+
+<p> Look at the test case to see the trace message we expect you
+to write in the log.
+</p>
+
+<h3 class="newpage">3.d. Logging extended to checking an invariant</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test3d</code>.</p>
+
+<p> <strong>Tools:</strong> <code>inter-type field declaration</code>
+</p>
+
+<p> Make sure that a <code>Point</code> is never added to more
+than one <code>Group</code>. To do so, associate a boolean flag
+with each <code>Point</code> using an inter-type declaration,
+such as </p>
+
+<pre>
+boolean Point.hasBeenAdded = false;
+</pre>
+
+<p> Check and set this flag with the same kind of advice from your
+answer to problem (c). Throw an <code>IllegalStateException</code> if
+the point has already been added.
+</p>
+
+<h3>3.e. Better error messages for 3.d.</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test3e</code>.</p>
+
+<p> Extend your solution to problem (d) by using the string
+representation of the Point's containing group as the <code>msg</code>
+part of the <code>IllegalStateException</code>. </p>
+
+<!-- ============================== -->
+
+<h2 class="newpage">4. Caching</h2>
+
+<p> Computation of the bounding box of <code>Group</code> objects
+needs to deal with all aggregate parts of the group, and this
+computation can be expensive. In this section, we will explore
+various ways of reducing this expense. </p>
+
+<div class="instruction"> <strong>Optional</strong>: In all of
+these exercises, you should only deal with points that are added
+directly to Groups, rather than those that are added "indirectly"
+through Lines and Boxes. You should handle those points
+contained in Lines and Boxes only if time permits. </div>
+
+<h3>4.a. Make a constant override</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test4a</code>.</p>
+
+<p> <strong>Tools:</strong> <code>around</code>,
+ <code>FigureElement.MAX_BOUNDS</code>
+</p>
+
+<p> <code>Group</code>'s <code>getBounds()</code> method could be
+understood to be a conservative approximation of the bounding box of a
+group. If that is true, then it would be a legal (and much faster)
+implementation of <code>getBounds()</code> to simply always return a
+rectangle consisting of the entire canvas. The entire canvas is returned
+by the static method <code>FigureElement.MAX_BOUNDS</code>.
+</p>
+
+<p> Write an aspect to implement this change. You can override
+<code>Group</code>'s <code>getBounds()</code> method entirely with
+around advice intercepting the method.
+</p>
+
+<h3>4.b. Make a constant cache</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test4b</code>.
+</p>
+
+<p> <strong>Tools:</strong> inter-type field.
+</p>
+
+<p> Instead of making the (very) conservative approximation of
+<code>getBounds()</code> from part (a), write an aspect instead that
+remembers the return value from the first time
+<code>getBounds()</code> has been called on a <code>Group</code>, and
+returns that first <code>Rectangle</code> for every subsequent
+call. </p>
+
+<p> <em>Hint: You can use an inter-type declaration to keep some
+state for every <code>Group</code> object.</em> </p>
+
+
+<h3>4.c. Invalidate, part 1</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test4c</code>.
+</p>
+
+<p> <strong>Tools:</strong> <code>before</code>
+</p>
+
+<p> While caching in this way does save computation, it will lead to
+incorrect bounding boxes if a <code>Group</code> is ever moved.
+Change your aspect so that it invalidates the cache whenever the
+<code>move()</code> method of <code>Group</code> is called.
+</p>
+
+<h3 class="newpage">4.d. Invalidate, part 2</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test4d</code>.</p>
+
+<p> Of course, part (c) didn't really solve the problem. What if a
+<code>Point</code> that is part of a <code>Group</code> moves?
+Whenever either of a Point's fields are set it should invalidate the
+caches of all enclosing groups. Use your solution to problem 3c to
+modify your invalidation criteria in this way, but note that this is
+slightly different than the problem in 3c: Here you care about fields,
+where there you cared about method calls. </p>
+
+<h3>4.e. Invalidate, part 3</h3>
+
+<p> <strong>Task:</strong> Pass <code>tests.Test4e</code>.</p>
+
+<p> <strong>Tools:</strong> <em>You're on you're own</em></p>
+
+<p> Did you really do part (d) correctly? Run the JUnit test
+<code>tests.Test4e</code> to see. If you pass, congratulations, now
+go help other people. Otherwise, you have fallen prey to our cruel
+trap: Remember that whenever a point moves it should invalidate the
+caches of <em>all</em> enclosing groups. </p>
+
+<div class="instruction">
+
+<p> Congratulations! Not only have you learned about how to
+program in AspectJ, you have worked through exercises paralleling
+a common AspectJ adoption strategy. You should be able to
+pick up AspectJ and use it to improve your own software's
+crosscutting modularity. </p>
+
+<p> You can find the current binaries, source, documentation and
+an active user community for AspectJ at</p>
+
+ <blockquote>
+ https://www.eclipse.org/aspectj
+ </blockquote>
+
+</div>
+
+<img style="newpage" src="figures_classes.png" height="900" alt="" />
+
+</body> </html>
diff --git a/docs/modules/ROOT/pages/teaching/exercises/install.txt b/docs/modules/ROOT/pages/teaching/exercises/install.txt
new file mode 100644
index 000000000..ccb2b9e71
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/install.txt
@@ -0,0 +1,63 @@
+0. Install
+
+ Now get the directory "aj-@aj.event@/". Just copy the
+ "aj-@aj.event@/" directory from the provided CD.
+
+ If you're running a Windows machine, we recommend you copy into
+ "c:\". If you're running your favorite Unix (we've had success under
+ Linux and MacOS X), we recommend you install into "~\".
+
+1. Configure
+
+ Our installation is fairly well self-contained, but it does need to know
+ where Java lives. To do this you must set the environment variable named
+ JAVA_HOME. This variable should point to something like
+
+ c:\apps\jdk1.3.1_04
+ /usr/java
+ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
+
+ depending on your system. You may either do this globally, or you may
+ edit the appropriate setpaths script:
+
+ setpaths.bat (under Windows)
+ setpaths.sh (if you run bash/sh/ksh, like most Linux setups)
+ setpaths.csh (if you run csh, like most MacOS X setups)
+
+ Also, if you installed into a directory other than "c:\" or "~/", then you
+ need to change the EXTRACTION environment variable in the setpaths script.
+
+2. Test
+
+ Open a new command shell and change to the "aj-@aj.event@/" directory.
+
+ We have provided a "setpaths" script to set permissions and various paths
+ variables, so run this script:
+
+ > setpaths.bat (under Windows)
+ > source setpaths.sh (if you run bash/sh/ksh, like most Linux setups)
+ > source setpaths.csh (if you run csh, like most MacOS X setups)
+
+ You must remember to run this script every time you open a new command
+ shell.
+
+ Now, compile the core system with ajc:
+
+ > ajc -argfile guibase.lst
+
+ This should compile the figures application (source code in the figures
+ directory) as well as a single unit test (source code in the tests
+ directory).
+
+ See if the compile was successful by running the gui figures app you just
+ compiled:
+
+ > java figures.gui.Main
+
+ And, after quitting out of the gui figures app, run the unit test:
+
+ > java tests.Test
+ ....
+ Time: 0.076
+
+ OK (4 tests)
diff --git a/docs/modules/ROOT/pages/teaching/exercises/junit.jar b/docs/modules/ROOT/pages/teaching/exercises/junit.jar
new file mode 100644
index 000000000..674d71e89
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/junit.jar
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/index.adoc b/docs/modules/ROOT/pages/teaching/exercises/plugins/index.adoc
new file mode 100644
index 000000000..1cdf0fbc1
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/index.adoc
@@ -0,0 +1,19 @@
+== Exercises plugin for the tutorial
+
+Download the appropriate version and unzip it in your eclipse\plugins
+directory:
+
+[cols=",",]
+|===
+|For Eclipse 3.0 with AJDT 1.1.12
+|https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zip?rev=1.1&cvsroot=Technology_Project[org.aspectj.tutorial.exercises_1.1.12.zip]
+
+|For Eclipse 3.0 with AJDT 1.2.0M2
+|https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zip?rev=1.1&cvsroot=Technology_Project[org.aspectj.tutorial.exercises_1.2.0M2.zip]
+
+|For Eclipse 3.0 with AJDT 1.2.0 latest dev build
+|https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip?rev=1.1&cvsroot=Technology_Project[org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip]
+
+|For Eclipse 3.1M5 with AJDT 1.2.0 latest dev build
+|https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip?rev=1.1&cvsroot=Technology_Project[org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip]
+|===
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/index.html b/docs/modules/ROOT/pages/teaching/exercises/plugins/index.html
new file mode 100644
index 000000000..ef87c84c8
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/index.html
@@ -0,0 +1,31 @@
+<html>
+<head>
+</head>
+<body>
+<h1>Exercises plugin for the tutorial</h1>
+
+<p>Download the appropriate version and unzip it in your eclipse\plugins directory:</p>
+<table>
+<tr>
+<td>For Eclipse 3.0 with AJDT 1.1.12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+<td><a href="https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zip?rev=1.1&cvsroot=Technology_Project">
+org.aspectj.tutorial.exercises_1.1.12.zip</a></td>
+</tr>
+<tr>
+<td>For Eclipse 3.0 with AJDT 1.2.0M2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+<td><a href="https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zip?rev=1.1&cvsroot=Technology_Project">
+org.aspectj.tutorial.exercises_1.2.0M2.zip</a></td>
+</tr>
+<tr>
+<td>For Eclipse 3.0 with AJDT 1.2.0 latest dev build&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+<td><a href="https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip?rev=1.1&cvsroot=Technology_Project">
+org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip</a></td>
+</tr>
+<tr>
+<td>For Eclipse 3.1M5 with AJDT 1.2.0 latest dev build&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+<td><a href="https://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.aspectj/modules/docs/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip?rev=1.1&cvsroot=Technology_Project">
+org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip</a></td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zip b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zip
new file mode 100644
index 000000000..674af9cd7
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.1.12.zip
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zip b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zip
new file mode 100644
index 000000000..90a4acc86
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0M2.zip
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip
new file mode 100644
index 000000000..6c192738c
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_301_Dev.zip
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip
new file mode 100644
index 000000000..3c817b274
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/plugins/org.aspectj.tutorial.exercises_1.2.0_31M5_Dev.zip
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/exercises/pre-letter.txt b/docs/modules/ROOT/pages/teaching/exercises/pre-letter.txt
new file mode 100644
index 000000000..4833beeb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/pre-letter.txt
@@ -0,0 +1,130 @@
+Dear OOPSLA 2002 attendee;
+
+We have you listed as being registered for tutorial T40,
+Aspect-oriented programming with AspectJ. We are excited about giving
+this tutorial, and hope you will enjoy the presentation, exercises and
+discussion we have prepared.
+
+As with our past tutorials of this form, in the afternoon we would
+like to break the attendees into groups of two or three and work
+through a number of AspectJ exercises together.
+
+We will be bringing media and making ourselves available during breaks
+for help with setup, but in order to jump straight in and give you the
+most we can from this tutorial, it would really help us if many of you
+had an AspectJ environment installed early.
+
+This message contains basic instructions on where to get some needed
+tools. These instructions will not take much time.
+
+If you are planning to bring a laptop to the tutorial, would you
+please take the time to do the steps outlined in this message?
+
+If you're not planning to, you might want to install an AspectJ
+environment on your desktop anyway and try the instructions below, so
+you will be comfortable when we meet on Wednesday.
+
+[If you already have a working AspectJ environment and are familliar
+with it, we still recommend that you upgrade to 1.0.6 and follow the
+steps below]
+
+Thank you, and please don't hesitate to contact us (at
+support@aspectj.org) if you have any questions. See you on
+Wednesday...
+
+-Erik Hilsdale,
+ Jim Hugunin,
+ and the whole AspectJ Team
+
+
+Getting Ready for T40, Aspect-oriented programming with AspectJ
+--------------------------------------
+
+Overview:
+
+ 0. Install AspectJ
+ 1. Download JUnit and put it on your classpath
+ 2. Test your setup
+
+------------------------------
+0. AspectJ
+
+Download the AspectJ 1.0.6 from
+
+ http://aspectj.org/dl
+
+You should definitly download and intstall the tools package and the
+docs package. If you plan to use JBuilder, Forte/NetBeans, Emacs, or
+Eclipse for your development, you should download the appropriate
+plugin.
+
+
+------------------------------
+1. JUnit
+
+We use the JUnit framework for testing our exercises. Download JUnit
+from
+
+ http://www.junit.org
+
+and place junit.jar on your CLASSPATH.
+
+
+------------------------------
+2. Test your setup
+
+a. Create a file "Hello.java" with this class:
+
+ class Hello {
+ public static void main(String[] args) {
+ System.err.println(getHelloString());
+ }
+ public static String getHelloString() {
+ return "Hello, WORLD";
+ }
+ }
+
+b. Compile the class with ajc and run it...
+
+ > ajc Hello.java
+ > java Hello
+ Hello, WORLD
+
+c. Create a file "TestHello.java" with this class:
+
+ public class TestHello extends junit.framework.TestCase {
+ public TestHello(String name) {
+ super(name);
+ }
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(TestHello.class);
+ }
+ public void testHello() {
+ assertEquals("Hello, OOPSLA", Hello.getHelloString());
+ }
+ }
+
+d. Compile the class with ajc and run it...
+
+ > ajc TestHello.java
+ > java TestHello
+ .F
+ Time: 0.01
+ There was 1 failure:
+ 1) testHello(TestHello)junit.framework.ComparisonFailure:
+ expected:<...OOPSLA> but was:<...WORLD>
+ at TestHello.testHello(TestHello.java:9)
+ at TestHello.main(TestHello.java:6)
+
+ FAILURES!!!
+ Tests run: 1, Failures: 1, Errors: 0
+
+e. Oops... the test case seems to want a different string than the
+ tested class. Fix that, compile whichever file you changed with
+ ajc, run the tester again, and you're done. Thanks!
+
+ > java TestHello
+ .
+ Time: 0
+
+ OK (1 test)
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser
new file mode 100644
index 000000000..2f804efda
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+"$JAVA_HOME/bin/java" -classpath "$ASPECTJ_HOME/lib/aspectjtools.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH" -Xmx64M org.aspectj.tools.ajbrowser.Main "$@"
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser.bat b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser.bat
new file mode 100644
index 000000000..dd717ccae
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajbrowser.bat
@@ -0,0 +1,9 @@
+@echo off
+if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
+if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
+if exist "%JAVA_HOME%\bin\java" goto haveJava
+echo java does not exist as %JAVA_HOME%\bin\java
+echo please fix the JAVA_HOME environment variable
+
+:haveJava
+"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar;%JAVA_HOME%\lib\tools.jar;%CLASSPATH%" -Xmx64M org.aspectj.tools.ajbrowser.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc
new file mode 100644
index 000000000..f8f45ee35
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+"$JAVA_HOME/bin/java" -classpath "$ASPECTJ_HOME/lib/aspectjtools.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH" -Xmx64M org.aspectj.tools.ajc.Main "$@"
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc.bat b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc.bat
new file mode 100644
index 000000000..ca51b07be
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/ajc.bat
@@ -0,0 +1,9 @@
+@echo off
+if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
+if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
+if exist "%JAVA_HOME%\bin\java" goto haveJava
+echo java does not exist as %JAVA_HOME%\bin\java
+echo please fix the JAVA_HOME environment variable
+
+:haveJava
+"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar;%JAVA_HOME%\lib\tools.jar;%CLASSPATH%" -Xmx64M org.aspectj.tools.ajc.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.bat b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.bat
new file mode 100644
index 000000000..390eec58a
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.bat
@@ -0,0 +1,15 @@
+@echo off
+
+rem Change this to be the full path for this directory
+set EXTRACTION=c:\aj-@aj.event@
+
+if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
+if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
+if exist "%JAVA_HOME%\bin\java" goto haveJava
+echo java does not exist as %JAVA_HOME%\bin\java
+echo please fix the JAVA_HOME environment variable
+
+:haveJava
+set ASPECTJ_HOME=%EXTRACTION%\aspectj
+set PATH=%ASPECTJ_HOME%\bin;%PATH%
+set CLASSPATH=.;%ASPECTJ_HOME%\lib\aspectjrt.jar;%EXTRACTION%\junit.jar;%JAVA_HOME%\jre\lib\rt.jar
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.csh b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.csh
new file mode 100644
index 000000000..276bbf4d1
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.csh
@@ -0,0 +1,11 @@
+# this file should be sourced, NOT executed
+
+# Change this to be the full path for this directory
+set EXTRACTION=$HOME/aj-@aj.event@
+
+set ASPECTJ_HOME=$EXTRACTION/aspectj
+set PATH=$ASPECTJ_HOME/bin:$PATH
+set CLASSPATH=.:$ASPECTJ_HOME/lib/aspectjrt.jar:$EXTRACTION/junit.jar:$JAVA_HOME/jre/lib/rt.jar
+
+chmod a+x $ASPECTJ_HOME/bin/ajc
+chmod a+x $ASPECTJ_HOME/bin/ajbrowser
diff --git a/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.sh b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.sh
new file mode 100644
index 000000000..e944776ed
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/scripts/setpaths.sh
@@ -0,0 +1,18 @@
+# this file should be sourced, NOT executed
+
+# Change this to be the full path for this directory
+EXTRACTION=$HOME/aj-@aj.event@
+
+if [ "$JAVA_HOME" = "" ]
+then
+ echo Please remember to manually set $JAVA_HOME to
+ echo the location of your java installation
+fi
+
+export ASPECTJ_HOME=$EXTRACTION/aspectj
+export PATH=$ASPECTJ_HOME/bin:$PATH
+export CLASSPATH=.:$ASPECTJ_HOME/lib/aspectjrt.jar:$EXTRACTION/junit.jar:$JAVA_HOME/jre/lib/rt.jar
+
+chmod a+x $ASPECTJ_HOME/bin/ajc
+chmod a+x $ASPECTJ_HOME/bin/ajbrowser
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/setpaths b/docs/modules/ROOT/pages/teaching/exercises/setpaths
new file mode 100644
index 000000000..2933d3a89
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/setpaths
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Change this to be the full path for this directory
+EXTRACTION=$HOME/aj-oopsla
+
+if [ "$JAVA_HOME" = "" ]
+then
+ echo Please remember to manually set $JAVA_HOME to
+ echo the location of your java installation
+fi
+
+export ASPECTJ_HOME=$EXTRACTION/aspectj
+export PATH=$ASPECTJ_HOME/bin:$PATH
+export CLASSPATH=.:$ASPECTJ_HOME/lib/aspectjrt.jar:$EXTRACTION/junit.jar
diff --git a/docs/modules/ROOT/pages/teaching/exercises/setpaths.bat b/docs/modules/ROOT/pages/teaching/exercises/setpaths.bat
new file mode 100644
index 000000000..6722060ea
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/setpaths.bat
@@ -0,0 +1,15 @@
+@echo off
+
+rem Change this to be the full path for this directory
+set EXTRACTION=c:\aj-oopsla
+
+if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
+if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
+if exist "%JAVA_HOME%\bin\java" goto haveJava
+echo java does not exist as %JAVA_HOME%\bin\java
+echo please fix the JAVA_HOME environment variable
+
+:haveJava
+set ASPECTJ_HOME=%EXTRACTION%\aspectj
+set PATH=%ASPECTJ_HOME%\bin;%PATH%
+set CLASSPATH=.;%ASPECTJ_HOME%\lib\aspectjrt.jar;%EXTRACTION%\junit.jar
diff --git a/docs/modules/ROOT/pages/teaching/exercises/support/Log.java b/docs/modules/ROOT/pages/teaching/exercises/support/Log.java
new file mode 100644
index 000000000..7c615836e
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/support/Log.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package support;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class Log {
+ static List data = new ArrayList();
+
+ public static void write(String s) {
+ data.add(s);
+ }
+
+ public static List getData() {
+ return data;
+ }
+
+ public static void clear() {
+ data.clear();
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/CoreTest.java b/docs/modules/ROOT/pages/teaching/exercises/tests/CoreTest.java
new file mode 100644
index 000000000..e069e67b5
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/CoreTest.java
@@ -0,0 +1,79 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class CoreTest extends TestCase {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test.class);
+ }
+
+ Box bb;
+ Point p1;
+ Point p2;
+ Line l1;
+ SlothfulPoint sloth1;
+ Group g;
+
+ public void setUp() {
+ p1 = new Point(10, 100);
+ p2 = new Point(20, 200);
+ l1 = new Line(p1, p2);
+ bb = new Box(5, 5, 10, 10);
+ sloth1 = new SlothfulPoint(0, 0);
+ g = new Group(p1);
+ }
+
+ public final void testCreate() {
+ assertEquals(p1.getX(), 10);
+ assertEquals(p1.getY(), 100);
+
+ assertEquals(l1.getP1(), p1);
+ assertEquals(l1.getP2(), p2);
+ }
+
+ public final void testSetPoint() {
+ p1.setX(20);
+ assertEquals(p1.getX(), 20);
+ assertEquals(p1.getY(), 100);
+
+ p1.setY(10);
+ assertEquals(p1.getX(), 20);
+ assertEquals(p1.getY(), 10);
+ }
+
+ public final void testMoveLine1() {
+ l1.move(40, 40);
+ assertEquals(l1.getP1(), p1);
+ assertEquals(l1.getP2(), p2);
+
+ assertEquals(p1.getX(), 50);
+ assertEquals(p1.getY(), 140);
+
+ assertEquals(p2.getX(), 60);
+ assertEquals(p2.getY(), 240);
+ }
+
+ public final void testMoveLine2() {
+ l1.move(-10, -10);
+ assertEquals(p1.getX(), 0);
+ assertEquals(p1.getY(), 90);
+
+ assertEquals(p2.getX(), 10);
+ assertEquals(p2.getY(), 190);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2a.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2a.java
new file mode 100644
index 000000000..8035a0543
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2a.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2a extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2a.class);
+ }
+
+ public void testTooSmall() {
+ Point p1 = new Point(10, 100);
+ try {
+ p1.setX(-10);
+ fail("should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ea) {
+ }
+ }
+
+ public void testNotTooSmall() {
+ Point p1 = new Point(10, 100);
+ p1.setX(0);
+ }
+
+ public void testMove() {
+ Line l1 = new Line(new Point(10, 100), new Point(20, 200));
+ try {
+ l1.move(-500, -500);
+ fail("should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ea) {
+ }
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2b.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2b.java
new file mode 100644
index 000000000..2e2fecf73
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2b.java
@@ -0,0 +1,44 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2b extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2b.class);
+ }
+
+ public void testNull() {
+ Point p1 = new Point(10, 100);
+ Group g = new Group(p1);
+
+ try {
+ g.add(null);
+ fail("should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ea) {
+ }
+ }
+
+ public void testNonNull() {
+ Point p1 = new Point(10, 100);
+ Group g = new Group(p1);
+ Point p2 = new Point(20, 200);
+
+ g.add(p2);
+ }
+
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2c.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2c.java
new file mode 100644
index 000000000..2bb7093ee
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2c.java
@@ -0,0 +1,43 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2c extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2c.class);
+ }
+
+ public void testSelf() {
+ Point p1 = new Point(10, 100);
+ Group g = new Group(p1);
+
+ try {
+ g.add(g);
+ fail("should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ea) {
+ }
+ }
+
+ public void testNotSelf() {
+ Point p1 = new Point(10, 100);
+ Group g1 = new Group(p1);
+ Group g2 = new Group(p1);
+
+ g1.add(g2);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2d.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2d.java
new file mode 100644
index 000000000..baabd9aea
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2d.java
@@ -0,0 +1,44 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2d extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2d.class);
+ }
+
+ public void testOutOfBounds() {
+ Point p1 = new Point(10, 100);
+
+ p1.setX(-10);
+ p1.setY(-100);
+
+ assertEquals(0, p1.getX());
+ assertEquals(0, p1.getY());
+ }
+
+ public void testInBounds() {
+ Point p1 = new Point(10, 100);
+
+ p1.setX(30);
+ p1.setY(300);
+
+ assertEquals(30, p1.getX());
+ assertEquals(300, p1.getY());
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2e.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2e.java
new file mode 100644
index 000000000..bf388cbb6
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2e.java
@@ -0,0 +1,37 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2e extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2e.class);
+ }
+
+ public void testNonMoving() {
+ Point sp = new Point(10, 10) { public void move(int x, int y) {} };
+ try {
+ sp.move(10, 10);
+ fail("should have thrown IllegalStateException");
+ } catch (IllegalStateException e) { }
+ }
+
+ public void testMoving() {
+ Point p1 = new Point(10, 100);
+ p1.move(3, 30);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test2f.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2f.java
new file mode 100644
index 000000000..adcf58923
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test2f.java
@@ -0,0 +1,40 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+
+import junit.framework.*;
+
+public class Test2f extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test2f.class);
+ }
+
+ public void testSloth() {
+ FigureElement fe = new SlothfulPoint(10, 10);
+ try {
+ fe.move(10, 10);
+ fail("should have thrown IllegalStateException");
+ } catch (IllegalStateException e) { }
+ }
+
+ public void testNonSloth() {
+ Point p1 = new Point(10, 100);
+ Point p2 = new Point(20, 200);
+ Line l1 = new Line(p1, p2);
+
+ l1.move(3, 30);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test3a.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3a.java
new file mode 100644
index 000000000..8baf39096
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3a.java
@@ -0,0 +1,59 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import support.Log;
+import junit.framework.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class Test3a extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test3a.class);
+ }
+
+ public void testMovePointLog() {
+ Point p1 = new Point(10, 100);
+
+ Log.clear();
+ p1.move(20, 30);
+ List foundLog = Log.getData();
+
+ List desiredLog =
+ Arrays.asList(new String[] {
+ "execution(void figures.Point.move(int, int))"
+ });
+
+ assertEquals(desiredLog, foundLog);
+ }
+
+ public void testMoveLineLog() {
+ Point p1 = new Point(10, 100);
+ Point p2 = new Point(20, 200);
+ Line l = new Line(p1, p2);
+
+ Log.clear();
+ l.move(20, 30);
+ List foundLog = Log.getData();
+
+ List desiredLog =
+ Arrays.asList(new String[] {
+ "execution(void figures.Line.move(int, int))",
+ "execution(void figures.Point.move(int, int))",
+ "execution(void figures.Point.move(int, int))"
+ });
+ assertEquals(desiredLog, foundLog);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test3b.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3b.java
new file mode 100644
index 000000000..294951824
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3b.java
@@ -0,0 +1,59 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import support.Log;
+import junit.framework.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class Test3b extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test3b.class);
+ }
+
+ public void testMovePointLog() {
+ Point p1 = new Point(10, 100);
+
+ Log.clear();
+ p1.move(20, 30);
+ List foundLog = Log.getData();
+
+ List desiredLog =
+ Arrays.asList(new String[] {
+ "execution(void figures.Point.move(int, int)) at Point(10, 100)"
+ });
+
+ assertEquals(desiredLog, foundLog);
+ }
+
+ public void testMoveLineLog() {
+ Point p1 = new Point(10, 100);
+ Point p2 = new Point(20, 200);
+ Line l = new Line(p1, p2);
+
+ Log.clear();
+ l.move(20, 30);
+ List foundLog = Log.getData();
+
+ List desiredLog =
+ Arrays.asList(new String[] {
+ "execution(void figures.Line.move(int, int)) at Line(Point(10, 100), Point(20, 200))",
+ "execution(void figures.Point.move(int, int)) at Point(10, 100)",
+ "execution(void figures.Point.move(int, int)) at Point(20, 200)"
+ });
+ assertEquals(desiredLog, foundLog);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test3c.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3c.java
new file mode 100644
index 000000000..d563d8056
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3c.java
@@ -0,0 +1,52 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import support.Log;
+import junit.framework.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class Test3c extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test3c.class);
+ }
+
+ public void testCreateWithPointLog() {
+ Log.clear();
+ Point p1 = new Point(10, 100);
+ Group g = new Group(p1);
+ List foundLog = Log.getData();
+
+ List desiredLog =
+ Arrays.asList(new String[] {
+ "adding Point"
+ });
+ assertEquals(desiredLog, foundLog);
+ }
+
+ public void testCreateWithoutPointLog() {
+ Log.clear();
+ Point p1 = new Point(10, 100);
+ Point p2 = new Point(20, 200);
+ Line l = new Line(p1, p2);
+ Group g = new Group(l);
+ List foundLog = Log.getData();
+
+ List desiredLog = Arrays.asList(new String[] {});
+ assertEquals(desiredLog, foundLog);
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test3d.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3d.java
new file mode 100644
index 000000000..0dc4c0ad4
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3d.java
@@ -0,0 +1,38 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import support.Log;
+import junit.framework.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class Test3d extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test3d.class);
+ }
+
+ public void testDuplicateAdd() {
+ Log.clear();
+ Point p1 = new Point(10, 100);
+ Group g1 = new Group(p1);
+ try {
+ Group g2 = new Group(p1);
+ fail("should have thrown IllegalStateException");
+ } catch (IllegalStateException ea) {
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test3e.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3e.java
new file mode 100644
index 000000000..c223a83cd
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test3e.java
@@ -0,0 +1,39 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import support.Log;
+import junit.framework.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class Test3e extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test3e.class);
+ }
+
+ public void testDuplicateAdd() {
+ Log.clear();
+ Point p1 = new Point(10, 100);
+ Group g1 = new Group(p1);
+ try {
+ Group g2 = new Group(p1);
+ fail("should have thrown IllegalStateException");
+ } catch (IllegalStateException ea) {
+ assertEquals(g1.toString(), ea.getMessage());
+ }
+ }
+}
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test4a.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4a.java
new file mode 100644
index 000000000..4087f39a6
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4a.java
@@ -0,0 +1,29 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import java.awt.Rectangle;
+
+import junit.framework.*;
+
+public class Test4a extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test4a.class);
+ }
+
+ public void testGroupBounds() {
+ assertEquals(g.getBounds(), FigureElement.MAX_BOUNDS);
+ }
+}
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test4b.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4b.java
new file mode 100644
index 000000000..3429b3d24
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4b.java
@@ -0,0 +1,61 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import java.awt.Rectangle;
+
+import junit.framework.*;
+
+public class Test4b extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test4b.class);
+ }
+
+ public void testBasicEquality() {
+ assertTrue(g.getBounds() == g.getBounds());
+ }
+
+ public void testEqualityAfterAddition() {
+ Point p0 = new Point(1, 2);
+ Point p1 = new Point(2, 3);
+
+ Group g0 = new Group(p0);
+ Group g1 = new Group(p1);
+
+ Rectangle r0 = g0.getBounds();
+ Rectangle r1 = g1.getBounds();
+ assertTrue(r0 != r1);
+ g0.add(new Point(37, 90));
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+
+ g1.add(new Point(4, 8));
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+ }
+
+ public void testNotWholeCanvas() {
+ assertTrue("bounds for this group should not be the whole canvas",
+ g.getBounds().getWidth() < FigureElement.MAX_BOUNDS.getWidth());
+ assertTrue("bounds for this group should not be the whole canvas",
+ g.getBounds().getHeight() < FigureElement.MAX_BOUNDS.getHeight());
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test4c.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4c.java
new file mode 100644
index 000000000..544409db1
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4c.java
@@ -0,0 +1,78 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import java.awt.Rectangle;
+
+import junit.framework.*;
+
+public class Test4c extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test4c.class);
+ }
+
+ public void testBasicEquality() {
+ assertTrue(g.getBounds() == g.getBounds());
+ }
+
+ public void testEqualityAfterAddition() {
+ Point p0 = new Point(1, 2);
+ Point p1 = new Point(2, 3);
+
+ Group g0 = new Group(p0);
+ Group g1 = new Group(p1);
+
+ Rectangle r0 = g0.getBounds();
+ Rectangle r1 = g1.getBounds();
+ assertTrue(r0 != r1);
+ g0.add(new Point(37, 90));
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+
+ g1.add(new Point(4, 8));
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+ }
+
+ public void testEqualityAfterMove() {
+ Point p0 = new Point(1, 2);
+ Point p1 = new Point(2, 3);
+
+ Group g0 = new Group(p0);
+ Group g1 = new Group(p1);
+
+ Rectangle r0 = g0.getBounds();
+ Rectangle r1 = g1.getBounds();
+ assertTrue(r0 != r1);
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+
+ g0.move(3, 1);
+ Rectangle r00 = g0.getBounds();
+ Rectangle r10 = g1.getBounds();
+
+ assertTrue(r10 != r00);
+ assertTrue(r0 != r00);
+ assertTrue(g0.getBounds() == r00);
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test4d.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4d.java
new file mode 100644
index 000000000..dc7770f34
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4d.java
@@ -0,0 +1,75 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import java.awt.Rectangle;
+
+import junit.framework.*;
+
+public class Test4d extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test4d.class);
+ }
+
+ public void testBasicEquality() {
+ assertTrue(g.getBounds() == g.getBounds());
+ }
+
+ public void testNonGroupMove() {
+ p1.move(3, 27);
+ }
+
+ public void testEqualityAfterAddition() {
+ Rectangle r = g.getBounds();
+ g.add(new Point(37, 90));
+ assertTrue(g.getBounds() == r);
+ }
+
+ public void testEqualityAfterMove() {
+ Point p0 = new Point(1, 2);
+ Point p1 = new Point(2, 3);
+
+ Group g0 = new Group(p0);
+ Group g1 = new Group(p1);
+
+ Rectangle r0 = g0.getBounds();
+ Rectangle r1 = g1.getBounds();
+ assertTrue(r0 != r1);
+ assertTrue(g0.getBounds() == r0);
+ assertTrue(g1.getBounds() != r0);
+ assertTrue(g0.getBounds() != r1);
+ assertTrue(g1.getBounds() == r1);
+
+ p0.move(3, 1);
+ Rectangle r00 = g0.getBounds();
+ Rectangle r10 = g1.getBounds();
+
+ assertTrue(r10 != r00);
+ assertTrue(r0 != r00);
+ assertTrue(g0.getBounds() == r00);
+ }
+
+ public void testEqualityAfterMove0() {
+ g = new Group(p1);
+ Rectangle r0 = g.getBounds();
+ assertTrue(g.getBounds() == r0);
+ p1.move(3, 1);
+ Rectangle r1 = g.getBounds();
+ assertTrue(r0 != r1);
+ assertTrue(r1 == g.getBounds());
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/teaching/exercises/tests/Test4e.java b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4e.java
new file mode 100644
index 000000000..4d8b18466
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/exercises/tests/Test4e.java
@@ -0,0 +1,62 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+package tests;
+
+import figures.*;
+import java.awt.Rectangle;
+
+import junit.framework.*;
+
+public class Test4e extends CoreTest {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(Test4e.class);
+ }
+
+ public void testBasicEquality() {
+ assertTrue(g.getBounds() == g.getBounds());
+ }
+
+ public void testNonGroupMove() {
+ p1.move(3, 27);
+ }
+
+ public void testEqualityAfterAddition() {
+ Rectangle r = g.getBounds();
+ g.add(new Point(37, 90));
+ assertTrue(g.getBounds() == r);
+ }
+
+ public void testEqualityAfterMove() {
+ g = new Group(p1);
+ Rectangle r0 = g.getBounds();
+ assertTrue(g.getBounds() == r0);
+ p1.move(3, 1);
+ Rectangle r1 = g.getBounds();
+ assertTrue(r0 != r1);
+ assertTrue(r1 == g.getBounds());
+ }
+
+ public void testSecondEnclosingGroup() {
+ g = new Group(p1);
+ Group h = new Group(g);
+ Rectangle r0 = h.getBounds();
+ assertTrue(h.getBounds() == r0);
+ p1.move(3, 1);
+ Rectangle r1 = h.getBounds();
+ assertTrue(r0 != r1);
+ assertTrue(r1 == h.getBounds());
+ }
+}
+
+
diff --git a/docs/modules/ROOT/pages/teaching/oneHour.ppt b/docs/modules/ROOT/pages/teaching/oneHour.ppt
new file mode 100644
index 000000000..c6a00c4e3
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/oneHour.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/readme.txt b/docs/modules/ROOT/pages/teaching/readme.txt
new file mode 100644
index 000000000..48f4e1466
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/readme.txt
@@ -0,0 +1,11 @@
+These presentations (oneHour.ppt, tutorial.ppt, and the teaching materials in exercises) are
+Copyright (c) 1998-2002 Palo Alto Research Center, Incorporated (PARC).
+All rights reserved.
+
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
diff --git a/docs/modules/ROOT/pages/teaching/tutorial.ppt b/docs/modules/ROOT/pages/teaching/tutorial.ppt
new file mode 100644
index 000000000..01273a299
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/tutorial.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/tutorials/aosd2006_GettingToGripsWithAspectJ5.ppt b/docs/modules/ROOT/pages/teaching/tutorials/aosd2006_GettingToGripsWithAspectJ5.ppt
new file mode 100644
index 000000000..5f79cc1fe
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/tutorials/aosd2006_GettingToGripsWithAspectJ5.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/tutorials/aspectj-tutorial-cascon2005.ppt b/docs/modules/ROOT/pages/teaching/tutorials/aspectj-tutorial-cascon2005.ppt
new file mode 100644
index 000000000..d2c209271
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/tutorials/aspectj-tutorial-cascon2005.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/teaching/tutorials/eclipseForumEurope2006_AspectJIntroduction.ppt b/docs/modules/ROOT/pages/teaching/tutorials/eclipseForumEurope2006_AspectJIntroduction.ppt
new file mode 100644
index 000000000..96d56eed3
--- /dev/null
+++ b/docs/modules/ROOT/pages/teaching/tutorials/eclipseForumEurope2006_AspectJIntroduction.ppt
Binary files differ
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/build.xml b/docs/modules/ROOT/pages/test/antScriptTest/build.xml
new file mode 100644
index 000000000..7f875625c
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/build.xml
@@ -0,0 +1,142 @@
+<project default="build-test" basedir=".">
+
+ <target name="info">
+ <echo>
+ This script verifies that the example build script in the
+ Ant section of the development environment guide works.
+
+ The target "build-test" should be exactly what's copied from
+ the development environment guide, as rendered.
+
+ To setup for a given version of AspectJ, either build the
+ tools distribution or define the variable aspectj.home.
+
+ This should build the two input jars and then run the
+ test, which builds and runs an application. It should
+ request incremental input (press "q{enter}" to quit)
+ and emit the text:
+
+ [java] called Util.utility("persistMe shouting!")
+ [java] set persistMe to PERSISTME SHOUTING!
+
+ Use the "clean" target to remove generated files.
+
+ When running from eclipse, set fork.iajc="true" and
+ change build-test iajc call to avoid incremental mode.
+
+</echo>
+ </target>
+
+ <target name="init">
+ <property name="fork.iajc"
+ value="false"/>
+ <property name="home.dir"
+ location="${basedir}"/>
+ <property name="aspectj.modules.dir"
+ location="../../.."/>
+ <property name="aspectj.home"
+ location="${aspectj.modules.dir}/aj-build/dist/tools"/>
+
+ <available property="aspectj.home.available"
+ file="${aspectj.home}/lib/aspectjtools.jar"/>
+
+ <available property="aspectjtools.jar.available"
+ file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ <available property="aspectjrt.jar.available"
+ file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+
+ <available property="persist.jar.available"
+ file="${home.dir}/ec/int/persist.jar"/>
+ <available property="module.jar.available"
+ file="${home.dir}/build/module.jar"/>
+ </target>
+
+ <target name="taskdef" depends="init,local.aspectj.setup">
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <path location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="clean" depends="init">
+ <delete quiet="on">
+ <fileset dir="${home.dir}/build/binary-input"
+ excludes="ignore.txt"/>
+ <fileset dir="${home.dir}"
+ includes="ec/int/persist.jar,
+ build/module.jar,
+ output/application.jar,
+ tools/aspectj/lib/aspectj*.jar"/>
+ </delete>
+ </target>
+
+ <target name="local.aspectj.setup" depends="init"
+ unless="aspectjtools.jar.available,aspectjrt.jar.available">
+ <fail unless="aspectj.home.available"
+ message="define or build aspectj.home: ${aspectj.home}"/>
+ <mkdir dir="${home.dir}/tools/aspectj/lib/"/>
+ <copy todir="${home.dir}/tools/aspectj/lib"
+ filtering="off">
+ <fileset dir="${aspectj.home}/lib" includes="aspectj*.jar"/>
+ </copy>
+ <available property="aspectjtools.jar.available"
+ file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ <available property="aspectjrt.jar.available"
+ file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ </target>
+
+ <target name="setup" depends="init,taskdef,local.aspectj.setup"
+ unless="module.jar.available,persist.jar.available">
+ <iajc outJar="${home.dir}/ec/int/persist.jar"
+ failonerror="true"
+ fork="${fork.iajc}"
+ sourceroots="${home.dir}/ec/int/src"
+ classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ <iajc outJar="${home.dir}/build/module.jar"
+ failonerror="true"
+ fork="${fork.iajc}"
+ sourceroots="${home.dir}/ec/module/src"
+ classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ <mkdir dir="${home.dir}/build/binary-input"/>
+ <iajc destdir="${home.dir}/build/binary-input"
+ failonerror="true"
+ fork="${fork.iajc}"
+ sourceroots="${home.dir}/ec/inpathDirSrc"
+ classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ </target>
+
+ <target name="build-test" depends="init,taskdef,setup"
+ description="test Ant script from the devguide">
+ <!-- copy below from the Ant section of the rendered devguide -->
+ <!-- in eclipse, must run forked and not incremental -->
+
+ <iajc outjar="${home.dir}/output/application.jar"
+ sourceRootCopyFilter="**/CVS/*,**/*.java"
+ inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class"
+ incremental="true" >
+ <sourceroots>
+ <pathelement location="${home.dir}/ec/project/src"/>
+ <pathelement location="${home.dir}/ec/project/testsrc"/>
+ </sourceroots>
+ <inpath>
+ <pathelement location="${home.dir}/build/module.jar"/>
+ <pathelement location="${home.dir}/build/binary-input"/>
+ </inpath>
+ <aspectpath>
+ <pathelement location="${home.dir}/ec/int/persist.jar"/>
+ </aspectpath>
+ <classpath>
+ <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ </classpath>
+ </iajc>
+
+ <java classname="org.smart.app.Main">
+ <classpath>
+ <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
+ <pathelement location="${home.dir}/ec/int/persist.jar"/>
+ <pathelement location="${home.dir}/output/application.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/build/binary-input/ignore.txt b/docs/modules/ROOT/pages/test/antScriptTest/build/binary-input/ignore.txt
new file mode 100644
index 000000000..c7d48fbb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/build/binary-input/ignore.txt
@@ -0,0 +1 @@
+ignore - just to avoid CVS trimming empty directories.
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/build/ignore.txt b/docs/modules/ROOT/pages/test/antScriptTest/build/ignore.txt
new file mode 100644
index 000000000..c7d48fbb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/build/ignore.txt
@@ -0,0 +1 @@
+ignore - just to avoid CVS trimming empty directories.
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/ec/inpathDirSrc/InpathFile.java b/docs/modules/ROOT/pages/test/antScriptTest/ec/inpathDirSrc/InpathFile.java
new file mode 100644
index 000000000..729709fea
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/ec/inpathDirSrc/InpathFile.java
@@ -0,0 +1,2 @@
+
+public class InpathFile {} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/ec/int/src/org/smart/persist/Persist.java b/docs/modules/ROOT/pages/test/antScriptTest/ec/int/src/org/smart/persist/Persist.java
new file mode 100644
index 000000000..c0073c3ff
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/ec/int/src/org/smart/persist/Persist.java
@@ -0,0 +1,11 @@
+
+package org.smart.persist;
+
+aspect Persist {
+
+ after(String string) returning : set(public String *)
+ && !target(Persist) && args(string) {
+ String name = thisJoinPoint.getSignature().getName();
+ System.out.println("set " + name + " to " + string);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/ec/module/src/org/smart/app/Util.java b/docs/modules/ROOT/pages/test/antScriptTest/ec/module/src/org/smart/app/Util.java
new file mode 100644
index 000000000..19e4a0030
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/ec/module/src/org/smart/app/Util.java
@@ -0,0 +1,10 @@
+
+package org.smart.app;
+
+public class Util {
+
+ public static final String utility(String s) {
+ System.out.println("called Util.utility(\"" + s +"\")");
+ return s.toUpperCase();
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/ec/project/src/org/smart/app/Main.java b/docs/modules/ROOT/pages/test/antScriptTest/ec/project/src/org/smart/app/Main.java
new file mode 100644
index 000000000..7ad866ef1
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/ec/project/src/org/smart/app/Main.java
@@ -0,0 +1,12 @@
+
+package org.smart.app;
+
+public class Main {
+
+ public String persistMe;
+
+ public static void main(String[] args) {
+ Main me = new Main();
+ me.persistMe = Util.utility("persistMe shouting!");
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/ec/project/testsrc/org/smart/app/MainTest.java b/docs/modules/ROOT/pages/test/antScriptTest/ec/project/testsrc/org/smart/app/MainTest.java
new file mode 100644
index 000000000..971e41928
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/ec/project/testsrc/org/smart/app/MainTest.java
@@ -0,0 +1,8 @@
+
+package org.smart.app;
+
+public class MainTest {
+ public static void main(String[] args) {
+ Main.main(args);
+ }
+} \ No newline at end of file
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/output/ignore.txt b/docs/modules/ROOT/pages/test/antScriptTest/output/ignore.txt
new file mode 100644
index 000000000..c7d48fbb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/output/ignore.txt
@@ -0,0 +1 @@
+ignore - just to avoid CVS trimming empty directories.
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/readme.txt b/docs/modules/ROOT/pages/test/antScriptTest/readme.txt
new file mode 100644
index 000000000..c18101076
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/readme.txt
@@ -0,0 +1,3 @@
+
+This tests the Ant script in the devguide.
+See build.xml for more information.
diff --git a/docs/modules/ROOT/pages/test/antScriptTest/tools/aspectj/lib/ignore.txt b/docs/modules/ROOT/pages/test/antScriptTest/tools/aspectj/lib/ignore.txt
new file mode 100644
index 000000000..c7d48fbb5
--- /dev/null
+++ b/docs/modules/ROOT/pages/test/antScriptTest/tools/aspectj/lib/ignore.txt
@@ -0,0 +1 @@
+ignore - just to avoid CVS trimming empty directories.