Bläddra i källkod

Jan Hannemann's design patterns implementations, plus .lst files and test scripts

tags/Root_ajdt_support
wisberg 20 år sedan
förälder
incheckning
bff61ab1e3
100 ändrade filer med 7074 tillägg och 0 borttagningar
  1. 7
    0
      docs/sandbox/ubc-design-patterns/.classpath
  2. 18
    0
      docs/sandbox/ubc-design-patterns/.project
  3. 7
    0
      docs/sandbox/ubc-design-patterns/buildAllPatterns.bat
  4. 253
    0
      docs/sandbox/ubc-design-patterns/default.lst
  5. Binär
      docs/sandbox/ubc-design-patterns/docs/readme-1.1.pdf
  6. 59
    0
      docs/sandbox/ubc-design-patterns/docs/readme-1.1.txt
  7. 40
    0
      docs/sandbox/ubc-design-patterns/patterns-readme.html
  8. 250
    0
      docs/sandbox/ubc-design-patterns/patterns-test.xml
  9. 51
    0
      docs/sandbox/ubc-design-patterns/src/allPatterns.lst
  10. 64
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java
  11. 63
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java
  12. 103
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java
  13. 84
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java
  14. 158
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java
  15. 58
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java
  16. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst
  17. 63
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java
  18. 102
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java
  19. 83
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java
  20. 155
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java
  21. 70
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java
  22. 87
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java
  23. 62
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java
  24. 58
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java
  25. 45
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java
  26. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst
  27. 92
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java
  28. 73
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java
  29. 49
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java
  30. 45
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java
  31. 96
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java
  32. 64
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java
  33. 57
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java
  34. 61
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java
  35. 110
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java
  36. 58
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java
  37. 56
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java
  38. 62
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java
  39. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst
  40. 64
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java
  41. 57
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java
  42. 62
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java
  43. 110
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java
  44. 103
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java
  45. 56
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java
  46. 62
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java
  47. 70
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java
  48. 76
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java
  49. 97
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java
  50. 66
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java
  51. 103
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java
  52. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst
  53. 79
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java
  54. 99
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java
  55. 66
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java
  56. 90
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java
  57. 65
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java
  58. 93
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java
  59. 102
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java
  60. 61
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java
  61. 108
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java
  62. 37
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java
  63. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst
  64. 86
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java
  65. 93
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java
  66. 38
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java
  67. 93
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java
  68. 102
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java
  69. 81
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java
  70. 63
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java
  71. 52
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java
  72. 40
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java
  73. 72
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java
  74. 104
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java
  75. 38
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java
  76. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst
  77. 87
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java
  78. 46
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java
  79. 47
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java
  80. 40
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java
  81. 98
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java
  82. 65
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java
  83. 80
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java
  84. 180
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java
  85. 141
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java
  86. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst
  87. 120
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java
  88. 120
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java
  89. 81
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java
  90. 119
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java
  91. 56
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java
  92. 47
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java
  93. 78
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java
  94. 61
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java
  95. 5
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst
  96. 56
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java
  97. 45
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java
  98. 73
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java
  99. 43
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java
  100. 0
    0
      docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java

+ 7
- 0
docs/sandbox/ubc-design-patterns/.classpath Visa fil

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Program Files/eclipse 2.1/plugins/org.aspectj.ajde_1.1.4/aspectjrt.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

+ 18
- 0
docs/sandbox/ubc-design-patterns/.project Visa fil

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Design Pattern Examples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ajdt.ui.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
</natures>
</projectDescription>

+ 7
- 0
docs/sandbox/ubc-design-patterns/buildAllPatterns.bat Visa fil

@@ -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

+ 253
- 0
docs/sandbox/ubc-design-patterns/default.lst Visa fil

@@ -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

Binär
docs/sandbox/ubc-design-patterns/docs/readme-1.1.pdf Visa fil


+ 59
- 0
docs/sandbox/ubc-design-patterns/docs/readme-1.1.txt Visa fil

@@ -0,0 +1,59 @@
Implementations of GoF Design Patterns in Java and AspectJ
Code base documentation (March 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/projects/aodps.html
Please send all questions, feedback, and suggestions to Jan Hannemann (jan@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).


A1: Using the Eclipse IDE
Setting up your system and running the examples
1. Install Eclipse (www.eclipse.org) and AJDT (www.eclipse.org/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. Create a new AspectJ project
3. Import the ZIP file with the AOP pattern examples into your project
4. Set the source directory to "Design Pattern Examples/src" (under: Project / Properties / Java Build Path / Source). Set/adjust the output directory is desired.
5. Compile
6. Run individual examples by selecting the appropriate source folder and selecting Run As / Java Application.


A2: 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.


A3: 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:
* testPattern 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)


March 2, 2004


+ 40
- 0
docs/sandbox/ubc-design-patterns/patterns-readme.html Visa fil

@@ -0,0 +1,40 @@
<html>
<head><title>AspectJ Patterns</title>
</head>
<body>
<h3>AspectJ Patterns</h3>
<p>
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 <a href="docs/readme-1.1.txt">docs/readme-1.1.txt</a>
or <a href="docs/readme-1.1.pdf">docs/readme-1.1.pdf</a>.
</p>
<p>
Build options
<ul>
<li>
To build the code manually with ajc, use the corresponding build.lst files,
creating the aspect library first (to create lib.jar).
</li>
<li> Ajbrowser and the other 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. </li>
<li>
To build with eclipse, there are <a href=".project">.project</a>
and <a href=".classpath">.classpath</a> files, but you will need
to adjust the <code>aspectjrt.jar</code> entry after importing the project.
</li>
<li>
To build for testing, see <a href="patterns-test.xml">patterns-test.xml</a>.
</li>
</ul>
<p>
Enjoy!
</p>
</body>
</html>


+ 250
- 0
docs/sandbox/ubc-design-patterns/patterns-test.xml Visa fil

@@ -0,0 +1,250 @@
<!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"/>
</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>

+ 51
- 0
docs/sandbox/ubc-design-patterns/src/allPatterns.lst Visa fil

@@ -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



+ 64
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java Visa fil

@@ -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();
}

