aboutsummaryrefslogtreecommitdiffstats
path: root/docs/modules/ROOT/pages/sandbox
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2024-01-30 10:00:56 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2024-01-30 12:39:24 +0700
commit5665de78868050d9964a315fb5e3628bd6696c62 (patch)
tree08449691b6329e02c2e86def4246f31bb4cb3823 /docs/modules/ROOT/pages/sandbox
parente91e8f96fd620672d2fdf182a0a8708116d3464b (diff)
downloadaspectj-5665de78868050d9964a315fb5e3628bd6696c62.tar.gz
aspectj-5665de78868050d9964a315fb5e3628bd6696c62.zip
Change directory layout to suit Antora
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'docs/modules/ROOT/pages/sandbox')
-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
357 files changed, 25839 insertions, 0 deletions
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