+ 63
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java Visa fil

@@ -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);
}
}

+ 103
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java Visa fil

@@ -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);
}
}
}

+ 84
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java Visa fil

@@ -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";
}
}

+ 158
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java Visa fil

@@ -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);
}
}

+ 58
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java Visa fil

@@ -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");
}
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 63
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java Visa fil

@@ -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();
}

+ 102
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java Visa fil

@@ -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);
}
}
}

+ 83
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java Visa fil

@@ -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";
}
}

+ 155
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java Visa fil

@@ -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);
}
}

+ 70
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java Visa fil

@@ -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");
}
}

+ 87
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java Visa fil

@@ -0,0 +1,87 @@
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
*/
private static SystemOutPrinter 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.");
}
}

+ 62
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java Visa fil

@@ -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);
}
}

+ 58
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java Visa fil

@@ -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);
}
}

+ 45
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java Visa fil

@@ -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);
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 92
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java Visa fil

@@ -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.");
}
}

+ 73
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java Visa fil

@@ -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);
}
}

+ 49
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java Visa fil

@@ -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);
}
}

+ 45
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java Visa fil

@@ -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);
}

+ 96
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java Visa fil

@@ -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;
}

}

+ 64
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java Visa fil

@@ -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());
}
}

+ 57
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java Visa fil

@@ -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!");
}
}


+ 61
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java Visa fil

@@ -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);
}
}

+ 110
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java Visa fil

@@ -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();
}
}

+ 58
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java Visa fil

@@ -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);
}

+ 56
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java Visa fil

@@ -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);
}

+ 62
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java Visa fil

@@ -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);
}
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 64
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java Visa fil

@@ -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());
}
}

+ 57
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java Visa fil

@@ -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!");
}
}


+ 62
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java Visa fil

@@ -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);
}
}

+ 110
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java Visa fil

@@ -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();
}
}

+ 103
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java Visa fil

@@ -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();
}
}

+ 56
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java Visa fil

@@ -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);
}

+ 62
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java Visa fil

@@ -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);
}
}

+ 70
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java Visa fil

@@ -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();
}

+ 76
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java Visa fil

@@ -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";
}

+ 97
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java Visa fil

@@ -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());
}
}

+ 66
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java Visa fil

@@ -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");
}
}

+ 103
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java Visa fil

@@ -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;
}
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 79
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java Visa fil

@@ -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;
}
}

+ 99
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java Visa fil

@@ -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());
}
}

+ 66
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java Visa fil

@@ -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");
}
}

+ 90
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java Visa fil

@@ -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;
}
}

+ 65
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java Visa fil

@@ -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) {}
}

+ 93
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java Visa fil

@@ -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 );
}

}

+ 102
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java Visa fil

@@ -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");
}

}

+ 61
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java Visa fil

@@ -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);
}
});
}
}


+ 108
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java Visa fil

@@ -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);
}
}

+ 37
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java Visa fil

@@ -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 {}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 86
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java Visa fil

@@ -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);
}
}
}
}

+ 93
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java Visa fil

@@ -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 );
}

}

+ 38
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java Visa fil

@@ -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);
}

+ 93
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java Visa fil

@@ -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);
}
}
}
}


+ 102
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java Visa fil

@@ -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);
}
}

+ 81
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java Visa fil

@@ -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);
}
}
}
}

+ 63
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java Visa fil

@@ -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() {}
}

+ 52
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java Visa fil

@@ -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");
}
}


+ 40
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java Visa fil

@@ -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 {}


+ 72
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java Visa fil

@@ -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);
}


+ 104
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java Visa fil

@@ -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); }
}

+ 38
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java Visa fil

@@ -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);
}
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 87
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java Visa fil

@@ -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;
}
}

+ 46
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java Visa fil

@@ -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");
}
}


+ 47
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java Visa fil

@@ -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");
}
}


+ 40
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java Visa fil

@@ -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();
}

+ 98
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java Visa fil

@@ -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);
}
}

+ 65
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java Visa fil

@@ -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);
}
}

+ 80
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java Visa fil

@@ -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;
}
}

+ 180
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java Visa fil

@@ -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;
}
}


+ 141
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java Visa fil

@@ -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");
}
}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 120
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java Visa fil

@@ -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;
}
}

+ 120
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java Visa fil

@@ -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;
}
}

+ 81
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java Visa fil

@@ -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();
}

+ 119
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java Visa fil

@@ -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");
}
}

+ 56
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java Visa fil

@@ -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);
}
}

+ 47
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java Visa fil

@@ -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);
}
}

+ 78
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java Visa fil

@@ -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();
}
}

+ 61
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java Visa fil

@@ -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);
}

}

+ 5
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/build.lst Visa fil

@@ -0,0 +1,5 @@
-sourceroots
.
-aspectpath
../../../patternLibrary/lib.jar


+ 56
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java Visa fil

@@ -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);
}
}

+ 45
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java Visa fil

@@ -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);
}
}

+ 73
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java Visa fil

@@ -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();
}
}

+ 43
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java Visa fil

@@ -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);
}


+ 0
- 0
docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java Visa fil


Vissa filer visades inte eftersom för många filer har ändrats

Laddar…
Avbryt
Spara