diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-15 09:36:18 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-02-15 09:36:18 +0700 |
commit | cbdbba0ab06898cd7ab6d69e33d2db990d8b8799 (patch) | |
tree | c3b626837aecc15c53330d6afd68f94d136ff641 /docs/sandbox/ubc-design-patterns/src/ca/ubc | |
parent | 70fb6131935806f7e2041c5dfd0ac81164670875 (diff) | |
download | aspectj-cbdbba0ab06898cd7ab6d69e33d2db990d8b8799.tar.gz aspectj-cbdbba0ab06898cd7ab6d69e33d2db990d8b8799.zip |
Globally replace "http:" by "https:" in non-XML files
Maybe, the XML files and Maven wrapper files will follow. First, let us
find out if this breaks the build, maybe some tests are asserting on
"http:". But there, the replacement would also have taken place, so
probably it just works.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'docs/sandbox/ubc-design-patterns/src/ca/ubc')
258 files changed, 4211 insertions, 4276 deletions
diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java index 669aa042d..ba3c7f043 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; @@ -32,33 +32,33 @@ import javax.swing.JButton; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/20/04 - * + * */ public interface ComponentFactory { - + /** - * Creates factory-specific <code>JLabel</code> products. + * Creates factory-specific <code>JLabel</code> products. * * @return the factory-specific <code>JLabel</code> */ - - public JLabel createLabel(); + + public JLabel createLabel(); /** - * Creates factory-specific <code>JButton</code> products. + * Creates factory-specific <code>JButton</code> products. * * @return the factory-specific <code>JButton</code> */ - - public JButton createButton(String label); + public JButton createButton(String label); - /** + + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java index 4a983c8c7..18e5f8d6a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/ComponentFactoryImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import javax.swing.JLabel; -import javax.swing.JButton; +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. + * 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 @@ -40,24 +40,24 @@ public aspect ComponentFactoryImplementation { /** * Provides a default implementation for all <code>ComponentFactories - * </code> for the <code>createLabel()</code> method. + * </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. + * </code> for the <code>createButton()</code> method. * * @param a label for the new <code>JButton</code> * @return a regular <code>JButton</code> */ - + public JButton ComponentFactory.createButton(String label) { return new JButton(label); - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java index 2575cf817..365cbe813 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Display.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.JPanel; import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JButton; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.ActionListener; @@ -39,21 +39,21 @@ import java.awt.event.ActionEvent; * @version 1.1, 01/20/04 * */ - -public class Display extends JFrame { - + +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 + * <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(); + super("New GUI"); + JLabel label = factory.createLabel(); JButton button = factory.createButton("OK"); button.addActionListener(new myActionListener(this)); JPanel panel = new JPanel(); @@ -61,43 +61,43 @@ public class Display extends JFrame { panel.add(button); this.getContentPane().add(panel); this.pack(); - this.setVisible(true); + this.setVisible(true); this.addWindowListener(new myWindowListener(this)); } - + /** - * Adds a window listener that closes the frame on demand + * 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; + this.display = display; } - + public void windowClosing(WindowEvent e) { display.setVisible(false); } } - + /** - * Adds a button listener that closes the frame on demand + * 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) { + + public void actionPerformed(ActionEvent e) { display.setVisible(false); } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java index 2666d1754..77eed1770 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/FramedFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import javax.swing.JLabel; + +import javax.swing.JLabel; import javax.swing.border.Border; import javax.swing.BorderFactory; import javax.swing.JButton; @@ -31,7 +31,7 @@ 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 @@ -41,11 +41,11 @@ import javax.swing.JButton; public class FramedFactory implements ComponentFactory { /** - * Factroy method to create framed <code>JLabel</code> objects. + * 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()); @@ -53,32 +53,32 @@ public class FramedFactory implements ComponentFactory { Border loweredbevel = BorderFactory.createLoweredBevelBorder(); label.setBorder(BorderFactory.createCompoundBorder( raisedbevel, loweredbevel)); - + return label; - } - + } + /** - * Factory method to create framed <code>JButton</code> objects. + * Factory method to create framed <code>JButton</code> objects. * * @param the label for the new <code>JButton</code> * @return the framed <code>JButton</code> */ - + public JButton createButton(String label) { JButton button = new JButton(label); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); button.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel)); return button; - } + } - /** + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName() { return "Framed Factory"; - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java index 8cff6d26d..e20d4a27d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JFrame; import javax.swing.JRadioButton; import javax.swing.JButton; -import javax.swing.JPanel; +import javax.swing.JPanel; import javax.swing.ButtonGroup; import java.awt.event.WindowAdapter; @@ -43,22 +43,22 @@ import java.awt.event.ActionListener; * </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). + * 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 + * 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 + * 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. * @@ -73,27 +73,27 @@ import java.awt.event.ActionListener; * @version 1.1, 01/20/04 * */ -public class Main +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 @@ -101,7 +101,7 @@ public class Main * * @return a <code>JPanel</code> containing the GUI */ - + private static JPanel createGUI() { ActionListener radioListener = new ActionListener() { @@ -110,49 +110,49 @@ public class Main else factory = factory2; } }; - + JPanel panel = new JPanel(); - JRadioButton factoryButton1 = new JRadioButton("use Factory 1"); + JRadioButton factoryButton1 = new JRadioButton("use Factory 1"); JRadioButton factoryButton2 = new JRadioButton("use Factory 2"); factoryButton1.setActionCommand("factory1"); - factoryButton2.setActionCommand("factory2"); + factoryButton2.setActionCommand("factory2"); factoryButton1.addActionListener(radioListener); - factoryButton2.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) { + public void actionPerformed(ActionEvent e) { Display display = new Display(factory); } }); - + panel.add(factoryButton1); panel.add(factoryButton2); panel.add(create); - + return panel; } /** * Implements the driver for this design pattern example. It sets up * the initial GUI. - */ - + */ + public static void main(String[] args) { JFrame frame = new JFrame("Abstract Factory Demo"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} - }); - + }); + frame.getContentPane().add(createGUI()); - + frame.pack(); frame.setVisible(true); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java index 573f89571..9701d35fa 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/aspectj/RegularFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,44 +15,44 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code please see - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; -import javax.swing.JButton; +import javax.swing.JButton; /** - * This <i>Concrete Factory</i> implements the - * <code>AbstractFactory</code> interface to provide + * 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 + * the inter-type declarations in aspect * <code>AbstractFactroyEnhancement</code>. - * - * This is done so that future concrete factories can reuse the + * + * This is done so that future concrete factories can reuse the * implementations of the factory methods and will only have to specify those * that differ from the default ones. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/20/04 * */ public class RegularFactory implements ComponentFactory { - - /** + + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName() { return ("Regular Factory"); - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java index ea2036430..df069990a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/ComponentFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; @@ -32,32 +32,32 @@ import javax.swing.JButton; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/20/04 - * + * */ public interface ComponentFactory { - + /** - * Creates factory-specific <code>JLabel</code> products. + * Creates factory-specific <code>JLabel</code> products. * * @return the factory-specific <code>JLabel</code> */ - - public JLabel createLabel(); + + public JLabel createLabel(); /** - * Creates factory-specific <code>JButton</code> products. + * Creates factory-specific <code>JButton</code> products. * * @return the factory-specific <code>JButton</code> */ - - public JButton createButton(String label); + public JButton createButton(String label); - /** + + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java index 40e2b5b48..432557c9c 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Display.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.JPanel; import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JButton; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.ActionListener; @@ -37,22 +37,22 @@ import java.awt.event.ActionEvent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/20/04 - * + * */ -public class Display extends JFrame { - +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 + * 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(); + super("New GUI"); + JLabel label = factory.createLabel(); JButton button = factory.createButton("OK"); button.addActionListener(new myActionListener(this)); JPanel panel = new JPanel(); @@ -60,43 +60,43 @@ public class Display extends JFrame { panel.add(button); this.getContentPane().add(panel); this.pack(); - this.setVisible(true); + this.setVisible(true); this.addWindowListener(new myWindowListener(this)); } - + /** - * Adds a window listener that closes the frame on demand + * 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; + this.display = display; } - + public void windowClosing(WindowEvent e) { display.setVisible(false); } } - + /** - * Adds a button listener that closes the frame on demand + * 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) { + + public void actionPerformed(ActionEvent e) { display.setVisible(false); } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java index 0a2f5b4b8..53c9328b7 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/FramedFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,23 +15,23 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import javax.swing.JLabel; + +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 + * 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 @@ -41,43 +41,43 @@ import javax.swing.JButton; public class FramedFactory implements ComponentFactory { /** - * Factory method to create framed <code>JLabel</code> objects. + * 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. + * Factory method to create framed <code>JButton</code> objects. * * @param the label for the new <code>JButton</code> * @return the framed <code>JButton</code> */ - + public JButton createButton(String label) { JButton button = new JButton(label); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); button.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel)); return button; - } + } - /** + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName() { return "Framed Factory"; - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java index 001e36a25..cbf784190 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code please see - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JFrame; import javax.swing.JRadioButton; import javax.swing.JButton; -import javax.swing.JPanel; +import javax.swing.JPanel; import javax.swing.ButtonGroup; import java.awt.event.WindowAdapter; @@ -36,19 +36,19 @@ 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 + * + * 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). + * that create related products (Swing GUI elements). * - * The driver is a swing GUI that allows the user to choose between the two + * 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. * @@ -63,34 +63,34 @@ import java.awt.event.ActionListener; * 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 + * 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 +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 @@ -98,7 +98,7 @@ public class Main * * @return a <code>JPanel</code> containing the GUI */ - + private static JPanel createGUI() { ActionListener radioListener = new ActionListener() { @@ -107,49 +107,49 @@ public class Main else factory = factory2; } }; - + JPanel panel = new JPanel(); - JRadioButton factoryButton1 = new JRadioButton("use Factory 1"); + JRadioButton factoryButton1 = new JRadioButton("use Factory 1"); JRadioButton factoryButton2 = new JRadioButton("use Factory 2"); factoryButton1.setActionCommand("factory1"); - factoryButton2.setActionCommand("factory2"); + factoryButton2.setActionCommand("factory2"); factoryButton1.addActionListener(radioListener); - factoryButton2.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) { + public void actionPerformed(ActionEvent e) { Display display = new Display(factory); } }); - + panel.add(factoryButton1); panel.add(factoryButton2); panel.add(create); - + return panel; } /** * Implements the driver for this design pattern example. It sets up * the initial GUI. - */ - + */ + public static void main(String[] args) { JFrame frame = new JFrame("Abstract Factory Demo"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} - }); - + }); + frame.getContentPane().add(createGUI()); - + frame.pack(); frame.setVisible(true); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java index b6aa6376e..472d7bd6e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/abstractFactory/java/RegularFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.abstractFactory.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code please see - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; -import javax.swing.JButton; +import javax.swing.JButton; /** - * This <i>Concrete Factory</i> implements the <code>ComponentFactory</code> + * 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 @@ -36,35 +36,35 @@ import javax.swing.JButton; */ public class RegularFactory implements ComponentFactory { - + /** - * Factroy method to create regular <code>JLabel</code> objects. + * 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. + * Factory method to create regular <code>JButton</code> objects. * * @param the label for the new <code>JButton</code> * @return the regular <code>JButton</code> */ - + public JButton createButton(String label) { return new JButton(label); } - /** + /** * Returns the name of the factory. * * @return the name of the factory */ - + public String getName() { return ("Regular Factory"); - } - -}
\ No newline at end of file + } + +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java index 3ffc6a083..cc359fb35 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Adapter design pattern example. <p> + * 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 @@ -31,50 +31,50 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * * 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>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> - * + * 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. - * + * 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> + * 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. + * 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 { - +public class Main { + /** - * the Adaptee in the scenario. Note that our adaptee can be used as a - * Writer because of the <code>declare parents</code> statement in the + * the Adaptee in the scenario. Note that our adaptee can be used as a + * Writer because of the <code>declare parents</code> statement in the * aspect. */ - - private static Writer adaptee; + + private static Writer adaptee; /** - * Implements the driver. - * + * 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)..."); @@ -86,4 +86,4 @@ public class Main { System.out.println("Issuing the request() to the Adapter..."); adaptee.write("Test successful."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java index 86360ec43..1a7f611af 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/PrinterAdapter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Adapts <code>SystemOutPrinter</code> to match the <code>Writer</code> - * interface. + * interface. * * @author Jan Hannemann * @author Gregor Kiczales @@ -33,30 +33,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * @see Target * @see Adaptee */ - -public aspect PrinterAdapter { - + +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>. + * </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>. + * <i>request()</i>. * * @param s the string to print * @see Writer#write(String) * @see SystemOutPrinter#printToSystemOut(String) */ - + public void SystemOutPrinter.write(String s) { printToSystemOut(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java index abe34d6e8..c24431169 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/SystemOutPrinter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,44 +15,44 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Provides a specialized print method. Acts as the <i>Adaptee</i> in the + * 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 + * 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 + * context, this is the <i>specificRequest()</i> method on * the <i>Adaptee</i>. * * @param s the string to be printed * @see Writer#write(String) the adapted method */ - + public void printToSystemOut(String s) { System.out.println(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java index bd1ad3f4b..bc7a19641 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/aspectj/Writer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -42,4 +42,4 @@ public interface Writer { */ public void write(String s); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java index b7e01fd30..80548eb88 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -89,4 +89,4 @@ public class Main { myTarget.write("Test successful."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java index bcc5196fd..6e1c62c55 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/PrinterAdapter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -70,4 +70,4 @@ public class PrinterAdapter implements Writer { public void write(String s) { adaptee.printToSystemOut(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java index 023ab46db..8323abea3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/SystemOutPrinter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,35 +15,35 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Provides a specialized print method. Acts as the <i>Adaptee</i> in the + * 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 + * context, this is the <i>specificRequest()</i> method on * the <i>Adaptee</i>. * * @param s the string to be printed * @see Writer#write(String) the adapted method */ - + public void printToSystemOut(String s) { System.out.println(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java index 63f0e0978..af4e1de4f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/adapter/java/Writer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,31 +15,31 @@ package ca.ubc.cs.spl.aspectPatterns.examples.adapter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Declares the target interface with a general output method. Acts as the + * 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>. + * <i>request()</i> method on the <i>Target</i>. * * @param s the string to print - * @see PrinterAdapter + * @see PrinterAdapter */ - + public void write(String s); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java index 35f47ca16..a54047eac 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/AbstractionImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -34,33 +34,33 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * */ -public aspect AbstractionImplementation { +public aspect AbstractionImplementation { /** - * stores the actual <i>Implementor</i> to use + * stores the actual <i>Implementor</i> to use */ - private ScreenImplementation Screen.implementor; - + private ScreenImplementation Screen.implementor; + /** - * Draws or prints a text to an output device determined by the + * 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 + * 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(); @@ -74,23 +74,22 @@ public aspect AbstractionImplementation { implementor.printText(" "+text+" "); implementor.printDecor(); implementor.printLine(); - + for(int i=0; i<length+4; i++) { implementor.printDecor(); } - implementor.printLine(); + implementor.printLine(); } - + /** * Sets the current <i>Implementor</i>. * * @param implementor The new implementor */ - + public void Screen.setImplementor(ScreenImplementation implementor) { this.implementor = implementor; } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java index 99088ed25..3fb9eba8b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/CrossCapitalImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints capitalized text and uses the double cross ("#") to decorate. - * Represents a <i>ConcreteImplementation</i> in the context of the Bridge +/** + * 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 @@ -32,10 +32,10 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * @version 1.1, 01/26/04 * */ - + public class CrossCapitalImplementation implements ScreenImplementation { - + /** * Does a line feed (to <code>System.out</code>). */ @@ -43,21 +43,21 @@ public class CrossCapitalImplementation implements ScreenImplementation { public void printLine() { System.out.println(); } - - /** + + /** * Prints a double cross ("#") to <code>System.out</code>. */ - + public void printDecor() { System.out.print("X"); } - + /** * Prints the argument text in capitals to <code>System.out</code>. * * @param text the text to print */ - + public void printText(String text) { System.out.print(text.toUpperCase()); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java index 4fb5fbc4a..dd2ef5763 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/GreetingScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,14 +15,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** +/** * Prints/draws a greeting in a text box. Represents a <i>RefinedAbstraction * </i> in the context of the Bridge design pattern. * @@ -31,20 +31,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * @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 */ @@ -53,5 +53,3 @@ public class GreetingScreen implements Screen { drawTextBox("Greetings!"); } } - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java index 3a4eed280..2c39dde01 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/InformationScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints/draws the current system time in a text box. Represents a +/** + * 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 @@ -31,31 +31,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * @version 1.1, 01/26/04 * */ - -import java.util.Date; -public class InformationScreen implements Screen { - - - /** +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() { + public void drawInfo() { Date date = new Date(); drawTextBox("Current system time: "+date); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java index 3c4a97e26..68f70df14 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Bridge design pattern example. <p> + * Implements the driver for the Bridge design pattern example. <p> * - * Intent: <i> Decouple an abstraction from its implementation so that the + * 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 + * 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>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, + * <LI> <code>ScreenImplementation</code> - <i>Implementor</i> interface, * defines basic operations to output formatted strings - * <LI> <code>StarImplementation</code> - <i>ConcreteImplementation</i> that + * <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 @@ -52,7 +52,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * </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. * @@ -68,8 +68,8 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * @see CrossCapitalImplementation * @see AbstractionImplementation */ - - + + public class Main { /** @@ -78,33 +78,33 @@ public class Main { * * @param args required by Java, but ignored */ - - public static void main(String[] args) { - + + 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); - + InformationScreen is2 = new InformationScreen(i2); + System.out.println("Starting test:\n"); - + gs1.drawText("\nScreen 1 (Refined Abstraction 1, Implementation 1):"); gs1.drawGreeting(); - + gs2.drawText("\nScreen 2 (Refined Abstraction 1, Implementation 2):"); gs2.drawGreeting(); - + is1.drawText("\nScreen 3 (Refined Abstraction 2, Implementation 1):"); is1.drawInfo(); is2.drawText("\nScreen 4 (Refined Abstraction 2, Implementation 2):"); is2.drawInfo(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java index 67f0a34ff..79e8e43a8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/Screen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ @@ -36,23 +36,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; */ public interface Screen { - + /** - * Draws or prints a text to an output device determined by the + * 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 + * Draws or prints a text in a box to an output device determined * by the current <i>Implementor</i>. * * @param text The text to be drawn/printed */ - + public void drawTextBox(String text); } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java index 050912c6f..76ea88203 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/ScreenImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints lines, decorators and text. Represents a +/** + * Prints lines, decorators and text. Represents a * <i>Implementor</i> in the context of the Bridge design pattern. * * @author Jan Hannemann @@ -33,24 +33,24 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; */ 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); + + void printText(String text); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java index eddcdebee..9b74dd455 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/aspectj/StarImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints regular text and uses the star ("*") to decorate. Represents a +/** + * 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 @@ -31,9 +31,9 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.aspectj; * @version 1.1, 01/26/04 * */ - + public class StarImplementation implements ScreenImplementation { - + /** * Does a line feed (to <code>System.out</code>). */ @@ -41,21 +41,21 @@ public class StarImplementation implements ScreenImplementation { public void printLine() { System.out.println(); } - - /** + + /** * Prints a star ("*") to <code>System.out</code>. */ - + public void printDecor() { System.out.print("*"); } - + /** * Prints the argument text to <code>System.out</code>. * * @param text the text to print */ - + public void printText(String text) { System.out.print(text); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java index 32456bda8..18ae61e73 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/CrossCapitalImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints capitalized text and uses double crosses ("#") to decorate. - * Represents a <i>ConcreteImplementation</i> in the context of the Bridge +/** + * 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 @@ -32,10 +32,10 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * @version 1.1, 01/26/04 * */ - + public class CrossCapitalImplementation implements ScreenImplementation { - + /** * Does a line feed (to <code>System.out</code>). */ @@ -43,21 +43,21 @@ public class CrossCapitalImplementation implements ScreenImplementation { public void printLine() { System.out.println(); } - - /** + + /** * Prints a double cross ("#") to <code>System.out</code>. */ - + public void printDecor() { System.out.print("X"); } - + /** * Prints the argument text in capitals to <code>System.out</code>. * * @param text the text to print */ - + public void printText(String text) { System.out.print(text.toUpperCase()); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java index 5ce3507a2..98ef50211 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/GreetingScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -53,5 +53,3 @@ public class GreetingScreen extends Screen { drawTextBox("Greetings!"); } } - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java index a15b6f562..c1692ff06 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/InformationScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -/** - * Prints/draws the current system time in a text box. Represents a +/** + * 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 @@ -32,31 +32,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * @version 1.1, 01/26/04 * */ - -import java.util.Date; -public class InformationScreen extends Screen { - - - /** +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() { + public void drawInfo() { Date date = new Date(); drawTextBox("Current system time: "+date); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java index a058cffb7..033b3aaf7 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Bridge design pattern example. <p> + * Implements the driver for the Bridge design pattern example. <p> * - * Intent: <i> Decouple an abstraction from its implementation so that the + * 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 + * 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>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, + * <LI> <code>ScreenImplementation</code> - <i>Implementor</i> interface, * defines basic operations to output formatted strings - * <LI> <code>StarImplementation</code> - <i>ConcreteImplementation</i> that + * <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 @@ -52,8 +52,8 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * <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 + * 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. * @@ -68,8 +68,8 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * @see StarImplementation * @see CrossCapitalImplementation */ - - + + public class Main { /** @@ -78,33 +78,33 @@ public class Main { * * @param args required by Java, but ignored */ - - public static void main(String[] args) { - + + 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); - + InformationScreen is2 = new InformationScreen(i2); + System.out.println("Starting test:\n"); - + gs1.drawText("\nScreen 1 (Refined Abstraction 1, Implementation 1):"); gs1.drawGreeting(); - + gs2.drawText("\nScreen 2 (Refined Abstraction 1, Implementation 2):"); gs2.drawGreeting(); - + is1.drawText("\nScreen 3 (Refined Abstraction 2, Implementation 1):"); is1.drawInfo(); is2.drawText("\nScreen 4 (Refined Abstraction 2, Implementation 2):"); is2.drawInfo(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java index 5fbed961d..1f7b5ac63 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/Screen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ @@ -28,11 +28,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * 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 + * + * 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 @@ -42,43 +42,43 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; */ public abstract class Screen { - + /** - * stores the actual <i>Implementor</i> to use + * stores the actual <i>Implementor</i> to use */ - private ScreenImplementation implementor; - + private ScreenImplementation implementor; + /** * Creates a new <code>Screen</code> object given an <i>Implementor</i> * - * @param implementor the implementor to use for calls to + * @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 + * 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 + * 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(); @@ -92,12 +92,11 @@ public abstract class Screen { implementor.printText(" "+text+" "); implementor.printDecor(); implementor.printLine(); - + for(int i=0; i<length+4; i++) { implementor.printDecor(); } - implementor.printLine(); + implementor.printLine(); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java index 1ea18ffd5..738bd86cb 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/ScreenImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java index 87c00a36f..cd14e9b2e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/bridge/java/StarImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.bridge.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java index a480a78a2..a92621ad9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Creator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,56 +15,55 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the interface for <i>Builder</i>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); - public abstract void processValue(String type); - - /** + /** * Defines the <i>getResult()</i> operation for <i>Builder</i>s. * * @param type the type to process - */ + */ public String getRepresentation(); } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java index 6a2a2638f..c1631e2e3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/CreatorImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -28,7 +28,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * without losing the possibility to declare default implementations and even * variables. * - * This also illiustrates the tradeoffs: The current version of AspectJ + * 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 @@ -38,22 +38,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * @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 + * Declares the <i>getResult()</i> method with a default implementation * to the <code>Creator</code> interface. * * @returns the representation string for the builder. @@ -62,15 +62,15 @@ public aspect CreatorImplementation { public String Creator.getRepresentation() { return representation; } - + /** - * Declares a compiler error that gets reported if other classes + * 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)): + + declare error: (set(public String Creator+.representation) + || get(public String Creator+.representation)) + && ! (within(Creator+) + || within(CreatorImplementation)): "variable result is aspect protected. Use getResult() to access it"; } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java index e3101e89e..3b9c326da 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Builder design pattern example.<p> + * 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 + * 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 + * Participating objects are <code>TextCreator</code> and * <code>XMLCreator</code> as <i>Builder</i>s that implement the * <code>Creator</code> interface.<p> * @@ -38,17 +38,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * 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> + * <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 + * 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 @@ -56,7 +56,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; public class Main { - /** + /** * Builds a string representation of a person using a given builder. * * @param the builder to use. @@ -69,29 +69,29 @@ public class Main { builder.processAttribute("Age"); builder.processValue("33"); builder.processAttribute("Occupation"); - builder.processValue("Builder"); + builder.processValue("Builder"); } /** - * Implements the driver for the Builder design pattern example.<p> + * Implements the driver for the Builder design pattern example.<p> * * In this example, <code>Main</code> acts as the <i>Director</i> that * uses two different builders to build string representations of a * person. <code>TextCreator</code> creates a text-like representation, * <code>XMLCreator</code> an XML-like one. - * + * * @param args the command-line parameters, unused. */ public static void main(String[] args) { - + Creator builder1 = new TextCreator(); Creator builder2 = new XMLCreator(); - + build(builder1); build(builder2); - + System.out.println(builder1.getRepresentation()); System.out.println(builder2.getRepresentation()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java index 43307c021..5ca3edcc3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/TextCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -34,33 +34,33 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; public class TextCreator implements Creator { - /** + /** * Defines a <i>buildPart()</i> operation for type parts. * * @param newType the type to process - */ + */ public void processType(String newType) { representation = "This is a new "+newType+":\n"; } - - /** + + /** * Defines a <i>buildPart()</i> operation for attribute parts. * * @param newAttribute the type to process - */ + */ public void processAttribute(String newAttribute) { representation += ("Its " + newAttribute + " is "); } - - /** + + /** * Defines a <i>buildPart()</i> operation for value parts. * * @param newValue the value to process - */ + */ public void processValue(String newValue) { representation += (newValue + ".\n"); } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java index ff66a4184..193292535 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/aspectj/XMLCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -30,74 +30,74 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.aspectj; * @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() { + 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() { + /** + * Defines the <i>getResult()</i> operation for <i>Builder</i>s. + */ + + public String getRepresentation() { checkAttribute(); checkType(); return representation; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java index 828540806..3c05b19d7 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Creator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,65 +15,64 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the interface for <i>Builder</i>s. + * Defines the interface for <i>Builder</i>s. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/26/04 - * + * * @see TextCreator * @see XMLCreator */ public abstract class Creator { - - /** + + /** * An inheritable variable that carries the result of the build. */ - + protected String representation; - /** + /** * Defines a <i>buildPart()</i> operation for type parts. * * @param type the type to process - */ + */ public abstract void processType(String type); - /** + /** * Defines a <i>buildPart()</i> operation for attribute parts. * * @param newAttribute the attribute to process - */ + */ public abstract void processAttribute(String newAttribute); - /** + /** * Defines a <i>buildPart()</i> operation for value parts. * * @param newValue the value to process - */ + */ public abstract void processValue(String newValue); - - /** + + /** * Defines a <i>getResult()</i> operation for <i>Builder</i>s. * This is the default implementation. - * + * * @return a representation of the build result - */ + */ public String getRepresentation() { return representation; - } + } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java index 217eda258..7f049f00a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Builder design pattern example.<p> + * 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 + * 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 + * 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> * @@ -41,7 +41,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * <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. + * 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. @@ -49,7 +49,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/26/04 - * + * * @see Builder * @see TextCreator * @see XMLCreator @@ -57,7 +57,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; public class Main { - /** + /** * Builds a string representation of a person using a given builder. * * @param builder the builder to use. @@ -70,30 +70,30 @@ public class Main { builder.processAttribute("Age"); builder.processValue("33"); builder.processAttribute("Occupation"); - builder.processValue("Builder"); + builder.processValue("Builder"); } /** - * Implements the driver for the Builder design pattern example.<p> + * Implements the driver for the Builder design pattern example.<p> * * In this example, <code>Main</code> acts as the <i>Director</i> that * uses two different builders to build string representations of a * person. <code>TextCreator</code> creates a text-like representation, * <code>XMLCreator</code> an XML-like one. - * + * * @param args the command-line parameters, unused. * */ public static void main(String[] args) { - + Creator builder1 = new TextCreator(); Creator builder2 = new XMLCreator(); - + build(builder1); build(builder2); - + System.out.println(builder1.getRepresentation()); System.out.println(builder2.getRepresentation()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java index 397144108..cdd795bb9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/TextCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -34,33 +34,33 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; public class TextCreator extends Creator { - /** + /** * Defines a <i>buildPart()</i> operation for type parts. * * @param newType the type to process - */ + */ public void processType(String newType) { representation = "This is a new "+newType+":\n"; } - - /** + + /** * Defines a <i>buildPart()</i> operation for attribute parts. * * @param newAttribute the attribute to process - */ + */ public void processAttribute(String newAttribute) { representation += ("Its " + newAttribute + " is "); } - - /** + + /** * Defines a <i>buildPart()</i> operation for value parts. * * @param newValue the value to process - */ + */ public void processValue(String newValue) { representation += (newValue + ".\n"); } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java index 8c678ea9c..eb8f9132d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/builder/java/XMLCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.builder.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java index ba0aa96f6..71fb784e3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 { + * + */ - /** +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 - */ - + * @param label the button label + */ + public Button(String label) { super(label); this.addActionListener( new ActionListener() { @@ -50,16 +50,16 @@ public class Button extends JButton { 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. - */ - + * @param click the <code>Click</code> that was created when the + * button was clicked. + */ + public void doClick(Click click) {} -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java index fc524c0eb..640cf247e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Click.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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). + * the SHIFT, ALT, or CTRL keys were pressed during the click). * * @author Jan Hannemann * @author Gregor Kiczales @@ -36,58 +36,56 @@ import java.awt.event.ActionEvent; * */ -public class Click { - +public class Click { + /** * the ActionEvent that describes this Click */ protected ActionEvent description; - /** + /** * Creates a <code>Click</code> described by the provided <code> - * ActionEvent</code>. + * ActionEvent</code>. * * @param description the ActionEvent that describes this Click - */ - + */ + public Click(ActionEvent description) { - this.description = description; - } - - /** + this.description = description; + } + + /** * Convenience method for inquiring whether SHIFT was pressed while - * the click occured. - * + * 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. - * + * 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. - * + * the click occured. + * * @return whether the CTRL key was pressed when the click occured - */ - + */ + public boolean hasCtrlMask() { return ((description.getModifiers() & ActionEvent.CTRL_MASK) != 0 ); } } - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java index 96223074c..e29def195 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/ClickChain.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,23 +15,23 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import java.awt.event.ActionEvent; + +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 + * 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. * @@ -40,7 +40,7 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ChainOfResponsibilityProtocol * @version 1.1, 01/27/04 * */ - + public aspect ClickChain extends ChainOfResponsibilityProtocol { /** @@ -49,52 +49,52 @@ public aspect ClickChain extends ChainOfResponsibilityProtocol { declare parents: Frame implements Handler; declare parents: Panel implements Handler; - declare parents: Button implements Handler; + declare parents: Button implements Handler; - declare parents: Click implements Request; - - - protected pointcut eventTrigger(Handler handler, Request request): + 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) { + + + 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) { + public boolean Frame.acceptRequest(Request request) { System.out.println("Frame is asked to accept the request..."); if (request instanceof Click) { Click click = (Click) request; return (click.hasAltMask()); - } + } return false; - } - + } + public void Frame.handleRequest(Request event) { System.out.println("Frame is handling the event.\n"); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java index c91e12c4a..b6c8cb52c 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Frame.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -56,6 +56,3 @@ public class Frame extends JFrame { }); } } - - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java index 28add4a5f..7ad83b716 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,37 +15,37 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): - */ + * Contributor(s): + */ /** * Implements a GUI-motivated example for the Chain Of Rspsonsibility design - * pattern.<p> + * 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 + * 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 + * 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. + * 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 + * 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 @@ -54,22 +54,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * an exception will be raised. * </ol> * - * <p><i>This is the AspectJ version.</i><p> + * <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 + * 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 @@ -78,31 +78,31 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; */ public class Main { - + /** * Implements a GUI-motivated example for the Chain Of Responsibility design - * pattern.<p> + * 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 + * 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. + * 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"); - + 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); - + ClickChain.aspectOf().setSuccessor(panel, frame); + frame.getContentPane().add(panel); panel.add(button); - + frame.pack(); - frame.setVisible(true); + frame.setVisible(true); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java index 1e268a840..cdc577be1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/aspectj/Panel.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; - -/** + +/** * A regular GUI JPanel with no modifications * * @author Jan Hannemann @@ -34,4 +34,3 @@ import javax.swing.*; */ public class Panel extends JPanel {} -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java index 5513ea367..91868b43e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; import java.awt.event.*; -/** - * GUI element at the start of the responsibility chain. A click on the +/** + * 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. * @@ -36,39 +36,39 @@ import java.awt.event.*; * */ -public class Button extends JButton implements ClickHandler { - +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. + /** + * 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.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()) { @@ -79,8 +79,6 @@ public class Button extends JButton implements ClickHandler { } else { successor.handleClick(click); } - } + } } } - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java index 334fbfac5..98f2e3e3a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Click.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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). + * the SHIFT, ALT, or CTRL keys were pressed during the click). * * @author Jan Hannemann * @author Gregor Kiczales @@ -36,58 +36,56 @@ import java.awt.event.ActionEvent; * */ -public class Click { - +public class Click { + /** * the ActionEvent that describes this Click */ protected ActionEvent description; - /** + /** * Creates a <code>Click</code> described by the provided <code> - * ActionEvent</code>. + * ActionEvent</code>. * * @param description the ActionEvent that describes this Click - */ - + */ + public Click(ActionEvent description) { - this.description = description; - } - - /** + this.description = description; + } + + /** * Convenience method for inquiring whether SHIFT was pressed while - * the click occured. - * + * 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. - * + * 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. - * + * the click occured. + * * @return whether the CTRL key was pressed when the click occured - */ - + */ + public boolean hasCtrlMask() { return ((description.getModifiers() & ActionEvent.CTRL_MASK) != 0 ); } } - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java index c0436fc38..5f39f272a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/ClickHandler.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -/** + +/** * Defines the interface for letting <i>ConcreteHandlers</i> handle a request - * (here: a button click). + * (here: a button click). * * @author Jan Hannemann * @author Gregor Kiczales @@ -35,4 +35,3 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; public interface ClickHandler { public void handleClick(Click click); } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java index 10e1ac2a5..4c7d3a0e9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Frame.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,23 +15,23 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.JFrame; import java.awt.event.WindowEvent; -import java.awt.event.WindowAdapter; +import java.awt.event.WindowAdapter; -/** - * Represents a regular GUI frame modified to play its role in the +/** + * 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 @@ -49,31 +49,31 @@ public class Frame extends JFrame implements ClickHandler { protected ClickHandler successor; - /** - * Creates a <code>Frame</code> with a given title that responds + /** + * 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..."); @@ -85,9 +85,6 @@ public class Frame extends JFrame implements ClickHandler { } else { successor.handleClick(click); } - } + } } } - - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java index fda1db4e3..533a1da0a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,39 +15,39 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): - */ + * Contributor(s): + */ /** * Implements a GUI-motivated example for the Chain Of Rspsonsibility design - * pattern.<p> + * 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 + * 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 + * 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. + * 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. + * 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> + * <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 + * 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> @@ -58,7 +58,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 01/27/04 - * + * * @see Button * @see Panel * @see Frame @@ -66,18 +66,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; */ 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>. + * 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 + * 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 @@ -85,18 +85,18 @@ public class Main { * <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) { - 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); - + Button button = new Button("Click me to see the pattern in action! Use <SHIFT>, <CTRL>, and <ALT> during clicks to see different behavior", panel); + frame.getContentPane().add(panel); panel.add(button); - + frame.pack(); frame.setVisible(true); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java index 30ed13378..e68f11af3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/chainOfResponsibility/java/Panel.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.chainOfResponsibility.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; -/** - * Represents a regular GUI panel modified to play its role in the +/** + * 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. * @@ -37,7 +37,7 @@ import javax.swing.*; * */ -public class Panel extends JPanel implements ClickHandler { +public class Panel extends JPanel implements ClickHandler { /** * the successor in the chain of responsibility @@ -45,25 +45,25 @@ public class Panel extends JPanel implements ClickHandler { protected ClickHandler successor; - /** - * Creates a <code>Panel</code> with a given 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..."); @@ -75,7 +75,6 @@ public class Panel extends JPanel implements ClickHandler { } else { successor.handleClick(click); } - } + } } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java index 4bdba0936..d13f90428 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -60,4 +60,4 @@ public class Button extends JButton { */ public void clicked() {} -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java index 573bcda5e..1f8bc730b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,38 +15,37 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 + * 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>. + * <quote>"ButtonCommand executed"</quote>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/06/04 */ -public class ButtonCommand implements Command { +public class ButtonCommand implements Command { private Printer printer = new Printer(); - + /** - * Implements a sample command. This one prints a short message to + * 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>. - */ - + * <quote>"ButtonCommand executed"</quote>. + */ + public void executeCommand(CommandReceiver receiver ) { printer.println("ButtonCommand executed"); - } + } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java index 393c721eb..91b91babc 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommand2.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -37,4 +37,3 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; */ public class ButtonCommand2 {} - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java index a53f98fa9..defb593a1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/ButtonCommanding.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,26 +15,26 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 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 */ @@ -45,28 +45,27 @@ public aspect ButtonCommanding extends CommandProtocol { 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> + * 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>. + * <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. + * 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): + protected pointcut commandTrigger(CommandInvoker invoker): call(void Button.clicked()) && target(invoker); } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java index e3953d23d..5480495e6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,43 +15,43 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import javax.swing.JFrame; + +import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.WindowEvent; import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command; /** - * Implements the driver for the command design pattern example.<p> + * 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, + * 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 + * 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. + * 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> + * <p><i>This is the Java version.</i><p> * - * This version of the pattern lets the developer specify what should trigger + * 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. + * 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. @@ -59,46 +59,46 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command; * @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, + * 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"); - + Button button3 = new Button("Button3"); + Command com1 = new ButtonCommand(); Command com2 = new ButtonCommand2(); - + JPanel pane = new JPanel(); - pane.add(button1); + 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"); - + + JFrame frame = new JFrame("Command Pattern Example"); + frame.getContentPane().add(pane); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} - }); + }); frame.pack(); frame.setVisible(true); } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java index edc7d9d39..017142d62 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/aspectj/Printer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java index 3e5784fcd..02de439ce 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,19 +15,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 + * 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> @@ -44,9 +44,9 @@ public class Button extends JButton { /** * the command object associated with this button */ - + protected Command command; - + /** * Creates a new button with the provided label * @@ -58,23 +58,23 @@ public class Button extends JButton { this.setActionCommand(label); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - clicked(); + clicked(); } - }); + }); } /** - * Calls <code>ececuteCommand()</code> on the associated - * command object. This method gets called whenever the + * 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 * @@ -83,5 +83,5 @@ public class Button extends JButton { public void setCommand(Command command) { this.command = command; - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java index 9d0bb69d1..962d9648b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a sample command. This one prints a short message to + * 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>. + * <quote>"ButtonCommand executed"</quote>. * * @author Jan Hannemann * @author Gregor Kiczales @@ -33,14 +33,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; */ public class ButtonCommand implements Command { - + /** - * Implements a sample command. This one prints a short message to + * 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>. + * <quote>"ButtonCommand executed"</quote>. */ public void executeCommand() { System.out.println("ButtonCommand executed"); - } + } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java index 3844bda1a..1d63824db 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/ButtonCommand2.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,33 +15,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a sample command. This one prints a short message to + * 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>. + * <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 + * 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>. + * <quote>"ButtonCommand number 2 executed"</quote>. */ - + public void executeCommand() { System.out.println("ButtonCommand number 2 executed"); - } + } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java index d441f43ab..2bd85052f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Command.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java index 3a81bda07..a1c922e51 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/command/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,41 +15,41 @@ package ca.ubc.cs.spl.aspectPatterns.examples.command.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import javax.swing.JFrame; + +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> + * 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, + * 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 + * 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. + * 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> + * <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 @@ -57,41 +57,41 @@ import java.awt.event.WindowEvent; */ 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. + * 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) { - + + public static void main(String[] args) { + Button button1 = new Button("Print Date"); Button button2 = new Button("Command 1"); - Button button3 = new Button("Command 2"); - + Button button3 = new Button("Command 2"); + Command com1 = new ButtonCommand(); Command com2 = new ButtonCommand2(); JPanel pane = new JPanel(); - pane.add(button1); + 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"); - + JFrame frame = new JFrame("Command Pattern Example"); + frame.getContentPane().add(pane); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} - }); + }); frame.pack(); frame.setVisible(true); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java index d40f6363b..90936634f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Directory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements a <i>Composite</i>. Note that in this AspectJ version, the + * 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 Component * @see File */ - -public class Directory { + +public class Directory { /** * stores the name of this Directory */ protected String name; - + /** * Creates a new Directory with a given name * @@ -52,7 +52,7 @@ public class Directory { public Directory(String name) { this.name = name; } - + /** * Overwrites the <code>toString()</code> method from <code>Object</code> * to print information about this Directory @@ -62,4 +62,3 @@ public class Directory { return ("Directory: "+name); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java index 6231b140b..e750d48cf 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/File.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements a <i>Leaf</i>. Note that in this AspectJ version, the + * 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 Component * @see Directory */ - -public class File { - + +public class File { + /** * stores the name for this File */ protected String name; - + /** * stores the size for this File */ @@ -59,7 +59,7 @@ public class File { this.name = name; this.size = size; } - + /** * Overwrites the <code>toString()</code> method from <code>Object</code> * to print information about this object @@ -68,10 +68,10 @@ public class File { 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() { diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java index 559c84d78..6bb15e9c1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/FileSystemComposition.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,36 +15,36 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import java.io.PrintStream; -import java.util.Enumeration; + +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 + * 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> + * <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>. + * require changing the <i>Components</i>. * * @author Jan Hannemann * @author Gregor Kiczales @@ -53,20 +53,20 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CompositeProtocol; 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 @@ -86,7 +86,7 @@ public aspect FileSystemComposition extends CompositeProtocol { } /** - * Provides a client-accessible method that pretty-prints the + * Provides a client-accessible method that pretty-prints the * structure of the aggregate structure using a Visitor * * @param s the PrintStream to print to @@ -95,11 +95,11 @@ public aspect FileSystemComposition extends CompositeProtocol { 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 + * 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 @@ -109,8 +109,8 @@ public aspect FileSystemComposition extends CompositeProtocol { indent(); s.println("<Composite>"+this); indent +=4; - FileSystemComposition.aspectOf().recurseOperation(this, new Visitor() { - public void doOperation(Component c) { c.printStructure(s); } + FileSystemComposition.aspectOf().recurseOperation(this, new Visitor() { + public void doOperation(Component c) { c.printStructure(s); } } ); indent -=4; } @@ -125,47 +125,47 @@ public aspect FileSystemComposition extends CompositeProtocol { 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. + * 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 + * 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() { + public int Directory.subSum() { Enumeration enum = FileSystemComposition.aspectOf().recurseFunction( - this, new FunctionVisitor() { - public Object doFunction(Component c) { - return new Integer(c.subSum()); + 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. @@ -176,5 +176,4 @@ public aspect FileSystemComposition extends CompositeProtocol { public int File.subSum() { return size; } -} - +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java index 820faa6c2..81d8ab036 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -138,4 +138,4 @@ import java.util.Enumeration; System.out.println("\n<<< Test completed >>>\n"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java index dc9b300af..58fe96173 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Directory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,14 +15,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -import java.util.LinkedList; + +import java.util.LinkedList; /** * Implements a <i>Composite</i>. Children are stored in a linked list. @@ -30,16 +30,16 @@ import java.util.LinkedList; * @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 /** @@ -47,7 +47,7 @@ public class Directory implements FileSystemComponent { */ protected String name; - + /** * Creates a new Directory with a given name * @@ -57,7 +57,7 @@ public class Directory implements FileSystemComponent { public Directory(String name) { this.name = name; } - + /** * Overwrites the <code>toString()</code> method from <code>Object</code> * to print information about this Directory @@ -67,16 +67,16 @@ public class Directory implements FileSystemComponent { 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 @@ -92,7 +92,7 @@ public class Directory implements FileSystemComponent { * * @param index the position of the child */ - + public FileSystemComponent getChild(int index) { return (FileSystemComponent) children.get(index); } @@ -102,19 +102,18 @@ public class Directory implements FileSystemComponent { * * @returns the number of children of this Directory */ - + public int getChildCount() { return children.size(); } - + /** * Returns the size of this Directory. For simplicity, we define that only * files have a tangible size, so this method returns 0. - * + * * @return the size of the component (on disk) */ public int getSize() { return 0; } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java index 1f71cf941..fff5621d4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/File.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 */ @@ -39,7 +39,7 @@ public class File implements FileSystemComponent { */ protected String name; - + /** * stores the size for this File */ @@ -56,7 +56,7 @@ public class File implements FileSystemComponent { this.name = name; this.size = size; } - + /** * Overwrites the <code>toString()</code> method from <code>Object</code> * to print information about this object @@ -65,8 +65,8 @@ public class File implements FileSystemComponent { public String toString() { return ("File: "+name+" ("+size+" KB)"); } - - + + /** * Adds a child to the Component. Since Files have no * children, this method does nothing. @@ -92,26 +92,26 @@ public class File implements FileSystemComponent { * @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 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() { diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java index 1d70078a3..48a74ebc5 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/FileSystemComponent.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 @@ -33,19 +33,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/06/04 - * - * @see Directory + * + * @see Directory * @see File */ - -public interface FileSystemComponent { - + +public interface FileSystemComponent { + /** * Adds a child to the component * * @param component the child to add */ - + public void add(FileSystemComponent component); /** @@ -53,7 +53,7 @@ public interface FileSystemComponent { * * @param component the child to remove */ - + public void remove(FileSystemComponent component); /** @@ -61,7 +61,7 @@ public interface FileSystemComponent { * * @param index the position of the child */ - + public FileSystemComponent getChild(int index); /** @@ -69,12 +69,12 @@ public interface FileSystemComponent { * * @returns the number of children of this component */ - + public int getChildCount(); - + /** * Returns the size of this FileSystemComponent - * + * * @return the size of the component (on disk) */ public int getSize(); diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java index c36597e5f..e5536fd0d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/composite/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,71 +15,71 @@ package ca.ubc.cs.spl.aspectPatterns.examples.composite.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Composite design pattern example.<p> + * 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 + * 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 + * 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 + * 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> + * <p><i>This is the Java version.</i><p> * - * Every <i>Component</i> and every <i>Leaf</i> needs to know about the + * 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 Directory * @see File */ - -public class Main { + +public class Main { /** * helper variable to store recursion depth for pretty printing */ - - private static int indent = 0; + + 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 + /** + * Pretty-prints a recursive composite structure * * @param comp the component denoting the entry point into the structure */ - - private static void printStructure(FileSystemComponent comp) { + + private static void printStructure(FileSystemComponent comp) { indent(); System.out.println(comp); - indent +=4; + indent +=4; for (int i=0; i<comp.getChildCount(); i++) { printStructure(comp.getChild(i)); } @@ -88,8 +88,8 @@ public class Main { /** - * This example creates a simple structure as follows: Composite directory1 - * has three children: file1, directory2, and file3. directory2 has file2 + * This example creates a simple structure as follows: Composite directory1 + * has three children: file1, directory2, and file3. directory2 has file2 * as a child. */ @@ -102,18 +102,18 @@ public class Main { Directory directory2 = new Directory("Directory2"); File file1 = new File("File1", 123); File file2 = new File("File2", 4556); - File file3 = new File("File3", 16); - + File file3 = new File("File3", 16); + directory1.add(file1); directory1.add(directory2); directory2.add(file2); - directory1.add(file3); + directory1.add(file3); - System.out.println("done."); + System.out.println("done."); System.out.println("This is the Structure:"); - + printStructure(directory1); System.out.println("\n<<< Test completed >>>\n"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java index 1f60876f9..820cef7be 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/BracketDecorator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Adds brackets ("[", "]") before and after the string to decorate. * Acts as a <i>ConcreteDecorator</i> @@ -29,22 +29,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - */ - + */ + public aspect BracketDecorator { - + /** - * Identifies the execution points of interest: all calls to + * Identifies the execution points of interest: all calls to * <code>ConcreteOutput.print(String)</code>. */ - protected pointcut printCall(String s): + 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. + * the call on to the component this decorator aspect decorates. * * @param s the string to be decorated. */ @@ -53,4 +53,4 @@ public aspect BracketDecorator { s = "[" + s + "]"; // Decorates the string proceed(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java index 851830647..661a8fdac 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/ConcreteOutput.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,24 +15,24 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * 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 + * 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 { /** @@ -44,4 +44,4 @@ public class ConcreteOutput { public void print(String s) { System.out.print(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java index 0cec41d93..768bc52c9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,22 +15,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Decorator design pattern example.<p> + * 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 + * 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 + * <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> @@ -39,40 +39,40 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * string, Decorators (StarDecorator and BracketDecorator) wrap other * output around it. Output should be: "[ *** <String> *** ]" * - * <p><i>This is the AspectJ version.</i><p> + * <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 + * 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 StarDecorator * @see BracketDecorator */ - + public class Main { /** - * Implements the driver for the Decorator design pattern example.<p> + * 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> *** ]" + * 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>"); - + + original.print("<String>"); + System.out.println(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java index f7c85a768..b47712338 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/aspectj/StarDecorator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -58,4 +58,4 @@ public aspect StarDecorator { proceed(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java index 4b381865e..a1e6eda1d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/BracketDecorator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements a decorator that adds brackets ("[", "]") before and after the * string to decorate. @@ -29,13 +29,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * @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. + * the call on to the component this decorator decorates. * * @param s the string to be decorated. */ @@ -53,4 +53,4 @@ public class BracketDecorator extends OutputDecorator { public BracketDecorator(Output output) { super(output); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java index 90d82b5be..4cf7d3763 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/ConcreteOutput.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements the <i>Component</i> interface to print strings to <code> * System.out</code>. @@ -29,8 +29,8 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - */ - + */ + public class ConcreteOutput implements Output { /** @@ -42,4 +42,4 @@ public class ConcreteOutput implements Output { public void print(String s) { System.out.print(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java index fd0601599..c5266ef3d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,22 +15,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Decorator design pattern example.<p> + * 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 + * 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 + * <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> @@ -39,35 +39,35 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * string, Decorators (StarDecorator and BracketDecorator) wrap other * output around it. Output should be: "[ *** <String> *** ]" * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * - * This version allows for dynamic composition of decorators. + * 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> + * 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> *** ]" + * 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>"); - + + stared.print("<String>"); + System.out.println(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java index 49df113d4..a111d4802 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/Output.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,23 +15,23 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Defines an interface for printing Strings. Acts as <i>Component</i>. + * 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 { - + */ + +public interface Output { + /** * Prints the argument string to <code>System.out</code>. * @@ -40,4 +40,3 @@ public interface Output { public void print(String s); } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java index 2966d1f20..3021cb844 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/OutputDecorator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,31 +15,31 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Defines the <i>Decorator</i> interface. This is realized as an abstract - * class to allow for default implementations (set varible "output", + * Defines the <i>Decorator</i> interface. This is realized as an abstract + * class to allow for default implementations (set varible "output", * provide default implementation for <code>print(String)</code>). * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - */ - + */ + public abstract class OutputDecorator implements Output { /** * the <i>Component</i> to decorate - */ + */ protected Output outputComponent; - + /** * Prints the argument string to <code>System.out</code>. This method is * overwritten by concrete decorators. The default implementation @@ -47,22 +47,22 @@ public abstract class OutputDecorator implements Output { * * @param s the string to be printed. */ - - public void print(String s) { + + public void print(String s) { outputComponent.print(s); } - + /** - * Defines the constructor signature. Also provides a default - * implementation so that concrete decorators don't have to - * re-implement it. Subclasses (<i>ConcreteDecorator</i>s) can just + * Defines the constructor signature. Also provides a default + * implementation so that concrete decorators don't have to + * re-implement it. Subclasses (<i>ConcreteDecorator</i>s) can just * call <code>super(..)</code> and don't have * to deal with setting the variable themselves. * * @param output the <i>Component</i> to decorate. */ - + public OutputDecorator(Output output) { this.outputComponent = output; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java index 1e7cb393b..b501eac08 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/decorator/java/StarDecorator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements a decorator that adds stars (" *** ") before and after the * string to decorate. @@ -29,14 +29,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.decorator.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - */ - + */ + public class StarDecorator extends OutputDecorator { /** * Adds three stars before and after the argument string before passing - * the call on to the component this decorator decorates. + * the call on to the component this decorator decorates. * * @param s the string to be decorated. */ @@ -56,4 +56,4 @@ public class StarDecorator extends OutputDecorator { } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java index c6d59e657..eaf19ea9b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Decoration.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,16 +29,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * @author Gregor Kiczales * @version 1.11, 03/29/04 */ - + public class Decoration { /** * Provides a decorator string consisting of stars ("*"). * - * @returns a decorator string made up of stars + * @returns a decorator string made up of stars */ public static String getDecoration() { return "*******************************************"; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java index 815793fd5..1499b4c62 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/FacadePolicyEnforcement.java @@ -5,7 +5,7 @@ * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -13,11 +13,11 @@ * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; @@ -27,9 +27,9 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * warning if the <i>subsystem</i> is accessed from any other class but the * facade. We use <code>declare warning</code> here, but <code>declare error * </code> can also be used. - * - * Instead of protecting the encapsulated subsystem against (only) mehod - * calls, other pointcut types (or combinations) could be used to achieve + * + * Instead of protecting the encapsulated subsystem against (only) mehod + * calls, other pointcut types (or combinations) could be used to achieve * different effects. * * @author Jan Hannemann @@ -38,26 +38,26 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; */ public aspect FacadePolicyEnforcement { - + /** - * Enumerates all calls to encapsulated methods. It is of course easier + * Enumerates all calls to encapsulated methods. It is of course easier * to define this pointcut if the encapsulated subsystem is in a separate * package, and the protected classes do not have to be enumerated. */ - - pointcut callsToEncapsulatedMethods(): + + pointcut callsToEncapsulatedMethods(): call(* (Decoration || RegularScreen || StringTransformer).*(..)); - + /** * Defines what constitutes legal accesses to the protected subsystem. */ - + pointcut facade(): within(OutputFacade); - + /** * Whenever a method in the encapsulated susbsystem is called, a compile * time warning gets created - except if the method call comes from the - * <i>Facade</i> + * <i>Facade</i> */ declare warning: callsToEncapsulatedMethods() && !facade(): diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java index 06e5ce34c..d2ed78c43 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Facade design pattern example.<p> + * Implements the driver for the Facade design pattern example.<p> * - * Intent: <i>Provide a unified interface to a set of interfaces in a - * subsystem. Facade defines a higher-level interface that makes the + * Intent: <i>Provide a unified interface to a set of interfaces in a + * subsystem. Facade defines a higher-level interface that makes the * subsystem easier to use.</i><p> * * The <i>subsystem</i> consists of three classes that provide low-level @@ -35,42 +35,42 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * </i> class <code>OutputFacade</code> procides a higher-level interface * to output strings. This class calls methods on that higer-level interface. * - * * <p><i>This is the AspectJ version.</i><p> + * * <p><i>This is the AspectJ version.</i><p> * * For this pattern, both Java and AspectJ implementations are identical. * The pattern introduces no crosscutting and is not abstractable. However, * this example illustrates that AspectJ can be used to enforce the facade's * encapsulation of the subsystem in question. Both <code>declare warning - * </code> and <code>declare error</code> can be used to that effect. + * </code> and <code>declare error</code> can be used to that effect. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 03/29/04 */ - + public class Main { /** * Tests the higher-level interface of <code>OutputFacade</code>. - * + * * @param args Command-line parameters, ignored here - */ - + */ + public static void main(String[] args) { OutputFacade facade = new OutputFacade(); - + System.out.println("Testing regular Facade access..."); facade.printDecoration(); - + facade.printNormal("Facade: this is normal printing"); facade.printFancy ("Facade: this is fancy printing"); System.out.println("\nCircumventing Facade encapsulation..."); - - // Note that the compiler warning caused by the next line is + + // Note that the compiler warning caused by the next line is // intentional. See FacadePolicyEnforcement for details. RegularScreen.print("It works, but should create a compiler warning"); System.out.println(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java index 676e9e27b..33aeb5104 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/OutputFacade.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,42 +15,42 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>Facade</i> role in the pattern by providing a - * higher-level interface to the operations provided by - * <code>RegularScreen</code>, <code>Decoration</code>, + * Implements the <i>Facade</i> role in the pattern by providing a + * higher-level interface to the operations provided by + * <code>RegularScreen</code>, <code>Decoration</code>, * and <code>StringTransformer</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 03/29/04 */ - + public class OutputFacade { /** * Prints a string using <code>RegularScreen</code>. * - * @param s the string to print + * @param s the string to print */ public void printNormal(String s) { RegularScreen.print(s); RegularScreen.newline(); } - + /** - * Prints a two versions of string with decorations + * Prints a two versions of string with decorations * using <code>RegularScreen</code> and <code>Decoration</code>. * - * @param s the string to print + * @param s the string to print */ public void printFancy(String s) { @@ -63,7 +63,7 @@ public class OutputFacade { RegularScreen.print(StringTransformer.transformToLower(s+" (lowercase)")); RegularScreen.newline(); - + printDecoration(); } @@ -76,4 +76,4 @@ public class OutputFacade { RegularScreen.newline(); RegularScreen.newline(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java index bbd623afe..4ad393b31 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/RegularScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,19 +29,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * @author Gregor Kiczales * @version 1.11, 03/29/04 */ - + public class RegularScreen { /** * Prints a string to System.out. * - * @param s the string to print + * @param s the string to print */ public static void print(String s) { System.out.print(s); } - + /** * Prints a newline to System.out. */ @@ -49,4 +49,4 @@ public class RegularScreen { public static void newline() { System.out.println(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java index a1f5eafba..a6d2d53d1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/aspectj/StringTransformer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,7 +29,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.aspectj; * @author Gregor Kiczales * @version 1.11, 03/29/04 */ - + public class StringTransformer { /** @@ -42,7 +42,7 @@ public class StringTransformer { public static String transformToUpper(String s) { return s.toUpperCase(); } - + /** * Transforms a string to lower case * @@ -53,4 +53,4 @@ public class StringTransformer { public static String transformToLower(String s) { return s.toLowerCase(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java index 8425bc762..c6b552acf 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Decoration.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -41,4 +41,4 @@ public class Decoration { public static String getDecoration() { return "*******************************************"; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java index 36d7c0b4c..b93d0c102 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Facade design pattern example.<p> + * Implements the driver for the Facade design pattern example.<p> * - * Intent: <i>Provide a unified interface to a set of interfaces in a - * subsystem. Facade defines a higher-level interface that makes the + * Intent: <i>Provide a unified interface to a set of interfaces in a + * subsystem. Facade defines a higher-level interface that makes the * subsystem easier to use.</i><p> * * The <i>subsystem</i> consists of three classes that provide low-level @@ -35,29 +35,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * </i> class <code>OutputFacade</code> procides a higher-level interface * to output strings. This class calls methods on that higer-level interface. * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/29/04 */ - + public class Main { - + /** * Tests the higher-level interface of <code>OutputFacade</code>. - * + * * @param args Command-line parameters, ignored here - */ - + */ + public static void main(String[] args) { OutputFacade facade = new OutputFacade(); - + System.out.println("Testing Facade..."); facade.printDecoration(); - + facade.printNormal("Facade: this is normal printing"); facade.printFancy ("Facade: this is fancy printing"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java index 30c1bd8b5..bc280dfc9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/OutputFacade.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,42 +15,42 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>Facade</i> role in the pattern by providing a - * higher-level interface to the operations provided by - * <code>RegularScreen</code>, <code>Decoration</code>, + * Implements the <i>Facade</i> role in the pattern by providing a + * higher-level interface to the operations provided by + * <code>RegularScreen</code>, <code>Decoration</code>, * and <code>StringTransformer</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 */ - + public class OutputFacade { /** * Prints a string using <code>RegularScreen</code>. * - * @param s the string to print + * @param s the string to print */ public void printNormal(String s) { RegularScreen.print(s); RegularScreen.newline(); } - + /** - * Prints a two versions of string with decorations + * Prints a two versions of string with decorations * using <code>RegularScreen</code> and <code>Decoration</code>. * - * @param s the string to print + * @param s the string to print */ public void printFancy(String s) { @@ -63,7 +63,7 @@ public class OutputFacade { RegularScreen.print(StringTransformer.transformToLower(s+" (lowercase)")); RegularScreen.newline(); - + printDecoration(); } @@ -76,4 +76,4 @@ public class OutputFacade { RegularScreen.newline(); RegularScreen.newline(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java index acd753598..42267bb22 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/RegularScreen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,19 +29,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * @author Gregor Kiczales * @version 1.1, 02/11/04 */ - + public class RegularScreen { /** * Prints a string to System.out. * - * @param s the string to print + * @param s the string to print */ public static void print(String s) { System.out.print(s); } - + /** * Prints a newline to System.out. */ @@ -49,4 +49,4 @@ public class RegularScreen { public static void newline() { System.out.println(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java index 1353cfaa4..0ed622147 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/facade/java/StringTransformer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,7 +29,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.facade.java; * @author Gregor Kiczales * @version 1.1, 02/11/04 */ - + public class StringTransformer { /** @@ -42,7 +42,7 @@ public class StringTransformer { public static String transformToUpper(String s) { return s.toUpperCase(); } - + /** * Transforms a string to lower case * @@ -53,4 +53,4 @@ public class StringTransformer { public static String transformToLower(String s) { return s.toLowerCase(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java index d8966e882..dd5f622ac 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/AlternateLabelCreatorImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,48 +15,48 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; import javax.swing.JComponent; /** - * This aspect changes the behavior of a <i>Factory Method</i> using - * <code>around</code> advice. With this approach it is possible to - * have the factories create different products depending on the + * This aspect changes the behavior of a <i>Factory Method</i> using + * <code>around</code> advice. With this approach it is possible to + * have the factories create different products depending on the * aspects woven into the project. For example, this could be used * as a very basic approach to software configuration management. - * - * In this case, two slightly different label products are produced, + * + * In this case, two slightly different label products are produced, * depending on whether this aspect is woven into the system or not. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/01/04 - */ + */ public aspect AlternateLabelCreatorImplementation { - - /** - * Describes the factory method for which we want to + + /** + * Describes the factory method for which we want to * modify the product */ - - pointcut labelCreation(): + + pointcut labelCreation(): execution(JComponent LabelCreator.createComponent()); - + /** - * Creates the product, modifies it and passes the + * Creates the product, modifies it and passes the * modified product on. */ - + JComponent around(): labelCreation() { JLabel label = (JLabel) proceed(); label.setText("This is an alternate JLabel"); return label; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java index 673023831..2fd647694 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/ButtonCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JButton; @@ -33,10 +33,10 @@ import java.awt.event.ActionEvent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see LabelCreator - */ - + */ + public class ButtonCreator implements GUIComponentCreator { /** @@ -53,9 +53,9 @@ public class ButtonCreator implements GUIComponentCreator { button.setText("Thank you!"); } }); - return button; + return button; } - + /** * Returns a title explaining this example. * @@ -65,4 +65,4 @@ public class ButtonCreator implements GUIComponentCreator { public String getTitle() { return "Example 1: A JButton"; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java index 0b8669cfc..126e2eede 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/CreatorImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,63 +15,63 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JFrame; import javax.swing.JPanel; -import javax.swing.JComponent; +import javax.swing.JComponent; import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.WindowEvent; import java.awt.Point; /** * Provides a default implementation for the <i>anOperation()</i> - * method <code>showFrame()</code>. The implementation is attached to the - * <code>GUIComponentCreator</code> interface. With this approach, + * method <code>showFrame()</code>. The implementation is attached to the + * <code>GUIComponentCreator</code> interface. With this approach, * <i>GUIComponentCreator</i> does not have to be an abstract class. - * + * * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see GUIComponentCreator - */ + */ public aspect CreatorImplementation { - - /** + + /** * the position for the next frame to be created (on the screen) */ - + private static Point lastFrameLocation = new Point(0, 0); - /** + /** * Creates a <code>JFrame</code>, puts the <code>JComponent</code> that * is created by the factory method into it and displays the frame. This - * Method also provides a <code>WindowListener</code>. + * Method also provides a <code>WindowListener</code>. */ - + public final void GUIComponentCreator.showFrame() { JFrame frame = new JFrame(getTitle()); - + frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); - + JPanel panel = new JPanel(); - + panel.add(createComponent()); - + frame.getContentPane().add(panel); - frame.pack(); + frame.pack(); frame.setLocation(lastFrameLocation); lastFrameLocation.translate(75, 75); - frame.setVisible(true); - } -}
\ No newline at end of file + frame.setVisible(true); + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java index a2287ef6a..128c923a8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/GUIComponentCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,19 +15,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import javax.swing.JComponent; +import javax.swing.JComponent; /** - * Defines the <i>GUIComponentCreator</i> interface with the - * <i>factoryMethod()</i> method signature and the <i>anOperation()</i> - * method that uses it. For details, see GoF, page 108.<p> + * Defines the <i>GUIComponentCreator</i> interface with the + * <i>factoryMethod()</i> method signature and the <i>anOperation()</i> + * method that uses it. For details, see GoF, page 108.<p> * * The factory method is <code>createComponent</code> and it creates * A JComponent (a button and a label, repsectively). The <i>anOperation()</i> @@ -37,30 +37,28 @@ import javax.swing.JComponent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see ButtonCreator * @see LabelCreator - */ - + */ + public interface GUIComponentCreator { - + /** - * The factory method to create <code>JComponent</code>s, to be + * The factory method to create <code>JComponent</code>s, to be * concretized by subclasses. * * @returns the created product */ - public JComponent createComponent(); - + public JComponent createComponent(); + /** * Another factory method to create a title that explains the created * component * * @returns the title for the GUI frame */ - - public String getTitle(); -} -
\ No newline at end of file + public String getTitle(); +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java index 200ec456d..0acf2632f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/LabelCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; @@ -31,10 +31,10 @@ import javax.swing.JComponent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see ButtonCreator - */ - + */ + public class LabelCreator implements GUIComponentCreator { /** @@ -45,9 +45,9 @@ public class LabelCreator implements GUIComponentCreator { public JComponent createComponent() { JLabel label = new JLabel("This is a JLabel."); - return label; + return label; } - + /** * Returns a title explaining this example. * @@ -57,4 +57,4 @@ public class LabelCreator implements GUIComponentCreator { public String getTitle() { return "Example 2: A JLabel"; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java index 8ae2a2f3a..a9156bfc4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the FactoryMethod design pattern example.<p> + * Implements the driver for the FactoryMethod design pattern example.<p> * - * Intent: <i>Define an interface for creating an object, but let subclasses - * decide which class to instantiate. Factory Method lets a class defer + * Intent: <i>Define an interface for creating an object, but let subclasses + * decide which class to instantiate. Factory Method lets a class defer * instantiation to subclasses.</i><p> * - * Participating objects are <code>ButtonCreator</code> and + * Participating objects are <code>ButtonCreator</code> and * <code>LabelCreator</code> as <i>ConcreteCreator</i>s. Both implement * the <code>GUIComponentCreator</code> interface.<p> * @@ -42,15 +42,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; * <p><i>This is the AspectJ version.</i><p> * * Since the implementation of the <i>anOperation()</i> method <code> - * showFrame()</code> is now realized by an aspect, - * <code>GUIComponentCreator</code> can now be an interface, allowing - * the <i>ConcreteCreator</i>s to be part of a different inheritance + * showFrame()</code> is now realized by an aspect, + * <code>GUIComponentCreator</code> can now be an interface, allowing + * the <i>ConcreteCreator</i>s to be part of a different inheritance * hierarchy. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see GUIComponentCreator * @see ButtonCreator * @see LabelCreator @@ -59,21 +59,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.aspectj; public class Main { /** - * Implements the driver for the FactoryMethod design pattern example.<p> + * Implements the driver for the FactoryMethod design pattern example.<p> * - * In this example, the factory method <code>createComponent</code> - * creates a JComponent (a button and a label, repsectively). The - * <i>anOperation()</i> method <code>showFrame()</code> uses the factory - * methods to show a little GUI. In one case, the created frame contains + * In this example, the factory method <code>createComponent</code> + * creates a JComponent (a button and a label, repsectively). The + * <i>anOperation()</i> method <code>showFrame()</code> uses the factory + * methods to show a little GUI. In one case, the created frame contains * a button, in the other a simple label. - */ + */ public static void main(String[] args) { - + GUIComponentCreator creator1 = new ButtonCreator(); GUIComponentCreator creator2 = new LabelCreator(); - + creator1.showFrame(); creator2.showFrame(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java index 7346fdb09..ea558a1ed 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/ButtonCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JButton; @@ -33,10 +33,10 @@ import java.awt.event.ActionEvent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see LabelCreator - */ - + */ + public class ButtonCreator extends GUIComponentCreator { /** @@ -53,9 +53,9 @@ public class ButtonCreator extends GUIComponentCreator { button.setText("Thank you!"); } }); - return button; + return button; } - + /** * Returns a title explaining this example. * @@ -65,4 +65,4 @@ public class ButtonCreator extends GUIComponentCreator { public String getTitle() { return "Example 1: A JButton"; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java index 9a4b0101d..a3037c3e5 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/GUIComponentCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,88 +15,86 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JFrame; import javax.swing.JPanel; -import javax.swing.JComponent; +import javax.swing.JComponent; import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.event.WindowEvent; import java.awt.Point; /** - * Defines the <i>GUIComponentCreator</i> interface with the - * <i>factoryMethod()</i> method signature and the <i>anOperation()</i> - * method that uses it. For details, see GoF, page 108.<p> + * Defines the <i>GUIComponentCreator</i> interface with the + * <i>factoryMethod()</i> method signature and the <i>anOperation()</i> + * method that uses it. For details, see GoF, page 108.<p> * * The factory method is <code>createComponent</code> and it creates * A JComponent (a button or a label, in this case). The <i>anOperation()</i> * method <code>showFrame()</code> uses the factory method to show a small - * GUI. + * GUI. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see ButtonCreator * @see LabelCreator - */ - + */ + public abstract class GUIComponentCreator { - + /** * The factory method to be concretized by subclasses. * * @returns the created <i>ConcreteProduct</i> */ - public abstract JComponent createComponent(); - + public abstract JComponent createComponent(); + /** * Another factory method to create a title for the GUI frame created * by this class. * * @returns the title for the GUI frame */ - - public abstract String getTitle(); - /** + public abstract String getTitle(); + + /** * the position for the next frame to be created (on the screen). This - * variable is used to make sure new frames appear staggered and don't + * variable is used to make sure new frames appear staggered and don't * entirely overlap with existing frames. */ - + private static Point lastFrameLocation = new Point(0, 0); - /** + /** * Creates a <code>JFrame</code>, puts the <code>JComponent</code> that * is created by the factory method into it and displays the frame. This - * Method also provides a <code>WindowListener</code>. + * Method also provides a <code>WindowListener</code>. */ - + public final void showFrame() { JFrame frame = new JFrame(getTitle()); - + frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); - + JPanel panel = new JPanel(); - + panel.add(createComponent()); - + frame.getContentPane().add(panel); - frame.pack(); + frame.pack(); frame.setLocation(lastFrameLocation); lastFrameLocation.translate(75, 75); - frame.setVisible(true); + frame.setVisible(true); } -} - -
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java index 40bbd8b8c..c102bb9a7 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/LabelCreator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JLabel; @@ -31,10 +31,10 @@ import javax.swing.JComponent; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see ButtonCreator - */ - + */ + public class LabelCreator extends GUIComponentCreator { /** @@ -45,9 +45,9 @@ public class LabelCreator extends GUIComponentCreator { public JComponent createComponent() { JLabel label = new JLabel("This is a JLabel."); - return label; + return label; } - + /** * Returns a title explaining this example. * @@ -57,4 +57,4 @@ public class LabelCreator extends GUIComponentCreator { public String getTitle() { return "Example 2: A JLabel"; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java index a068f8f7d..0c70d8171 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/factoryMethod/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the FactoryMethod design pattern example.<p> + * Implements the driver for the FactoryMethod design pattern example.<p> * - * Intent: <i>Define an interface for creating an object, but let subclasses - * decide which class to instantiate. Factory Method lets a class defer + * Intent: <i>Define an interface for creating an object, but let subclasses + * decide which class to instantiate. Factory Method lets a class defer * instantiation to subclasses.</i><p> * - * Participating objects are <code>ButtonCreator</code> and + * Participating objects are <code>ButtonCreator</code> and * <code>LabelCreator</code> as <i>ConcreteCreator</i>s. Both implement * the <code>GUIComponentCreator</code> interface.<p> * @@ -42,15 +42,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; * <p><i>This is the Java version.</i><p> * * Since the <i>anOperation()</i> method requires an implementation, <i> - * GUIComponentCreator</i> has to be an abstract class (as opposed to an - * interface). Consequently, all <i>ConcreteCreator</i>s have to be - * subclasses of that class and cannot belong to a different inheritance + * GUIComponentCreator</i> has to be an abstract class (as opposed to an + * interface). Consequently, all <i>ConcreteCreator</i>s have to be + * subclasses of that class and cannot belong to a different inheritance * hierarchy. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see GUIComponentCreator * @see ButtonCreator * @see LabelCreator @@ -59,21 +59,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.factoryMethod.java; public class Main { /** - * Implements the driver for the FactoryMethod design pattern example.<p> + * Implements the driver for the FactoryMethod design pattern example.<p> * - * In this example, the factory method <code>createComponent</code> - * creates a JComponent (a button and a label, repsectively). The - * <i>anOperation()</i> method <code>showFrame()</code> uses the factory - * methods to show a little GUI. In one case, the created frame contains + * In this example, the factory method <code>createComponent</code> + * creates a JComponent (a button and a label, repsectively). The + * <i>anOperation()</i> method <code>showFrame()</code> uses the factory + * methods to show a little GUI. In one case, the created frame contains * a button, in the other a simple label. - */ - + */ + public static void main(String[] args) { - + GUIComponentCreator creator1 = new ButtonCreator(); GUIComponentCreator creator2 = new LabelCreator(); - + creator1.showFrame(); creator2.showFrame(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java index 7e024edf8..3a92e2f24 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/CharacterFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** /** * A <i>ConcreteFlyweight</i> storing a single regular character @@ -36,29 +36,29 @@ public class CharacterFlyweight implements PrintableFlyweight { /** * The character this <i>ConcreteFlyweight</i> represents */ - + private char c; - - /** - * Creates a new <i>ConcreteFlyweight</i> and sets it to represent a + + /** + * Creates a new <i>ConcreteFlyweight</i> and sets it to represent a * particular regular character - * + * * @param c the character to represent */ - + public CharacterFlyweight(char c) { this.c = c; } - - /** + + /** * Prints the stored character * * @param uppercase whether the character should be printed in * uppercase - */ - + */ + public void print(boolean uppercase) { System.out.print(uppercase ? Character.toUpperCase(c) : c); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java index f3ecc43a0..51a5dda8c 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/FlyweightImplementation.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,23 +15,23 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import ca.ubc.cs.spl.aspectPatterns.patternLibrary.FlyweightProtocol; /** - * Implements a concrete instance of the flyweight pattern using the + * Implements a concrete instance of the flyweight pattern using the * abstract implementation found in <code>FlyweightProtocol</code>. - * - * It assigns the <i>Flyweight</i> pattern role to the participants and + * + * It assigns the <i>Flyweight</i> pattern role to the participants and * provides the implementation for creating <i>Flyweight</i>s. - * - * A concenience method is provided to utilize the abstract aspect's + * + * A concenience method is provided to utilize the abstract aspect's * <i>getFlyweight(...)</i> implementation with an appropriate return type. * * @author Jan Hannemann @@ -41,22 +41,22 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.FlyweightProtocol; public aspect FlyweightImplementation extends FlyweightProtocol { - - /** + + /** * Assigns the <i>Flyweight</i> role to CharacterFlyweight. */ declare parents: CharacterFlyweight implements Flyweight; - /** + /** * Assigns the <i>Flyweight</i> role to WhitespaceFlyweight. */ declare parents: WhitespaceFlyweight implements Flyweight; /** - * Actually creates the <i>Flyweight</i> for a given <i>Key</i>. This - * method is called by <code>getFlyweight(Object)</code> if the + * Actually creates the <i>Flyweight</i> for a given <i>Key</i>. This + * method is called by <code>getFlyweight(Object)</code> if the * flyweight does not already exist. * * @param key the key identifying the particular <i>Flyweight</i> @@ -64,19 +64,19 @@ public aspect FlyweightImplementation extends FlyweightProtocol { */ protected Flyweight createFlyweight(Object key) { - char c = ((Character) key).charValue(); + char c = ((Character) key).charValue(); Flyweight flyweight = null; if (Character.isWhitespace(c)) { flyweight = new WhitespaceFlyweight(c); - } else { + } else { flyweight = new CharacterFlyweight(c); } - return flyweight; - } - + return flyweight; + } + /** - * Provides a custom interface to access the <i>Flyweights</i>. - * Refers to the general <code>getFlyweight(Object)</code> method + * Provides a custom interface to access the <i>Flyweights</i>. + * Refers to the general <code>getFlyweight(Object)</code> method * defined on the abstract aspect. * * @param c the character identifying the particular flyweight @@ -86,4 +86,4 @@ public aspect FlyweightImplementation extends FlyweightProtocol { public PrintableFlyweight getPrintableFlyweight(char c) { return (PrintableFlyweight) getFlyweight(new Character(c)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java index dce3cd0dd..c7e4687d0 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,31 +15,31 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Flyweight design pattern example.<p> + * Implements the driver for the Flyweight design pattern example.<p> * - * Intent: <i>Use sharing to support large numbers of fine-grained objects + * Intent: <i>Use sharing to support large numbers of fine-grained objects * efficiently.</i><p> * * Participating <i>Flyweight</i> classes are <code>CharacterFlyweight</code> * and <code>WhitespaceFlyweight</code>. Both implement the <code> - * PrintableFlyweight</code> interface. Flyweights are generated via the + * PrintableFlyweight</code> interface. Flyweights are generated via the * <code>PrintableFlyweightFactory</code>. <P> - * - * Intrinsic state: The character to print, + * + * Intrinsic state: The character to print, * Extrinsic state: Whether the char is upper case or lower case * * This example creates a sentence out of <code>PrintableFlyweight</i>s * (characters and whitespaces). * - * <p><i>This is the AspectJ version.</i><p> + * <p><i>This is the AspectJ version.</i><p> * * The creation-on-demand functionality is performed by the abstract * pattern aspect. @@ -47,21 +47,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweight */ public class Main { /** - * Implements the driver for the Flyweight design pattern example.<p> + * Implements the driver for the Flyweight design pattern example.<p> * * This example creates a sentence out of <code>PrintableFlyweight</i>s - * (characters and whitespaces). + * (characters and whitespaces). */ public static void main(String[] args) { - + System.out.println("This is a test for the AspectJ version of the " + "Flyweight pattern implementation."); System.out.println("The client will use char flyweights to print " @@ -69,46 +69,46 @@ public class Main { System.out.println("\"This Is A Test\".\n"); System.out.println("Testing Pattern: Flyweight - STARTING\n"); - PrintableFlyweight T = + PrintableFlyweight T = FlyweightImplementation.aspectOf().getPrintableFlyweight('t'); - PrintableFlyweight H = + PrintableFlyweight H = FlyweightImplementation.aspectOf().getPrintableFlyweight('h'); - PrintableFlyweight I = + PrintableFlyweight I = FlyweightImplementation.aspectOf().getPrintableFlyweight('i'); - PrintableFlyweight S = + PrintableFlyweight S = FlyweightImplementation.aspectOf().getPrintableFlyweight('s'); - PrintableFlyweight A = + PrintableFlyweight A = FlyweightImplementation.aspectOf().getPrintableFlyweight('a'); - PrintableFlyweight E = + PrintableFlyweight E = FlyweightImplementation.aspectOf().getPrintableFlyweight('e'); - PrintableFlyweight Empty = - FlyweightImplementation.aspectOf().getPrintableFlyweight(' '); - + PrintableFlyweight Empty = + FlyweightImplementation.aspectOf().getPrintableFlyweight(' '); + // Printing: "This Is A Test" - + T.print(true); H.print(false); I.print(false); S.print(false); - + Empty.print(true); - + I.print(true); S.print(false); - + Empty.print(true); - + A.print(true); - + Empty.print(true); - + T.print(true); E.print(false); S.print(false); - T.print(false); - + T.print(false); + System.out.println(); - + System.out.println("\nTesting Pattern: State - FINISHED"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java index 35aba15e1..c1008bf0f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/PrintableFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,30 +15,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Defines the <i>Flyweight</i> interface. Here, the flyweights are + * Defines the <i>Flyweight</i> interface. Here, the flyweights are * characters that offer a single method: <code>print(boolean)</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 */ - -public interface PrintableFlyweight { + +public interface PrintableFlyweight { /** - * Defines the method signature for <i>Flyweights</i>' + * Defines the method signature for <i>Flyweights</i>' * <code>print()</code> method * * @param uppercase whether the character is to be printed as uppercase */ - + public void print(boolean uppercase); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java index 0c4066223..891895d14 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/aspectj/WhitespaceFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * A <i>ConcreteFlyweight</i> storing a single whitespace + * A <i>ConcreteFlyweight</i> storing a single whitespace * character * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweightFactory */ @@ -39,28 +39,28 @@ public class WhitespaceFlyweight implements PrintableFlyweight { /** * The character this flyweight represents */ - + private char c; - - /** - * Creates a new flyweight and sets it to represent a particular + + /** + * Creates a new flyweight and sets it to represent a particular * whitespace character - * + * * @param c the character to represent */ public WhitespaceFlyweight(char c) { this.c = c; } - - /** + + /** * Prints the stored character * * @param uppercase whether the character should be printed in * uppercase - */ - + */ + public void print(boolean uppercase) { System.out.print(uppercase ? Character.toUpperCase(c) : c); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java index 6c61d4fd6..46216f10b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/CharacterFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -62,4 +62,4 @@ public class CharacterFlyweight implements PrintableFlyweight { public void print(boolean uppercase) { System.out.print(uppercase ? Character.toUpperCase(c) : c); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java index 23be7e85e..d23e78e07 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,40 +15,40 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Flyweight design pattern example.<p> + * Implements the driver for the Flyweight design pattern example.<p> * - * Intent: <i>Use sharing to support large numbers of fine-grained objects + * Intent: <i>Use sharing to support large numbers of fine-grained objects * efficiently.</i><p> * * Participating <i>Flyweight</i> classes are <code>CharacterFlyweight</code> * and <code>WhitespaceFlyweight</code>. Both implement the <code> - * PrintableFlyweight</code> interface. Flyweights are generated via the + * PrintableFlyweight</code> interface. Flyweights are generated via the * <code>PrintableFlyweightFactory</code>. <P> - * + * * These are the pattern roles: <UL> * * <LI> CharacterFlyweightFactory: FlyweightFactory * <LI> PritableFlyweight: Flyweight * <LI> CharacterFlyweight: ConcreteFlyweight * <LI> WhitespaceFlyweight: ConcreteFlyweight - * <LI> Main: Client - * </UL> + * <LI> Main: Client + * </UL> * - * Intrinsic state: The character to print, + * Intrinsic state: The character to print, * Extrinsic state: Whether the char is upper case or lower case * * This example creates a sentence out of <code>PrintableFlyweight</i>s * (characters and whitespaces). * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * * This implementation is analoguous to the GoF book's description. * For this version, we only use two classes for the flyweights, @@ -59,7 +59,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweight * @see PrintableFlyweightFactory */ @@ -67,14 +67,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; public class Main { /** - * Implements the driver for the Flyweight design pattern example.<p> + * Implements the driver for the Flyweight design pattern example.<p> * * This example creates a sentence out of <code>PrintableFlyweight</i>s - * (characters and whitespaces). + * (characters and whitespaces). */ public static void main(String[] args) { - + System.out.println("This is a test for the java Flyweight pattern " + "implementation."); System.out.println("The client will use char flyweights to print the " @@ -83,40 +83,40 @@ public class Main { System.out.println("Testing Pattern: Flyweight - STARTING\n"); PrintableFlyweightFactory pff = new PrintableFlyweightFactory(); - + PrintableFlyweight T = pff.getPrintableFlyweight('t'); PrintableFlyweight H = pff.getPrintableFlyweight('h'); PrintableFlyweight I = pff.getPrintableFlyweight('i'); PrintableFlyweight S = pff.getPrintableFlyweight('s'); PrintableFlyweight A = pff.getPrintableFlyweight('a'); PrintableFlyweight E = pff.getPrintableFlyweight('e'); - PrintableFlyweight Empty = pff.getPrintableFlyweight(' '); - + PrintableFlyweight Empty = pff.getPrintableFlyweight(' '); + // Printing: "This Is A Test" - + T.print(true); H.print(false); I.print(false); S.print(false); - + Empty.print(true); - + I.print(true); S.print(false); - + Empty.print(true); - + A.print(true); - + Empty.print(true); - + T.print(true); E.print(false); S.print(false); - T.print(false); - + T.print(false); + System.out.println(); - + System.out.println("\nTesting Pattern: State - FINISHED"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java index 89e8b8e8c..230843dab 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,32 +15,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Defines the <i>Flyweight</i> interface. Here, the flyweights are + * Defines the <i>Flyweight</i> interface. Here, the flyweights are * characters that offer a single method: <code>print(boolean)</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweightFactory */ - -public interface PrintableFlyweight { - + +public interface PrintableFlyweight { + /** - * Defines the method signature for <i>Flyweights</i>' + * Defines the method signature for <i>Flyweights</i>' * <code>print()</code> method * * @param uppercase whether the character is to be printed as uppercase */ - + public void print(boolean uppercase); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java index 56bfe74cc..3411ddfd1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/PrintableFlyweightFactory.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,29 +15,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import java.util.Hashtable; /** - * Implements a <i>FlyweightFactory</i> that employs a creation-on-demand + * Implements a <i>FlyweightFactory</i> that employs a creation-on-demand * policy. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweight */ -public class PrintableFlyweightFactory { - - /** +public class PrintableFlyweightFactory { + + /** * stores the existing flyweights by character they represent */ @@ -45,7 +45,7 @@ public class PrintableFlyweightFactory { /** * Returns the flyweight representing the argument character. - * If the appropriate flyweight does not yet exist, it is created + * If the appropriate flyweight does not yet exist, it is created * on demand. * * @param c the character for which the the flyweight is returned @@ -54,19 +54,19 @@ public class PrintableFlyweightFactory { public PrintableFlyweight getPrintableFlyweight(char c) { - Character ch = new Character(c); - + Character ch = new Character(c); + if (printables.containsKey(ch)) { - return (PrintableFlyweight) printables.get(ch); + return (PrintableFlyweight) printables.get(ch); } else { PrintableFlyweight flyweight = null; if (Character.isWhitespace(c)) { flyweight = new WhitespaceFlyweight(c); - } else { + } else { flyweight = new CharacterFlyweight(c); } printables.put(ch, flyweight); - return flyweight; - } + return flyweight; + } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java index dfc1d4484..694617026 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/flyweight/java/WhitespaceFlyweight.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.flyweight.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * A <i>ConcreteFlyweight</i> storing a single whitespace + * A <i>ConcreteFlyweight</i> storing a single whitespace * character * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see PrintableFlyweightFactory */ @@ -39,28 +39,28 @@ public class WhitespaceFlyweight implements PrintableFlyweight { /** * The character this flyweight represents */ - + private char c; - - /** - * Creates a new flyweight and sets it to represent a particular + + /** + * Creates a new flyweight and sets it to represent a particular * whitespace character - * + * * @param c the character to represent */ public WhitespaceFlyweight(char c) { this.c = c; } - - /** + + /** * Prints the stored character. * * @param uppercase whether the character should be printed in * uppercase - */ - + */ + public void print(boolean uppercase) { System.out.print(uppercase ? Character.toUpperCase(c) : c); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java index 5ddb4fcf2..a3831f872 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/AndExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java index 685595dba..2faec984e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanConstant.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -30,20 +30,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * @version 1.1, 02/11/04 */ -public class BooleanConstant implements BooleanExpression { +public class BooleanConstant implements BooleanExpression { /** * the value of this constant */ - + protected boolean value; - /** - * Creates a new constant with the given value + /** + * Creates a new constant with the given value * * @param value the value this constant should represent - */ - + */ + public BooleanConstant(boolean value) { this.value = value; } @@ -58,6 +58,6 @@ public class BooleanConstant implements BooleanExpression { public boolean evaluate(VariableContext c) { return value; } - -}
\ No newline at end of file + +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java index 3ec0fbf54..7c3704ca6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -31,14 +31,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; */ public abstract interface BooleanExpression { - + /** * Evaluates this expression in the given <i>VariableContext</i> * * @param c the context to evaluate the <i>Expression</i> in * @return the boolean value of the <i>Expression</i> */ - + public boolean evaluate(VariableContext c); /** @@ -48,7 +48,7 @@ public abstract interface BooleanExpression { * @param exp the <i>Expression</i> to replace the variable * @return a copy of this <i>Expression</i> with the variable replaced */ - + public BooleanExpression replace(String name, BooleanExpression exp); /** @@ -56,6 +56,6 @@ public abstract interface BooleanExpression { * * @return the copied <i>Expression</i> */ - + public BooleanExpression copy(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java index a3e5b809e..527d449cd 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/BooleanInterpretation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,51 +15,51 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements <code>replace(String, BooleanExpression)<code> and * <code>copy()</code> methods for all concrete - * <code>BooleanExpression</code>s. + * <code>BooleanExpression</code>s. * * The very nature of the interpreter pattern introduces coupling between all - * participants. Unfortunately, removing the pattern code from the + * participants. Unfortunately, removing the pattern code from the * participants does not work as nicely here as with other patterns. The - * reason is that the roles are defining, i.e., each participant's + * reason is that the roles are defining, i.e., each participant's * functionality is determined (only) by its role. If aspects were used - * to implement the entire pattern functionality, it would leave - * the <i>Expressions</i> etc. empty and would make the aspect a + * to implement the entire pattern functionality, it would leave + * the <i>Expressions</i> etc. empty and would make the aspect a * monolithic module. <p> * * However, it is still possible to augment or change the behaviour of the - * system without changing all participant classes. To show this, we + * system without changing all participant classes. To show this, we * assumed that <code>BooleanExpression.replace(String, BooleanExpression) - * </code> and <code>BooleanExpression.copy()</code> were added later. - * An aspect is used to implement those methods, so that other - * classes do not have to change (we only changed the interface, but + * </code> and <code>BooleanExpression.copy()</code> were added later. + * An aspect is used to implement those methods, so that other + * classes do not have to change (we only changed the interface, but * even that was not necessary).<p> * - * In general, however, this pattern does not lend itself nicely to + * In general, however, this pattern does not lend itself nicely to * aspectification.<p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see BooleanExpression */ public aspect BooleanInterpretation { - + // AndExpressionression /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * * @param name the name of the variable * @param exp the <i>Expression</i> to replace the variable @@ -69,21 +69,21 @@ public aspect BooleanInterpretation { public BooleanExpression AndExpression.replace(String name, BooleanExpression exp) { return new AndExpression(expression1.replace(name, exp), expression2.replace(name,exp)); } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression AndExpression.copy() { return new AndExpression(expression1.copy(), expression2.copy()); - } + } // BooleanConstant /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * Has no effect on constants. * * @param name the name of the variable @@ -92,23 +92,23 @@ public aspect BooleanInterpretation { */ public BooleanExpression BooleanConstant.replace(String name, BooleanExpression exp) { - return this; + return this; } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression BooleanConstant.copy() { return new BooleanConstant(value); } // OrExpression - + /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * * @param name the name of the variable * @param exp the <i>Expression</i> to replace the variable @@ -118,21 +118,21 @@ public aspect BooleanInterpretation { public BooleanExpression OrExpression.replace(String name, BooleanExpression exp) { return new OrExpression(expression1.replace(name, exp), expression2.replace(name,exp)); } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression OrExpression.copy() { return new OrExpression(expression1.copy(), expression2.copy()); } - + // VariableExpression /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * * @param name the name of the variable * @param exp the <i>Expression</i> to replace the variable @@ -146,22 +146,22 @@ public aspect BooleanInterpretation { return new VariableExpression(this.name); } } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression VariableExpression.copy() { return new VariableExpression(name); } // NotExpressionressionressionression - + /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * * @param name the name of the variable * @param exp the <i>Expression</i> to replace the variable @@ -171,15 +171,14 @@ public aspect BooleanInterpretation { public BooleanExpression NotExpression.replace(String name, BooleanExpression exp) { return new NotExpression(this.exp.replace(name, exp)); } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression NotExpression.copy() { return new NotExpression(exp.copy()); - } + } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java index 61cda48ad..da72797e5 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/ExpressionException.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -32,14 +32,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; */ public class ExpressionException extends RuntimeException { - + /** * Creates a new ExpressionException with the given message * * @param s the exception message */ - + public ExpressionException(String s) { super(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java index 3a0c6f232..09fc08161 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Intepreter design pattern example.<p> + * Implements the driver for the Intepreter design pattern example.<p> * * Intent: <i>Given a language, defeine a representation fro its grammar along * with an interpreter that uses the representation to interpret sentences @@ -31,44 +31,44 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * * Participating objects are <code>BooleanContant</code>, <code>VariableExpression * </code>, <code>OrExpression</code>, <code>AndExpression</code>, and <code>NotExpression</code> - * as <i>Expressions</i>. The <i>AbstractExpression</i> interface is defined + * as <i>Expressions</i>. The <i>AbstractExpression</i> interface is defined * in <code>BooelanExp</i>.<p> * - * This example implements an interpreter for a language of boolean + * This example implements an interpreter for a language of boolean * expressions. As a sample expression, "((true & x) | (y & !x))" is - * interpreted for all possible boolean values for x and y. After that, + * interpreted for all possible boolean values for x and y. After that, * y is replaced by another expression and the whole expression is - * evaluated again. + * evaluated again. * * <p><i>This is the AspectJ version.</i><p> * - * The very nature of this pattern introduces coupling between all - * participants. Unfortunately, removing the pattern code from the + * The very nature of this pattern introduces coupling between all + * participants. Unfortunately, removing the pattern code from the * participants does not work as nicely here as with other patterns. The - * reason is that the roles are defining, i.e., each participant's + * reason is that the roles are defining, i.e., each participant's * functionality is determined (only) by its role. Removing pattern * specific code into an aspect would leave the <i>Expressions</i> etc. * empty and would make the aspect a monolithic module. <p> * * However, it is still possible to augment or change the behaviour of the - * system without changing all participant classes. To show this, we + * system without changing all participant classes. To show this, we * assumed that <code>BooleanExpression.replace(String, BooleanExpression)</code> and * <code>BooleanExpression.copy()</code> were added later. The methods are * defined in an aspect, so that other classes did not have to change.<p> * - * In general, however, this pattern does not lend itself nicely to + * In general, however, this pattern does not lend itself nicely to * aspectification.<p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see BooleanExpression */ public class Main { - /** + /** * Assigns boolean values to two <code>VariableExpression</code>s and evaluates * an expression in the given context. * @@ -90,13 +90,13 @@ public class Main { } /** - * Implements the driver for the Intepreter design pattern example.<p> + * Implements the driver for the Intepreter design pattern example.<p> * - * This example implements an interpreter for a language of boolean + * This example implements an interpreter for a language of boolean * expressions. As a sample expression, "((true & x) | (y & !x))" is - * interpreted for all possible boolean values for x and y. After that, + * interpreted for all possible boolean values for x and y. After that, * y is replaced by another expression and the whole expression is - * evaluated again. + * evaluated again. * * @args command-line parameters, unused. */ @@ -104,23 +104,23 @@ public class Main { public static void main(String[] args) { BooleanExpression exp = null; VariableContext context = new VariableContext(); - + VariableExpression x = new VariableExpression("X"); - VariableExpression y = new VariableExpression("Y"); - - exp = new OrExpression(new AndExpression(new BooleanConstant(true), x), + VariableExpression y = new VariableExpression("Y"); + + exp = new OrExpression(new AndExpression(new BooleanConstant(true), x), new AndExpression(y, new NotExpression(x))); - - System.out.println("Testing Expr: ((true & x) | (y & !x))"); + + System.out.println("Testing Expr: ((true & x) | (y & !x))"); assignAndEvaluate(x, false, y, false, context, exp); assignAndEvaluate(x, false, y, true, context, exp); assignAndEvaluate(x, true, y, false, context, exp); assignAndEvaluate(x, true, y, true, context, exp); - + VariableExpression z = new VariableExpression("Z"); NotExpression notZ = new NotExpression(z); - + BooleanExpression replacement = exp.replace("Y", notZ); context.assign(z, false); boolean result = replacement.evaluate(context); @@ -128,4 +128,3 @@ public class Main { System.out.println("The result for the replacement is: "+result); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java index 817fd85f7..f1a077d1e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/NotExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements negation for booleans expressions. This is a concrete boolean * <i>NonterminalExpression</i> @@ -33,24 +33,24 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; public class NotExpression implements BooleanExpression { - /** + /** * the <i>Expression</i> this <i>Expression</i> negates */ - + protected BooleanExpression exp = null; - + /** - * Creates a new NOT <i>Expression</i> negating the argument expression + * Creates a new NOT <i>Expression</i> negating the argument expression * - * @param exp the <i>Expression</i> to negate + * @param exp the <i>Expression</i> to negate */ public NotExpression(BooleanExpression exp) { this.exp = exp; } - + /** - * Evaluates this <i>Expression</i> in the given + * Evaluates this <i>Expression</i> in the given * <i>Context</i> * * @param c the context to evaluate the <i>Expression</i> in @@ -58,6 +58,6 @@ public class NotExpression implements BooleanExpression { */ public boolean evaluate(VariableContext c) { - return (! exp.evaluate(c)); + return (! exp.evaluate(c)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java index e8b7b6e0a..f7791db02 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/OrExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements an OR <i>Expression</i> for booleans. + * Implements an OR <i>Expression</i> for booleans. * This is a concrete boolean <i>NonterminalExpression</i> * * @author Jan Hannemann @@ -36,27 +36,27 @@ public class OrExpression implements BooleanExpression { /** * stores the first part of this OR <i>Expression</i> */ - + protected BooleanExpression expression1; /** * stores the second part of this OR <i>Expression</i> */ - protected BooleanExpression expression2; + protected BooleanExpression expression2; - /** + /** * Creates a new OR <i>Expression</i> with the given parts * * @param op1 the first <i>Expression</i> * @param op1 the second <i>Expression</i> - */ - + */ + public OrExpression(BooleanExpression op1, BooleanExpression op2) { this.expression1 = op1; this.expression2 = op2; } - + /** * Evaluates this <i>Expression</i> in the given <i>Context</i> * @@ -65,6 +65,6 @@ public class OrExpression implements BooleanExpression { */ public boolean evaluate(VariableContext c) { - return (expression1.evaluate(c) || expression2.evaluate(c)); + return (expression1.evaluate(c) || expression2.evaluate(c)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java index 51c2a3f54..ed4e80c87 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableContext.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -68,4 +68,4 @@ public class VariableContext { public void assign(VariableExpression varExp, boolean bool) { assignments.put(varExp.getName(), new Boolean(bool)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java index 48668bb6b..36c622b5d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/aspectj/VariableExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a variable expression for booleans. This is a concrete + * Implements a variable expression for booleans. This is a concrete * boolean <i>NonterminalExpression</i> * expression * @@ -33,29 +33,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.aspectj; */ public class VariableExpression implements BooleanExpression { - - /** + + /** * the name of the variable this object represents */ - - protected String name = null; - + + protected String name = null; + /** - * Creates a new variable <i>Expression</i> with a given name + * Creates a new variable <i>Expression</i> with a given name * - * @param name the name of the new variable + * @param name the name of the new variable */ public VariableExpression(String name) { this.name = name; - } - + } + /** * Accessor for the variable's name * * @return the name of the variable */ - + public String getName() { return name; } @@ -70,4 +70,4 @@ public class VariableExpression implements BooleanExpression { public boolean evaluate(VariableContext c) { return c.lookup(name); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java index 89b5243e6..f39f00dec 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/AndExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements AND expressions for booleans. This is a concrete boolean + * Implements AND expressions for booleans. This is a concrete boolean * <i>NonterminalExpression</i> * * @author Jan Hannemann @@ -36,39 +36,39 @@ public class AndExpression implements BooleanExpression { /** * stores the first part of this AND <i>Expression</i> */ - + protected BooleanExpression expression1; /** * stores the second part of this AND <i>Expression</i> */ - protected BooleanExpression expression2; + protected BooleanExpression expression2; - /** + /** * Creates a new AND <i>Expression</i> with the given parts * * @param expression1 the first <i>Expression</i> * @param expression1 the second <i>Expression</i> - */ - + */ + public AndExpression(BooleanExpression op1, BooleanExpression op2) { this.expression1 = op1; this.expression2 = op2; } - + /** - * Evaluates this <i>Expression</i> in the given + * Evaluates this <i>Expression</i> in the given * <code>VariableContext</code> * * @param c the <i>Context</i> to evaluate the <i>Expression</i> in * @return the boolean value of this AND <i>Expression</i> */ - + public boolean evaluate(VariableContext c) { - return (expression1.evaluate(c) && expression2.evaluate(c)); + return (expression1.evaluate(c) && expression2.evaluate(c)); } - + /** * Replaces a variable with an <i>Expression</i> * @@ -80,14 +80,14 @@ public class AndExpression implements BooleanExpression { public BooleanExpression replace(String name, BooleanExpression exp) { return new AndExpression(expression1.replace(name, exp), expression2.replace(name,exp)); } - + /** * Copies this <i>Expression</i> * * @returns the copied <i>Expression</i> */ - + public BooleanExpression copy() { return new AndExpression(expression1.copy(), expression2.copy()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java index 8d6c13ab0..e5c60c52a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanConstant.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -30,20 +30,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * @version 1.1, 02/11/04 */ -public class BooleanConstant implements BooleanExpression { +public class BooleanConstant implements BooleanExpression { /** * the value of this constant */ - + protected boolean value; - /** - * Creates a new constant with the given value + /** + * Creates a new constant with the given value * * @param value the value this constant should represent - */ - + */ + public BooleanConstant(boolean value) { this.value = value; } @@ -58,27 +58,27 @@ public class BooleanConstant implements BooleanExpression { public boolean evaluate(VariableContext c) { return value; } - + /** - * Replaces a variable with an <i>Expression</i>. + * Replaces a variable with an <i>Expression</i>. * Has no effect on constants. * * @param name the name of the variable * @param exp the <i>Expression</i> to replace the variable * @return the unchanged constant */ - + public BooleanExpression replace(String name, BooleanExpression exp) { - return this; + return this; } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression copy() { return new BooleanConstant(value); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java index 502be4c75..7ccc2752d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/BooleanExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -31,14 +31,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; */ public interface BooleanExpression { - + /** * Evaluates this <i>Expression</i> in the given <i>VariableContext</i> * * @param c the <i>Context</i> to evaluate the <i>Expression</i> in * @return the boolean value of the <i>Expression</i> */ - + public boolean evaluate(VariableContext c); /** @@ -48,7 +48,7 @@ public interface BooleanExpression { * @param exp the <i>Expression</i> to replace the variable * @return a copy of this <i>Expression</i> with the variable replaced */ - + public BooleanExpression replace(String name, BooleanExpression exp); /** @@ -56,6 +56,6 @@ public interface BooleanExpression { * * @return the copied <i>Expression</i> */ - + public BooleanExpression copy(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java index faeeb984c..b69729553 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/ExpressionException.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -32,14 +32,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; */ public class ExpressionException extends RuntimeException { - + /** * Creates a new ExpressionException with the given message * * @param s the exception message */ - + public ExpressionException(String s) { super(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java index 5cc790967..8daeac1ec 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,47 +15,47 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Intepreter design pattern example.<p> + * Implements the driver for the Intepreter design pattern example.<p> * * Intent: <i>Given a language, define a representation for its grammar along * with an interpreter that uses the representation to interpret sentences * in the language.</i><p> * - * Participating objects are: <code>BooleanContant</code> as - * <i>TerminalExpression</i>; <code>VariableExpression</code>, - * <code>OrExpression</code>, <code>AndExpression</code>, and - * <code>NotExpression</code> as <i>NonterminalExpressions</i>. - * - * The <i>AbstractExpression</i> interface is defined + * Participating objects are: <code>BooleanContant</code> as + * <i>TerminalExpression</i>; <code>VariableExpression</code>, + * <code>OrExpression</code>, <code>AndExpression</code>, and + * <code>NotExpression</code> as <i>NonterminalExpressions</i>. + * + * The <i>AbstractExpression</i> interface is defined * in <code>BooelanExp</i>.<p> * - * This example implements an interpreter for a language of boolean + * This example implements an interpreter for a language of boolean * expressions. As a sample expression, "((true & x) | (y & !x))" is - * interpreted for all possible boolean values for x and y. After that, + * interpreted for all possible boolean values for x and y. After that, * y is replaced by another expression and the whole expression is - * evaluated again. + * evaluated again. * * <p><i>This is the Java version.</i><p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 - * + * * @see BooleanExpression */ -public class Main { - - /** - * Assigns boolean values to two <code>VariableExpression</code>s +public class Main { + + /** + * Assigns boolean values to two <code>VariableExpression</code>s * and evaluates an expression in the given context. * * @param x a boolean variable expression @@ -66,12 +66,12 @@ public class Main { * @param exp the expression to evaluate */ - private static void assignAndEvaluate( - VariableExpression x, + private static void assignAndEvaluate( + VariableExpression x, boolean xValue, - VariableExpression y, + VariableExpression y, boolean yValue, - VariableContext context, + VariableContext context, BooleanExpression exp) { context.assign(x, xValue); context.assign(y, yValue); @@ -80,7 +80,7 @@ public class Main { } /** - * Implements the driver for the Intepreter design pattern example.<p> + * Implements the driver for the Intepreter design pattern example.<p> * * @param command-line parameters, unused. */ @@ -88,23 +88,23 @@ public class Main { public static void main(String[] args) { BooleanExpression exp = null; VariableContext context = new VariableContext(); - + VariableExpression x = new VariableExpression("X"); - VariableExpression y = new VariableExpression("Y"); - - exp = new OrExpression(new AndExpression(new BooleanConstant(true), x), + VariableExpression y = new VariableExpression("Y"); + + exp = new OrExpression(new AndExpression(new BooleanConstant(true), x), new AndExpression(y, new NotExpression(x))); - - System.out.println("Testing Expression: ((true & x) | (y & !x))"); + + System.out.println("Testing Expression: ((true & x) | (y & !x))"); assignAndEvaluate(x, false, y, false, context, exp); assignAndEvaluate(x, false, y, true, context, exp); assignAndEvaluate(x, true, y, false, context, exp); assignAndEvaluate(x, true, y, true, context, exp); - + VariableExpression z = new VariableExpression("Z"); NotExpression notZ = new NotExpression(z); - + BooleanExpression replacement = exp.replace("Y", notZ); context.assign(z, false); boolean result = replacement.evaluate(context); @@ -112,4 +112,3 @@ public class Main { System.out.println("The result for the replacement is: "+result); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java index 298d4e2ee..ac09825e9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/NotExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -82,4 +82,4 @@ public class NotExpression implements BooleanExpression { public BooleanExpression copy() { return new NotExpression(exp.copy()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java index c2a3f2485..0da3745e6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/OrExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -89,4 +89,4 @@ public class OrExpression implements BooleanExpression { public BooleanExpression copy() { return new OrExpression(expression1.copy(), expression2.copy()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java index c9f59d0e4..20e8d2f75 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableContext.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Hashtable; /** - * Implements a <i>Context</i> for the interpretation of boolean + * Implements a <i>Context</i> for the interpretation of boolean * expressions<p> * * @author Jan Hannemann @@ -33,8 +33,8 @@ import java.util.Hashtable; * @version 1.1, 02/11/04 */ -public class VariableContext { - +public class VariableContext { + /** * stores the mapping between variable names and values */ @@ -47,23 +47,23 @@ public class VariableContext { * @param name the name of the variable * @return the value of the variable */ - + public boolean lookup(String name) { Boolean value = (Boolean) assignments.get(name); if (value == null) { throw new ExpressionException("No variable \""+name+"\" known."); } return value.booleanValue(); - } - + } + /** * Assigns a boolean value to a <code>VariableExpression</code> * * @param varExp the varaible <i>Expression</i> to assign a value to - * @param bool the boolean value to assign + * @param bool the boolean value to assign */ - + public void assign(VariableExpression varExp, boolean bool) { assignments.put(varExp.getName(), new Boolean(bool)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java index caa429898..bbdffdfc4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/interpreter/java/VariableExpression.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a variable expression for booleans. This is a concrete + * Implements a variable expression for booleans. This is a concrete * boolean <i>NonterminalExpression</i> * expression * @@ -33,29 +33,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.interpreter.java; */ public class VariableExpression implements BooleanExpression { - - /** + + /** * the name of the variable this object represents */ - - protected String name = null; - + + protected String name = null; + /** - * Creates a new <code>VariableExpression</code> with the given name + * Creates a new <code>VariableExpression</code> with the given name * - * @param name the name of the new variable + * @param name the name of the new variable */ public VariableExpression(String name) { this.name = name; - } - + } + /** * Accessor for the variable's name * * @return the name of the variable */ - + public String getName() { return name; } @@ -70,7 +70,7 @@ public class VariableExpression implements BooleanExpression { public boolean evaluate(VariableContext c) { return c.lookup(name); } - + /** * Replaces a variable with an <i>Expression</i> * @@ -86,14 +86,14 @@ public class VariableExpression implements BooleanExpression { return new VariableExpression(this.name); } } - + /** * Copies this <i>Expression</i> * * @return the copied <i>Expression</i> */ - + public BooleanExpression copy() { return new VariableExpression(name); - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java index 5afe1bc77..6d7ceb34b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Iterator; - + /** - * Implements the driver for the Iterator design pattern example.<p> + * Implements the driver for the Iterator design pattern example.<p> * * Intent: <i>Provide a way to access the elements of an aggregate object * sequentially without exposing its underlying representation.</i><p> @@ -35,8 +35,8 @@ import java.util.Iterator; * java.util.Iterator</code> as <i>Iterator</i>, and <code>ReverseIterator * </code> as <i>ConcreteIterator</i>. * - * In this example, the concrete aggregate is a list that gets filled with - * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is + * In this example, the concrete aggregate is a list that gets filled with + * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is * created and used to print all elements in reverse order. * * <p><i>This is the AspectJ version.</i><p> @@ -45,7 +45,7 @@ import java.util.Iterator; * @author Gregor Kiczales * @version 1.1, 02/12/04 * - * @see SimpleList + * @see SimpleList * @see OpenList * @see java.util.Iterator * @see OpenListIteration @@ -53,46 +53,46 @@ import java.util.Iterator; public class Main { - + /** * Prints all elements in the iterator to <code>System.out</code>. * * @param iter the iterator which elements are to be printed - */ - - private static void print(Iterator iter) { + */ + + private static void print(Iterator iter) { while(iter.hasNext()) { System.out.println(iter.next()); } } - + /** - * Implements the driver for the Iterator design pattern example.<p> + * Implements the driver for the Iterator design pattern example.<p> * - * In this example, the concrete aggregate is a list that gets filled with - * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is - * created and used to print all elements in reverse order. + * In this example, the concrete aggregate is a list that gets filled with + * five integer objects (1 to 5). The, the <code>ReverseIterator</code> is + * created and used to print all elements in reverse order. * * @param args command line paramters, unused */ - + public static void main(String[] args) { - + OpenList openList = new OpenList(); openList.append(new Integer(1)); - openList.append(new Integer(2)); + openList.append(new Integer(2)); openList.append(new Integer(3)); openList.append(new Integer(4)); - openList.append(new Integer(5)); - + openList.append(new Integer(5)); + System.out.println("List created, containing int objects 1, 2, 3, 4, 5."); - + Iterator iter = OpenListIteration.aspectOf().createIteratorFor(openList); - + System.out.println("Using ReverseIterator to print list elements in reverse order..."); print(iter); System.out.println("done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java index 7eb5d04a1..f3351b060 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenList.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Iterator; /** - * Implements a basic open list. This implementation is based on - * <code>java.util.LinkedList</code>. In essence, this class acts as an + * Implements a basic open list. This implementation is based on + * <code>java.util.LinkedList</code>. In essence, this class acts as an * adapter for the Java class. <p> * * In this version, it is no longer necessary to implement the factory @@ -38,51 +38,51 @@ import java.util.Iterator; */ public class OpenList implements SimpleList { - + java.util.LinkedList list = new java.util.LinkedList(); - - /** + + /** * Returns the number of elements in the list * * @return the number of elements in the list */ - + public int count() { return list.size(); } - + /** - * Appends an object to the list. Since this is an open list, inserting + * Appends an object to the list. Since this is an open list, inserting * elements is assumed to succeed. * * @param o the object to append * @return true if successful, false otherwise */ - + public boolean append(Object o) { list.addLast(o); return true; } - + /** * Removes an object from the list * * @param o the object to remove * @return true if successful, false otherwise */ - + public boolean remove(Object o) { - return list.remove(o); - } - + return list.remove(o); + } + /** * Returns an object from the list * * @param index the position of the object * @return the object at position index */ - + public Object get(int index) { return list.get(index); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java index 0fc2b1724..9b4a76ad1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/OpenListIteration.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.NoSuchElementException; @@ -34,12 +34,12 @@ import java.util.Iterator; * @author Gregor Kiczales * @version 1.1, 02/12/04 * - * @see SimpleList + * @see SimpleList * @see OpenList */ -public aspect OpenListIteration { - +public aspect OpenListIteration { + /** * Implements the factory method to create the reverse iterator for the * OpenList class using the open classes mechanism. @@ -63,68 +63,67 @@ public aspect OpenListIteration { /** * Provides the implementation of the reverse iterator. Instead - * of defining an inner class, one could also instantiate + * of defining an inner class, one could also instantiate * <code>java.util.Iterator</code> as an anonymous class and overwrite * the appropriate methods. */ static class ReverseIterator implements Iterator { - + /** * the positition of the current element */ - - protected int current; - + + protected int current; + /** * the list this iterator operates on */ - - protected SimpleList list; - + + protected SimpleList list; + /** * Returns true if the iteration has more elements. * * @return true if the iteration has more elements */ - + public boolean hasNext() { return (current > 0); } - + /** * This opional method is not implemented for this iterator. - */ - + */ + public void remove() { throw new UnsupportedOperationException("remove() not supported"); - } - + } + /** * Returns the next element in the iteration. * - * @return the next element in the iteration. + * @return the next element in the iteration. */ - + public Object next() { if (!hasNext()) { - throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds"); + throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds"); } else { return list.get(--current); } } - + /** * Creates a new ReverseIterator from the given list. * * @param list the list to generate an iterator from */ - + public ReverseIterator(SimpleList list) { - super(); + super(); this.list = list; current = list.count(); } } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java index c8b7384c8..6b212d4fe 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/aspectj/SimpleList.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,40 +15,40 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines an interface for a basic list. + * Defines an interface for a basic list. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 - * + * * @see OpenList */ -public interface SimpleList { - - /** +public interface SimpleList { + + /** * Returns the number of elements in the list * * @return the number of elements in the list */ - - public int count(); - + + public int count(); + /** * Appends an object to the list * * @param o the object to append * @return true if successful, false otherwise */ - + public boolean append(Object o); /** @@ -57,8 +57,8 @@ public interface SimpleList { * @param o the object to remove * @return true if successful, false otherwise */ - - public boolean remove(Object o); + + public boolean remove(Object o); /** * Returns an object from the list @@ -66,7 +66,6 @@ public interface SimpleList { * @param index the position of the object * @return the object at position index */ - + public Object get(int index); -} -
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java index 03d378c91..84ccde10c 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -94,4 +94,4 @@ public class Main { System.out.println("done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java index 31fcf7b6d..a3457d36e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/OpenList.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; +package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Iterator; /** - * Implements a basic open list. This implementation is based on - * <code>java.util.LinkedList</code>. In essence, this class acts as an + * Implements a basic open list. This implementation is based on + * <code>java.util.LinkedList</code>. In essence, this class acts as an * adapter for the Java class. * * @author Jan Hannemann @@ -35,61 +35,61 @@ import java.util.Iterator; */ public class OpenList implements SimpleList { - + java.util.LinkedList list = new java.util.LinkedList(); - - /** + + /** * Returns the number of elements in the list * * @return the number of elements in the list */ - + public int count() { return list.size(); } - + /** - * Appends an object to the list. Since this is an open list, inserting + * Appends an object to the list. Since this is an open list, inserting * elements is assumed to succeed. * * @param o the object to append * @return true if successful, false otherwise */ - + public boolean append(Object o) { list.addLast(o); return true; } - + /** * Removes an object from the list * * @param o the object to remove * @return true if successful, false otherwise */ - + public boolean remove(Object o) { - return list.remove(o); - } - + return list.remove(o); + } + /** * Returns an object from the list * * @param index the position of the object - * @return the object at the specified index + * @return the object at the specified index */ - + public Object get(int index) { return list.get(index); } - + /** - * Returns a reverse iterator for this list. + * Returns a reverse iterator for this list. * * @return the a reverse iterator for this list */ - + public Iterator createReverseIterator() { return new ReverseIterator(this); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java index 160f8c77b..34708a4a0 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/ReverseIterator.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; +package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,19 +15,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Iterator; /** - * Implements a reverse iterator. This means that it will return elements in - * reverse order. We chose not to define our own <i>Iterator</i>, but to use - * Java's <code>java.util.Iterator</code> interface. + * Implements a reverse iterator. This means that it will return elements in + * reverse order. We chose not to define our own <i>Iterator</i>, but to use + * Java's <code>java.util.Iterator</code> interface. * * @author Jan Hannemann * @author Gregor Kiczales @@ -35,60 +35,60 @@ import java.util.Iterator; */ public class ReverseIterator implements Iterator { - + /** * the positition of the current element */ - protected int current; - + protected int current; + /** * the list this iterator operates on */ - - protected SimpleList list; - + + protected SimpleList list; + /** * Returns true if the iteration has more elements. * * @return true if the iteration has more elements */ - + public boolean hasNext() { return (current > 0); } - + /** * This opional method is not implemented for this iterator. - */ - + */ + public void remove() { throw new UnsupportedOperationException("remove() not supported"); - } - + } + /** * Returns the next element in the iteration. * - * @return the next element in the iteration. + * @return the next element in the iteration. */ public Object next() { if (!hasNext()) { - throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds"); + throw new ArrayIndexOutOfBoundsException("Iterator out of Bounds"); } else { return list.get(--current); } } - + /** * Creates a new ReverseIterator from the given list. * * @param list the list to generate an iterator from */ - + public ReverseIterator(SimpleList list) { - super(); + super(); this.list = list; current = list.count(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java index 9fa573282..d28f1f622 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/iterator/java/SimpleList.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,40 +15,40 @@ package ca.ubc.cs.spl.aspectPatterns.examples.iterator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines an interface for a basic list. + * Defines an interface for a basic list. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 - * + * * @see OpenList */ -public interface SimpleList { - - /** +public interface SimpleList { + + /** * Returns the number of elements in the list * * @return the number of elements in the list */ - - public int count(); - + + public int count(); + /** * Appends an object to the list * * @param o the object to append * @return true if successful, false otherwise */ - + public boolean append(Object o); /** @@ -57,8 +57,8 @@ public interface SimpleList { * @param o the object to remove * @return true if successful, false otherwise */ - - public boolean remove(Object o); + + public boolean remove(Object o); /** * Returns an object from the list at a given index @@ -66,7 +66,6 @@ public interface SimpleList { * @param index the position of the object * @return the object at position index */ - + public Object get(int index); -} -
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java index 3ba0ee59f..d64908023 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; -/** - * Basically a <code>JButton</code> with an <code>ActionListener</code>. - * The listener calls <code>clicked()</code> when the button gets pressed. +/** + * Basically a <code>JButton</code> with an <code>ActionListener</code>. + * The listener calls <code>clicked()</code> when the button gets pressed. * * @author Jan Hannemann * @author Gregor Kiczales @@ -36,22 +36,22 @@ import java.awt.event.ActionEvent; */ public class Button extends JButton { - + /** * Creates a new <code>Button</code> object with the provided label. * - * @param name the label for the new <code>Button</code> object + * @param name the label for the new <code>Button</code> object */ - + public Button(String name) { super(name); this.setActionCommand(name); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - clicked(); + clicked(); } - }); + }); } - - public void clicked() {} -}
\ No newline at end of file + + public void clicked() {} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java index d19f6bef2..a63b3a88f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Label.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; -/** - * Basically a JLabel. Acts as <i>Mediator</i>. +/** + * Basically a JLabel. Acts as <i>Mediator</i>. * * @author Jan Hannemann * @author Gregor Kiczales @@ -33,14 +33,14 @@ import javax.swing.*; */ public class Label extends JLabel { - + /** * Creates a new <code>Label</code> object with the provided name. * - * @param s the tag for the new <code>Label</code> object + * @param s the tag for the new <code>Label</code> object */ - + public Label(String s) { super(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java index 605b6ed3f..68092abe7 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; import java.awt.event.*; /** - * Implements the driver for the mediator design pattern example.<p> + * Implements the driver for the mediator design pattern example.<p> * * Intent: <i>Define an object that encapsulates how a set of objects - * interact. Mediator promotes loose coupling by keeping objects from + * interact. Mediator promotes loose coupling by keeping objects from * referring to each other explicitly, and it lets you vary their interaction * independently.</i><p> * @@ -44,15 +44,15 @@ import java.awt.event.*; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 - * + * * @see Button * @see Label */ - + public class Main { - - static JFrame frame = new JFrame("Mediator Demo"); + + static JFrame frame = new JFrame("Mediator Demo"); static Button button1 = new Button("Button1"); static Button button2 = new Button("Button2"); static Label label = new Label ("Click a button!"); @@ -60,30 +60,30 @@ public class Main { /** * Implements the driver for the mediator example. It creates a small * GUI with a label and two buttons. The buttons are <i>Colleague</i>s, - * the label is the <i>Mediator</i>. + * the label is the <i>Mediator</i>. * * Each button click causes the mediator to update itself and the * calling button. - */ - + */ + public static void main(String[] args) {; - + frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); - + JPanel panel = new JPanel(); - + panel.add(label); panel.add(button1); - panel.add(button2); - + panel.add(button2); + frame.getContentPane().add(panel); frame.pack(); - frame.setVisible(true); - - MediatorImplementation.aspectOf().setMediator(button1, label); - MediatorImplementation.aspectOf().setMediator(button2, label); + frame.setVisible(true); + + MediatorImplementation.aspectOf().setMediator(button1, label); + MediatorImplementation.aspectOf().setMediator(button2, label); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java index 8a3a9e31b..f09a3e90f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/aspectj/MediatorImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,19 +15,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import ca.ubc.cs.spl.aspectPatterns.patternLibrary.MediatorProtocol; /** - * Concretizes the mediation relationship for <code>Button</code> - * (as <i>Colleague</i>) and <code>Label</code> (as <i>Mediator</i>). - * <code>Button</code> clicks trigger <code>Label</code> updates. + * Concretizes the mediation relationship for <code>Button</code> + * (as <i>Colleague</i>) and <code>Label</code> (as <i>Mediator</i>). + * <code>Button</code> clicks trigger <code>Label</code> updates. * * @author Jan Hannemann * @author Gregor Kiczales @@ -37,44 +37,44 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.MediatorProtocol; public aspect MediatorImplementation extends MediatorProtocol { /** - * Assings the <i>Colleague</i> role to the <code>Button</code> + * Assings the <i>Colleague</i> role to the <code>Button</code> * class. Roles are modeled as (empty) interfaces. */ - + declare parents: Button implements Colleague; /** - * Assings the <i>Mediator</i> role to the <code>Label</code> + * Assings the <i>Mediator</i> role to the <code>Label</code> * class. Roles are modeled as (empty) interfaces. */ declare parents: Label implements Mediator; /** - * Defines what changes on Colleagues cause their <i>Mediator</i> to be + * Defines what changes on Colleagues cause their <i>Mediator</i> to be * notified (here: Button clicks) * * @param cs the colleague on which the change occured */ - protected pointcut change(Colleague c): + protected pointcut change(Colleague c): (call(void Button.clicked()) && target(c)); /** * Defines how the <i>Mediator</i> is to be updated when a change - * to a <i>Colleague</i> occurs. Here, the label's text is set - * depending on which button was clicked. The appropriate button's label + * to a <i>Colleague</i> occurs. Here, the label's text is set + * depending on which button was clicked. The appropriate button's label * is also updated. * * @param c the colleague on which a change of interest occured - * @param m the mediator to be notifed of the change + * @param m the mediator to be notifed of the change */ protected void notifyMediator(Colleague c, Mediator m) { Button button = (Button) c; - Label label = (Label) m; + Label label = (Label) m; if (button == Main.button1) { - label.setText("Button1 clicked"); + label.setText("Button1 clicked"); } else if (button == Main.button2) { label.setText("Button2 clicked"); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java index 6c6854033..83f1b2566 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Button.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,57 +15,57 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; -/** - * Basically a <code>JButton</code> with an <code>ActionListener</code>. - * The listener calls <code>clicked()</code> when the button gets pressed. +/** + * Basically a <code>JButton</code> with an <code>ActionListener</code>. + * The listener calls <code>clicked()</code> when the button gets pressed. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 */ -public class Button extends JButton implements GUIColleague { - +public class Button extends JButton implements GUIColleague { + private GUIMediator mediator; - + /** * Creates a new <code>Button</code> object with the provided label. * - * @param name the label for the new <code>Button</code> object + * @param name the label for the new <code>Button</code> object */ - + public Button(String name) { super(name); this.setActionCommand(name); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - clicked(); + clicked(); } - }); + }); } - + public void clicked() { mediator.colleagueChanged(this); - } - + } + /** * Allows to set the <i>Mediator</i> for this <i>Colleague</i> * * @param mediator the new mediator */ - + public void setMediator(GUIMediator mediator) { this.mediator = mediator; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java index 69c281432..7202da1f0 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIColleague.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,30 +15,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * This interface is implemented by all types that the <i>Mediator</i> * interacts with. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 */ - + public interface GUIColleague { /** - * Defines the method signature for setting a <i>Colleague</i>'s + * Defines the method signature for setting a <i>Colleague</i>'s * <i>Mediator</i>. * * @param mediator the new mediator */ - + public void setMediator(GUIMediator mediator); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java index 61efcfc84..d253af74a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/GUIMediator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,31 +15,31 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * This is the <i>Mediator</i> interface. It defines a method for dealing - * with changes in <i>Colleague</i>s that require updates. + * with changes in <i>Colleague</i>s that require updates. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 */ - + public interface GUIMediator { - + /** - * Defines the method signature for notifying <i>Mediator</i>s of changes - * to <i>Colleague</i>s. This method is called by colleagues who + * Defines the method signature for notifying <i>Mediator</i>s of changes + * to <i>Colleague</i>s. This method is called by colleagues who * pass themselves as an argument (push model). * * @param colleague the changing colleage */ - + public void colleagueChanged(GUIColleague colleague); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java index 2146ff340..1e80e107d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Label.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; -/** - * Basically a JLabel. Acts as <i>Mediator</i>. +/** + * Basically a JLabel. Acts as <i>Mediator</i>. * * @author Jan Hannemann * @author Gregor Kiczales @@ -33,31 +33,31 @@ import javax.swing.*; */ public class Label extends JLabel implements GUIMediator { - + /** * Creates a new <code>Label</code> object with the provided name. * - * @param s the tag for the new <code>Label</code> object + * @param s the tag for the new <code>Label</code> object */ - + public Label(String s) { super(s); } /** - * Handles the event that a <i>colleague</i> chanbged. + * Handles the event that a <i>colleague</i> chanbged. * - * @param colleague the <i>Colleague</i> that caused the notification + * @param colleague the <i>Colleague</i> that caused the notification */ - - public void colleagueChanged(GUIColleague colleague) { + + public void colleagueChanged(GUIColleague colleague) { Button button = (Button) colleague; - + if (button == Main.button1) { - this.setText("Button1 clicked"); + this.setText("Button1 clicked"); } else if (button == Main.button2) { this.setText("Button2 clicked"); } button.setText("(Done)"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java index 7fcf668f1..c2b7dcb74 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/mediator/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,21 +15,21 @@ package ca.ubc.cs.spl.aspectPatterns.examples.mediator.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import javax.swing.*; import java.awt.event.*; /** - * Implements the driver for the Mediator design pattern example.<p> + * Implements the driver for the Mediator design pattern example.<p> * * Intent: <i>Define an object that encapsulates how a set of objects - * interact. Mediator promotes loose coupling by keeping objects from + * interact. Mediator promotes loose coupling by keeping objects from * referring to each other explicitly, and it lets you vary their interaction * independently.</i><p> * @@ -37,10 +37,10 @@ import java.awt.event.*; * and a <code>Label</code> as <i>Mediator</i>. * * Every time an event of interest (a button click) occurs, the mediating - * <code>Label</code> is updated and it in turn updates the respective + * <code>Label</code> is updated and it in turn updates the respective * calling button. * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * * Both <i>Mediator</i> and <i>Colleague</i>s have to be aware of their role * within the pattern. @@ -48,15 +48,15 @@ import java.awt.event.*; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 - * + * * @see Button * @see Label */ - + public class Main { - - static JFrame frame = new JFrame("Mediator Demo"); + + static JFrame frame = new JFrame("Mediator Demo"); static Button button1 = new Button("Button1"); static Button button2 = new Button("Button2"); static Label label = new Label ("Click a button!"); @@ -64,30 +64,30 @@ public class Main { /** * Implements the driver for the mediator example. It creates a small * GUI with a label and two buttons. The buttons are <i>Colleague</i>s, - * the label is the <i>Mediator</i>. + * the label is the <i>Mediator</i>. * * Each button click causes the mediator to update itself and the * calling button. - */ - + */ + public static void main(String[] args) {; - + frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); - + JPanel panel = new JPanel(); - + panel.add(label); panel.add(button1); - panel.add(button2); - + panel.add(button2); + frame.getContentPane().add(panel); frame.pack(); - frame.setVisible(true); - - button1.setMediator(label); - button2.setMediator(label); + frame.setVisible(true); + + button1.setMediator(label); + button2.setMediator(label); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java index f3f395338..8bbc7a198 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Counter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a sample <i>Originator</i> class. Objects of this particular - * <i>Originator</i> have state, an int representing the number of time + * Implements a sample <i>Originator</i> class. Objects of this particular + * <i>Originator</i> have state, an int representing the number of time * the <code>increment()</code> method was called. * * @author Jan Hannemann @@ -33,26 +33,26 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; */ public class Counter { - + /** * the number of times <code>increment()</code> was called on this object */ protected int currentValue = 0; - + /** * increments the counter (this <i>Originator</i>'s state) by one */ - public void increment() { - currentValue++; + public void increment() { + currentValue++; } - + /** * Displays the state of this <i>Originator</i> */ - public void show() { - System.out.println("Originator value is " + currentValue); + public void show() { + System.out.println("Originator value is " + currentValue); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java index 48fd6aa3b..54efe9934 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/CounterMemento.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -89,4 +89,4 @@ public aspect CounterMemento extends MementoProtocol { throw new MementoException("Invalid originator"); } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java index ee2e2a85d..64baea31d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,19 +15,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento; +import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento; /** - * Implements the driver for the Memento design pattern example.<p> + * Implements the driver for the Memento design pattern example.<p> * - * Intent: <i>Without violating encapsulation, capture and externalize an + * Intent: <i>Without violating encapsulation, capture and externalize an * object's internal state so that the object can be restored to this state * later</i><p> * @@ -39,14 +39,14 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento; * are done, the <i>Memento</i> is used to restore the <i>Originator</i>'s * state. * - * <p><i>This is the AspectJ version.</i><p> + * <p><i>This is the AspectJ version.</i><p> * * Memento and Originator are decoupled. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 - * + * * @see StateMemento * @see MyOriginator */ @@ -54,32 +54,32 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Memento; public class Main { - + /** * This example changes the state of the <i>Originator</i> five times, but - * creates a <i>Memento</i> of it after the third change. After the 5 - * changes are done, the <i>Memento</i> is used to restore the - * <i>Originator</i>'s state. - * + * creates a <i>Memento</i> of it after the third change. After the 5 + * changes are done, the <i>Memento</i> is used to restore the + * <i>Originator</i>'s state. + * * @param args command line parameters, unused. */ - - public static void main(String[] args) { - - Memento storedState = null; - Counter counter = new Counter(); - + + public static void main(String[] args) { + + Memento storedState = null; + Counter counter = new Counter(); + for (int i=1; i<=5; i++) { counter.increment(); - counter.show(); - if (i==3) { - storedState = - CounterMemento.aspectOf().createMementoFor(counter); + counter.show(); + if (i==3) { + storedState = + CounterMemento.aspectOf().createMementoFor(counter); } } - + System.out.println("\nTrying to reinstate state (3)..."); CounterMemento.aspectOf().setMemento(counter, storedState); - counter.show(); + counter.show(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java index 83aca53fe..2a3d3a8aa 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Counter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a sample <i>Originator</i> class. Objects of this particular - * <i>Originator</i> have state, an int representing the number of time + * Implements a sample <i>Originator</i> class. Objects of this particular + * <i>Originator</i> have state, an int representing the number of time * the <code>increment()</code> method was called. * * @author Jan Hannemann @@ -33,46 +33,46 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; */ public class Counter { - + /** * the number of times <code>increment()</code> was called on this object */ protected int currentValue = 0; - + /** * increments the counter (this <i>Originator</i>'s state) by one */ - public void increment() { - currentValue++; + public void increment() { + currentValue++; } - + /** * Displays the state of this <i>Originator</i> */ - public void show() { - System.out.println("Originator value is " + currentValue); - } - + public void show() { + System.out.println("Originator value is " + currentValue); + } + /** - * Creates a <i>Memento</i> from this <i>Originator</i>, storing the + * Creates a <i>Memento</i> from this <i>Originator</i>, storing the * current state */ - public CounterMemento createMemento() { - return new CounterMemento(currentValue); + public CounterMemento createMemento() { + return new CounterMemento(currentValue); } - + /** - * Restores this <i>Originator</i> to former state stored by the + * Restores this <i>Originator</i> to former state stored by the * memento passed * * @param memento the <i>Memento</i> that stores the prior state */ - public void setMemento(CounterMemento memento) { - currentValue = memento.getState(); + public void setMemento(CounterMemento memento) { + currentValue = memento.getState(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java index f2b6dba23..2cedc373f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/CounterMemento.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -71,4 +71,4 @@ public class CounterMemento { public CounterMemento(int init) { state = init; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java index 0827c6972..02b131610 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/memento/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the memento design pattern example.<p> + * Implements the driver for the memento design pattern example.<p> * - * Intent: <i>Without violating encapsulation, capture and externalize an + * Intent: <i>Without violating encapsulation, capture and externalize an * object's internal state so that the object can be restored to this state * later</i><p> * @@ -37,7 +37,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; * are done, the <i>Memento</i> is used to restore the <i>Originator</i>'s * state. * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * * Memento and Originator are tightly coupled. * @@ -47,29 +47,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.memento.java; */ public class Main { - + /** * This example changes the state of the <i>Originator</i> five times, but - * creates a <i>Memento</i> of it after the third change. After the 5 - * changes are done, the <i>Memento</i> is used to restore the - * <i>Originator</i>'s state. + * creates a <i>Memento</i> of it after the third change. After the 5 + * changes are done, the <i>Memento</i> is used to restore the + * <i>Originator</i>'s state. */ - - public static void main(String[] args) { - + + public static void main(String[] args) { + CounterMemento storedState = null; - Counter counter = new Counter(); - + Counter counter = new Counter(); + for (int i=1; i<=5; i++) { counter.increment(); - counter.show(); - if (i==3) { - storedState = counter.createMemento(); + counter.show(); + if (i==3) { + storedState = counter.createMemento(); } } - + System.out.println("\nTrying to reinstate state (3)..."); counter.setMemento(storedState); - counter.show(); + counter.show(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java index 44af56c27..40c5bc137 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ColorObserver.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java index ea5c9635c..202d5dca6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/CoordinateObserver.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ObserverProtocol; /** - * Concretizes the observing relationship for <code>Point</code> (subject) - * and <code>Screen</code> (observer). Coordinate changes trigger updates. + * Concretizes the observing relationship for <code>Point</code> (subject) + * and <code>Screen</code> (observer). Coordinate changes trigger updates. * * @author Jan Hannemann * @author Gregor Kiczales @@ -40,33 +40,33 @@ public aspect CoordinateObserver extends ObserverProtocol{ * Assings the <i>Subject</i> role to the <code>Point</code> class. * Roles are modeled as (empty) interfaces. */ - + declare parents: Point implements Subject; /** * Assings the <i>Observer</i> role to the <code>Screen</code> class. * Roles are modeled as (empty) interfaces. */ - + declare parents: Screen implements Observer; /** * Specifies the join points that represent a change to the * <i>Subject</i>. Captures calls to <code>Point.setX(int) - * </code> and <code>Point.setY(int)</code>. + * </code> and <code>Point.setY(int)</code>. * @param subject the <code>Point</code> acting as <i>Subject</i> */ - protected pointcut subjectChange(Subject subject): + protected pointcut subjectChange(Subject subject): (call(void Point.setX(int)) || call(void Point.setY(int)) ) && target(subject); /** * Defines how <i>Observer</i>s are to be updated when a change - * to a <i>Subject</i> occurs. + * to a <i>Subject</i> occurs. * * @param subject the <i>Subject</i> on which a change of interest occured - * @param observer the <i>bserver</i> to be notifed of the change + * @param observer the <i>bserver</i> to be notifed of the change */ protected void updateObserver(Subject subject, Observer observer) { diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java index 1e57db172..8ddd2f478 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import java.awt.Color; +import java.awt.Color; /** * Implements the driver for the Observer design pattern example.<p> * * Intent: <i>Define a one-to-many dependency between objects so that when one - * object changes state, all its dependents are notified and updated + * object changes state, all its dependents are notified and updated * automatically</i><p> * * Participating objects are <code>Point</code> p and <code>Screen</code> @@ -39,7 +39,7 @@ import java.awt.Color; * </code> p. * <LI> <code>Screen</code> s3 and s4 observe coordinate changes of <code> * Point</code> p. - * <LI> <code>Screen</code> s5 observes the <code>display(String)</code> + * <LI> <code>Screen</code> s5 observes the <code>display(String)</code> * methods of <code>Screen</code> s2 and s4. * </UL> * @@ -52,61 +52,61 @@ import java.awt.Color; * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - -public class Main { - + +public class Main { + /** - * Implements the driver for the Observer example. It creates five + * Implements the driver for the Observer example. It creates five * <code>Screen</code> objects and one <code>Point</code> object - * and sets the appropriate observing relationships (see above). - * After the setup, the color of the point is changed, then it's + * and sets the appropriate observing relationships (see above). + * After the setup, the color of the point is changed, then it's * x-coordinate. <p> * The following results should be expected: <OL> - * <LI> The color change should trigger s1 and s2 to each print an + * <LI> The color change should trigger s1 and s2 to each print an * appropriate message. * <LI> s2's message should trigger it's observer s5 to print * a message. * <LI> The coordinate change should trigger s3 and s4. - * <LI> s4's message should trigger it's observer s5 again. + * <LI> s4's message should trigger it's observer s5 again. * </OL> - */ + */ public static void main(String argv[]) { - + Point p = new Point(5, 5, Color.blue); - + System.out.println("Creating Screen s1,s2,s3,s4,s5 and Point p"); - + Screen s1 = new Screen("s1"); Screen s2 = new Screen("s2"); - + Screen s3 = new Screen("s3"); Screen s4 = new Screen("s4"); - + Screen s5 = new Screen("s5"); - System.out.println("Creating observing relationships:"); - System.out.println("- s1 and s2 observe color changes to p"); + System.out.println("Creating observing relationships:"); + System.out.println("- s1 and s2 observe color changes to p"); System.out.println("- s3 and s4 observe coordinate changes to p"); System.out.println("- s5 observes s2's and s4's display() method"); - - ColorObserver.aspectOf().addObserver(p, s1); + + ColorObserver.aspectOf().addObserver(p, s1); ColorObserver.aspectOf().addObserver(p, s2); - - CoordinateObserver.aspectOf().addObserver(p, s3); + + CoordinateObserver.aspectOf().addObserver(p, s3); CoordinateObserver.aspectOf().addObserver(p, s4); - + ScreenObserver.aspectOf().addObserver(s2, s5); ScreenObserver.aspectOf().addObserver(s4, s5); - System.out.println("Changing p's color:"); + System.out.println("Changing p's color:"); p.setColor(Color.red); - System.out.println("Changing p's x-coordinate:"); + System.out.println("Changing p's x-coordinate:"); + + p.setX(4); - p.setX(4); - - System.out.println("done."); + System.out.println("done."); } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java index 0709e59e5..8240ddcf5 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Point.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.awt.Color; @@ -31,45 +31,45 @@ import java.awt.Color; * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - + public class Point { /** * the point's x-coordinate */ - + private int x; - + /** * the point's y-coordinate */ - + private int y; - - /** + + /** * the point's current color */ - + private Color color; - + /** * Creates a new point object based on x and y coordinates and color. */ - + public Point(int x, int y, Color color) { this.x=x; this.y=y; this.color=color; } - + /** * Returns the point's current x-coordinate. * * @return the current x-coordinate */ - public int getX() { - return x; + public int getX() { + return x; } /** @@ -78,18 +78,18 @@ public class Point { * @return the current y-coordinate */ - public int getY() { - return y; + public int getY() { + return y; } - + /** * Sets the current x-coordinate. * * @param x the new x-coordinate */ - public void setX(int x) { - this.x = x; + public void setX(int x) { + this.x = x; } /** @@ -98,7 +98,7 @@ public class Point { * @param y the new y-coordinate */ - public void setY(int y) { + public void setY(int y) { this.y = y; } @@ -108,8 +108,8 @@ public class Point { * @return the current color */ - public Color getColor() { - return color; + public Color getColor() { + return color; } /** @@ -118,7 +118,7 @@ public class Point { * @param color the new color */ - public void setColor(Color color) { - this.color=color; + public void setColor(Color color) { + this.color=color; } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java index 13c1bd9bc..5690ea3d9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/Screen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,48 +15,48 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - -/** + +/** * Provides a means to output messages. Objects of this class act as - * output devices. + * output devices. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - + public class Screen { - + /** * the individual name of this screen object */ private String name; - + /** * creates a new <code>Screen</code> object with the provided name. * - * @param name the name for the new <code>Screen</code> object + * @param name the name for the new <code>Screen</code> object */ - + public Screen(String s) { this.name = s; } /** - * Prints the name of the <code>Screen</code> object and the argument + * Prints the name of the <code>Screen</code> object and the argument * string to stdout. * * @param s the string to print */ - + public void display (String s) { System.out.println(name + ": " + s); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java index 1ee361928..c4d64a795 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/aspectj/ScreenObserver.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ObserverProtocol; /** - * Concretizes the observing relationship for <code>Screen</code> (subject) + * Concretizes the observing relationship for <code>Screen</code> (subject) * and <code>Screen</code> (observer). Calls of <code>Screen.display(String) * </code> trigger updates. * @@ -40,38 +40,37 @@ public aspect ScreenObserver extends ObserverProtocol{ * Assings the <i>Subject</i> role to the <code>Screen</code> class. * Roles are modeled as (empty) interfaces. */ - + declare parents: Screen implements Subject; /** * Assings the <i>Observer</i> role to the <code>Screen</code> class. * Roles are modeled as (empty) interfaces. */ - + declare parents: Screen implements Observer; /** * Specifies the join points that represent a change to the * <i>Subject</i>. Captures calls to <code>Screen.display(String) - * </code>. - * + * </code>. + * * @param subject the <code>Point</code> acting as <i>Subject</i> */ - protected pointcut subjectChange(Subject subject): + protected pointcut subjectChange(Subject subject): call(void Screen.display(String)) && target(subject); /** * Defines how <i>Observer</i>s are to be updated when a change - * to a <i>Subject</i> occurs. + * to a <i>Subject</i> occurs. * * @param subject the <i>Subject</i> on which a change of interest occured - * @param observer the <i>bserver</i> to be notifed of the change + * @param observer the <i>bserver</i> to be notifed of the change */ - + protected void updateObserver(Subject subject, Observer observer) { ((Screen)observer).display("Screen updated " + "(screen subject displayed message)."); - } + } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java index 21a7d58ff..1768d1d34 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeObserver.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Declares the method used to update <i>Observer<i>s. * @@ -29,15 +29,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - + public interface ChangeObserver { - + /** * Updates an <i>Observer</i>. Uses the <i>push</i> strategy (i.e. the * subject triggering the update passes itself as an argument). * * @param s the <i>Subject</i> triggering the update */ - + public void refresh(ChangeSubject s); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java index 221cb53a0..e28bef501 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/ChangeSubject.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,43 +15,43 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Declares methods to attach and detach <i>Observer<i>s to/from + * Declares methods to attach and detach <i>Observer<i>s to/from * <i>Subject</i>s, and the <code>notifyObservers()</code> method. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - + public interface ChangeSubject { - + /** * Attaches an <i>Observer</i> to this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to add */ - + public void addObserver(ChangeObserver o); /** * Detaches an <i>Observer</i> from this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to remove */ - + public void removeObserver(ChangeObserver o); /** * Notifies all <i>Observer</i>s. */ - + public void notifyObservers(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java index 8cfac7b4b..8e1df22dd 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,20 +15,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import java.awt.Color; +import java.awt.Color; /** * Implements the driver for the Observer design pattern example.<p> * * Intent: <i>Define a one-to-many dependency between objects so that when one - * object changes state, all its dependents are notified and updated + * object changes state, all its dependents are notified and updated * automatically</i><p> * * Participating objects are <code>Point</code> p and <code>Screen</code> @@ -39,18 +39,18 @@ import java.awt.Color; * </code> p. * <LI> <code>Screen</code> s3 and s4 observe coordinate changes of <code> * Point</code> p. - * <LI> <code>Screen</code> s5 observes the <code>display(String)</code> + * <LI> <code>Screen</code> s5 observes the <code>display(String)</code> * methods of <code>Screen</code> s2 and s4. * </UL> * * Every time an event of interest occurs, the observing <code>Screen</code> * prints an appropriate message to stdout. <p> * - * <p>This is the Java version.</i><p> + * <p>This is the Java version.</i><p> * * The example illustrates that it is hard to * cleanly modularize the different observing relationships. The following - * implementation issues have to be considered for the Java version: + * implementation issues have to be considered for the Java version: * <UL> * <LI> Observer and Subject can only be interfaces (as opposed to abstract * classes) if we do not want to restrict inhertance and thus code @@ -58,79 +58,79 @@ import java.awt.Color; * <LI> As interfaces, we cannot attach default implementations for methods * like <i>attach(Observer)</i>, <i>notify()</i>, etc. Note that * these two problems only apply because Java does not offer multiple - * inheritance. + * inheritance. * <LI> Some implementation constraints are made implicit and are thus not - * enforced: I.e., each <i>Subject</i> needs a field to store its + * enforced: I.e., each <i>Subject</i> needs a field to store its * <i>Observer</i>s - * <LI> The classes that become <i>Subject</i> and <i>Observer</i> in the - * pattern context need to be modified. In particular, <i>Subject</i>s - * need to store the mapping, implement the appropriate procedures. + * <LI> The classes that become <i>Subject</i> and <i>Observer</i> in the + * pattern context need to be modified. In particular, <i>Subject</i>s + * need to store the mapping, implement the appropriate procedures. * <i>Observer</i>s need to * implement <i>update()</i> * <LI> If a particular class takes part in more than one observing * relationship (as in this example), it is difficult to have both - * notify/update mechanisms go through the same interface and yet - * separate them cleanly. + * notify/update mechanisms go through the same interface and yet + * separate them cleanly. * </UL> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - -public class Main { - + +public class Main { + /** - * Implements the driver for the Observer example. It creates five + * Implements the driver for the Observer example. It creates five * <code>Screen</code> objects and one <code>Point</code> object - * and sets the appropriate observing relationships (see above). - * After the setup, the color of the point is changed, then it's + * and sets the appropriate observing relationships (see above). + * After the setup, the color of the point is changed, then it's * x-coordinate. <p> * The following results should be expected: <OL> - * <LI> The color change should trigger s1 and s2 to each print an + * <LI> The color change should trigger s1 and s2 to each print an * appropriate message. * <LI> s2's message should trigger it's observer s5 to print * a message. * <LI> The coordinate change should trigger s3 and s4. * <LI> s4's message should trigger it's observer s5 again. - */ + */ public static void main(String argv[]) { - + Point p = new Point(5, 5, Color.blue); - + System.out.println("Creating Screen s1,s2,s3,s4,s5 and Point p"); - + Screen s1 = new Screen("s1"); Screen s2 = new Screen("s2"); - + Screen s3 = new Screen("s3"); Screen s4 = new Screen("s4"); - + Screen s5 = new Screen("s5"); - System.out.println("Creating observing relationships:"); - System.out.println("- s1 and s2 observe color changes to p"); + System.out.println("Creating observing relationships:"); + System.out.println("- s1 and s2 observe color changes to p"); System.out.println("- s3 and s4 observe coordinate changes to p"); System.out.println("- s5 observes s2's and s4's display() method"); - - p.addObserver(s1); + + p.addObserver(s1); p.addObserver(s2); - - p.addObserver(s3); + + p.addObserver(s3); p.addObserver(s4); - + s2.addObserver(s5); s4.addObserver(s5); - - System.out.println("Changing p's color:"); + + System.out.println("Changing p's color:"); p.setColor(Color.red); - System.out.println("Changing p's x-coordinate:"); + System.out.println("Changing p's x-coordinate:"); + + p.setX(4); - p.setX(4); - - System.out.println("done."); + System.out.println("done."); } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java index 2a4322bb3..5413c80df 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Point.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,14 +15,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import java.awt.Color; +import java.awt.Color; import java.util.HashSet; import java.util.Iterator; @@ -33,52 +33,52 @@ import java.util.Iterator; * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - -public class Point implements ChangeSubject { - + +public class Point implements ChangeSubject { + /** * stores the <i>Observer</i>s for this point (<i>Subject</i>) */ - + private HashSet observers; /** * the point's x-coordinate */ - + private int x; - + /** * the point's y-coordinate */ - + private int y; - - /** + + /** * the point's current color */ - + private Color color; - + /** * Creates a new point object based on x and y coordinates and color. */ - + public Point(int x, int y, Color color) { this.x = x; this.y = y; - this.color=color; + this.color=color; this.observers = new HashSet(); } - + /** * Returns the point's current x-coordinate. * * @return the current x-coordinate */ - public int getX() { - return x; + public int getX() { + return x; } /** @@ -87,18 +87,18 @@ public class Point implements ChangeSubject { * @return the current y-coordinate */ - public int getY() { - return y; + public int getY() { + return y; } - + /** * Sets the current x-coordinate. * * @param x the new x-coordinate */ - public void setX(int x) { - this.x = x; + public void setX(int x) { + this.x = x; notifyObservers(); } @@ -108,8 +108,8 @@ public class Point implements ChangeSubject { * @param y the new y-coordinate */ - public void setY(int y) { - this.y = y; + public void setY(int y) { + this.y = y; notifyObservers(); } @@ -127,36 +127,36 @@ public class Point implements ChangeSubject { * @param color the new color */ - public void setColor(Color color) { - this.color = color; + public void setColor(Color color) { + this.color = color; notifyObservers(); - } - - + } + + /** * Attaches an <i>Observer</i> to this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to attach */ - + public void addObserver(ChangeObserver o) { this.observers.add(o); } - + /** * Detaches an <i>Observer</i> from this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to detach */ - + public void removeObserver(ChangeObserver o) { this.observers.remove(o); } - + /** * Notifies all <i>Observer</i>s. */ - + public void notifyObservers() { for (Iterator e = observers.iterator() ; e.hasNext() ;) { ((ChangeObserver)e.next()).refresh(this); diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java index 1860b477b..85442a0bb 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/observer/java/Screen.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,88 +15,88 @@ package ca.ubc.cs.spl.aspectPatterns.examples.observer.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.HashSet; import java.util.Iterator; - -/** + +/** * Provides a means to output messages. Objects of this class act as - * output devices. + * output devices. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.11, 04/01/04 */ - + public class Screen implements ChangeSubject, ChangeObserver { /** * stores the <i>Observer</i>s for this screen (<i>Subject</i>) */ - + private HashSet observers; - + /** * the individual name of this screen object */ private String name; - + /** * creates a new <code>Screen</code> object with the provided name. * - * @param name the name for the new <code>Screen</code> object + * @param name the name for the new <code>Screen</code> object */ - + public Screen(String s) { - this.name = s; + this.name = s; observers = new HashSet(); } /** - * Prints the name of the <code>Screen</code> object and the argument + * Prints the name of the <code>Screen</code> object and the argument * string to stdout. * * @param s the string to print */ - + public void display (String s) { System.out.println(name + ": " + s); notifyObservers(); - } + } /** * Attaches an <i>Observer</i> to this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to attach */ public void addObserver(ChangeObserver o) { this.observers.add(o); } - + /** * Detaches an <i>Observer</i> from this <i>Subject</i>. - * + * * @param o the <i>Observer</i> to detach */ public void removeObserver(ChangeObserver o) { this.observers.remove(o); } - + /** * Notifies all <i>Observer</i>s. */ - + public void notifyObservers() { for (Iterator e = observers.iterator() ; e.hasNext() ;) { ((ChangeObserver)e.next()).refresh(this); @@ -106,18 +106,18 @@ public class Screen implements ChangeSubject, ChangeObserver { /** * Updates an <i>Observer</i>. Uses the <i>push</i> strategy (i.e. the * subject triggering the update passes itself as an argument). - * + * * This particular method prints a message showing what object caused - * the update + * the update * * @param s the <i>Subject</i> triggering the update */ - public void refresh(ChangeSubject s) { + public void refresh(ChangeSubject s) { String subjectTypeName = s.getClass().getName(); subjectTypeName = subjectTypeName.substring( subjectTypeName.lastIndexOf(".")+1, subjectTypeName.length()); display("update received from a "+subjectTypeName+" object"); } - + } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java index 81c4584a9..0b236da02 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,91 +15,91 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Prototype design pattern example.<p> + * Implements the driver for the Prototype design pattern example.<p> * - * Intent: <i>Specify the kinds of objects to create using a prototypical + * Intent: <i>Specify the kinds of objects to create using a prototypical * instance, and create new objects by copying this prototype.</i><p> * - * Participatng objects are <code>StringPrototypeA</code> and + * Participatng objects are <code>StringPrototypeA</code> and * <code>StringPrototypeB</code> as <i>Prototype</i>s.<p> * * In this example, both StringPrototypeA and StringPrototypeB implement cloneable - * classes emulating limited String behavior. This driver creates an + * classes emulating limited String behavior. This driver creates an * object of each class and clones it. Both originals and clones are - * manipulated to show that they are different objects. + * manipulated to show that they are different objects. * - * <p><i>This is the AspectJ version.</i><p> + * <p><i>This is the AspectJ version.</i><p> * * Java's <code>Cloneable</code> interface is used internally. In this * version, a standard implementation for <code>createClone()</code> is * provided by the abstract pattern aspect. Each concrete pattern instance - * aspect can define special behavior by overwriting the appropriate + * aspect can define special behavior by overwriting the appropriate * methods. Consequently, the participants are freed of the pattern. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - * + * * @see StringPrototypeA * @see StringPrototypeB - */ + */ public class Main { /** - * Implements the driver for the Prototype design pattern example.<p> + * Implements the driver for the Prototype design pattern example.<p> * * In this example, both StringPrototypeA and StringPrototypeB implement cloneable - * classes emulating limited String behavior. This driver creates an + * classes emulating limited String behavior. This driver creates an * object of each class and clones it. Both originals and clones are - * manipulated to show that they are different objects. + * manipulated to show that they are different objects. * * @param args the command line parameters, unused. */ public static void main(String[] args) { - + System.out.println("Testing the Prototype design pattern implementation..."); - + StringPrototypeA originalA; StringPrototypeB originalB; StringPrototypeA copyA1, copyA2; StringPrototypeB copyB1; - + originalA = new StringPrototypeA(" This is Prototype 1"); - originalB = new StringPrototypeB(" This is Prototype 2"); - + originalB = new StringPrototypeB(" This is Prototype 2"); + System.out.println("These are the two prototypes:"); System.out.println(originalA); System.out.println(originalB); - + copyA1 = (StringPrototypeA) StringPrototypes.aspectOf().cloneObject(originalA); copyB1 = (StringPrototypeB) StringPrototypes.aspectOf().cloneObject(originalB); - + System.out.println("These are copies of the prototypes:"); System.out.println(copyA1); System.out.println(copyB1); - + System.out.println("Now prototype 1 is changed. Here are prototype 1 and its former copy:"); originalA.setText(" This is Prototype 1 (changed)"); System.out.println(originalA); System.out.println(copyA1); - + System.out.println("This is a clone of the changed prototype 1 and a changed copy of prototype 2:"); copyA2 = (StringPrototypeA) StringPrototypes.aspectOf().cloneObject(originalA); copyB1.setText(" This is a changed copy of prototype 2"); System.out.println(copyA2); System.out.println(copyB1); - - - System.out.println("... done."); + + + System.out.println("... done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java index a0ac669f1..9aa1acf85 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeA.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -71,4 +71,3 @@ public class StringPrototypeA implements Cloneable { return "MyString: "+ text; } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java index 600d0b901..374dcbe3e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypeB.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -70,4 +70,4 @@ public class StringPrototypeB implements Cloneable { public String toString() { return "AnotherString: " + text; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java index 00bbe30f4..9de544be2 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/aspectj/StringPrototypes.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,29 +15,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.PrototypeProtocol; /** - * Concretizes the abstract Prototype design pattern. + * Concretizes the abstract Prototype design pattern. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - */ - -public aspect StringPrototypes extends PrototypeProtocol { + */ + +public aspect StringPrototypes extends PrototypeProtocol { /** * Assigns the <i>Prototype</i> role to </code>StringPrototypeA</code> */ - + declare parents: StringPrototypeA implements Prototype; /** @@ -49,7 +49,7 @@ public aspect StringPrototypes extends PrototypeProtocol { /** * Provides an alternative method for cases when the default * <code>clone()</code> method fails: Clones objects "by hand". - * + * * @param object the prototype object to clone * @return a copy of the object */ @@ -60,6 +60,6 @@ public aspect StringPrototypes extends PrototypeProtocol { } else { return null; } - } + } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java index 3552ac567..7f60e0c48 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,94 +15,94 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Prototype design pattern example.<p> + * Implements the driver for the Prototype design pattern example.<p> * - * Intent: <i>Specify the kinds of objects to create using a prototypical + * Intent: <i>Specify the kinds of objects to create using a prototypical * instance, and create new objects by copying this prototype.</i><p> * - * Participating objects are <code>StringPrototypeA</code> and + * Participating objects are <code>StringPrototypeA</code> and * <code>StringPrototypeB</code> as <i>Prototype</i>s.<p> * - * In this example, both StringPrototypeA and StringPrototypeB - * implement cloneable classes emulating limited String behavior. - * This driver creates an object of each class and clones it. - * Both originals and clones are manipulated to show that they are - * different objects. + * In this example, both StringPrototypeA and StringPrototypeB + * implement cloneable classes emulating limited String behavior. + * This driver creates an object of each class and clones it. + * Both originals and clones are manipulated to show that they are + * different objects. * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * * Java's <code>Cloneable</code> interface is used. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - * + * * @see StringPrototypeA * @see StringPrototypeB - */ - + */ + public class Main { /** - * Implements the driver for the Prototype design pattern example.<p> + * Implements the driver for the Prototype design pattern example.<p> * * In this example, both StringPrototypeA and StringPrototypeB implement cloneable - * classes emulating limited String behavior. This driver creates an + * classes emulating limited String behavior. This driver creates an * object of each class and clones it. Both originals and clones are - * manipulated to show that they are different objects. + * manipulated to show that they are different objects. * * @param args the command line parameters, unused. - */ + */ public static void main(String[] args) { - + try { - + System.out.println("Testing the Prototype design pattern implementation..."); - + StringPrototypeA originalA; StringPrototypeB originalB; StringPrototypeA copyA1, copyA2; StringPrototypeB copyB1; - + originalA = new StringPrototypeA(" This is Prototype 1"); - originalB = new StringPrototypeB(" This is Prototype 2"); - + originalB = new StringPrototypeB(" This is Prototype 2"); + System.out.println("These are the two prototypes:"); System.out.println(originalA); System.out.println(originalB); - + copyA1 = (StringPrototypeA) originalA.clone(); copyB1 = (StringPrototypeB) originalB.clone(); - + System.out.println("These are copies of the prototypes:"); System.out.println(copyA1); System.out.println(copyB1); - + System.out.println("Now prototype 1 is changed. Here are prototype 1 and its former copy:"); originalA.setText(" This is Prototype 1 (changed)"); System.out.println(originalA); System.out.println(copyA1); - + System.out.println("This is a clone of the changed prototype 1 and a changed copy of prototype 2:"); copyA2 = (StringPrototypeA) originalA.clone(); copyB1.setText(" This is a changed copy of prototype 2"); System.out.println(copyA2); System.out.println(copyB1); - - - System.out.println("... done."); - + + + System.out.println("... done."); + } catch (CloneNotSupportedException ex) { System.err.println("Can't clone prototype objects"+ex); } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java index 6019d416d..b2373c399 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeA.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; +package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,18 +29,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - * + * * @see StringPrototypeB - */ + */ public class StringPrototypeA implements Cloneable { /** * the string that this object encapsulates */ - + protected String text; - + /** * Creates a new StringPrototypeA object with the given string * @@ -50,34 +50,33 @@ public class StringPrototypeA implements Cloneable { public StringPrototypeA(String init) { text = init; } - + /** * Changes the string this object encapsulates * * @param newText the new text for this object. - */ - + */ + public void setText(String newText) { text = newText; } - + /** * Returns a string representation of this object. * * @returns a string representation of this object. */ - + public String toString() { return "StringPrototypeA: "+ text; - } - - /** + } + + /** * Returns a copy of this object. Does only work this way if the * superclass implements <code>clone()</code>. */ - + public Object clone() throws CloneNotSupportedException { return super.clone(); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java index 2c6f23954..ce0033010 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/prototype/java/StringPrototypeB.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,18 +29,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.prototype.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - * + * * @see StringPrototypeA - */ + */ public class StringPrototypeB implements Cloneable { - + /** * the string that this object encapsulates */ - + protected String text; - + /** * Creates a new StringPrototypeA object with the given string * @@ -50,33 +50,33 @@ public class StringPrototypeB implements Cloneable { public StringPrototypeB(String init) { text = init; } - + /** * Changes the string this object encapsulates * * @param newText the new text for this object. - */ - + */ + public void setText(String newText) { text = newText; } - + /** * Returns a string representation of this object. * * @return a string representation of this object. */ - + public String toString() { return "StringPrototypeB: " + text; - } - - /** + } + + /** * Returns a copy of this object. Does only work this way if the * superclass implements <code>clone()</code>. */ - + public Object clone() throws CloneNotSupportedException { return super.clone(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java index 89ecd27d8..87605bb67 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/AlternateOutputImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,33 +15,33 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * This class will serve as a Delegate for OutputImplementation. Note that no + * This class will serve as a Delegate for OutputImplementation. Note that no * interfaces need to be implemented. This is not a <i>Subject</i> and does in * fact play no role in the pattern. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ -public class AlternateOutputImplementation { +public class AlternateOutputImplementation { /** - * Prints the argument string to + * Prints the argument string to * <code>System.out</code> * * @param s the string to print */ - + public void alternateRequest(String s) { System.out.println("[AlternateSubject.safeRequest()]: "+s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java index 3081d8b01..f5b3697b8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,42 +15,42 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Proxy design pattern example.<p> + * Implements the driver for the Proxy design pattern example.<p> * * Intent: <i>Provide a surrogate or placeholder for another object to control * access to it.</i><p> * - * Participating objects are <code>OutputImplementation</code>s and - * <code>AlternateOutputImplementation</code>. - * + * Participating objects are <code>OutputImplementation</code>s and + * <code>AlternateOutputImplementation</code>. + * * The former acts as a <i>RealSubject</i>. * * Experimental setup: * <code>Main</code> issues three different kinds of requests to - * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice. + * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice. * <UL> - * <LI> SAFE requests are delegated to a different object + * <LI> SAFE requests are delegated to a different object * (delegation proxy) * <LI> REGULAR request are counted * <LI> UNSAFE requests are blocked entirely. * </UL> * - * <p><i>This is the AspectJ version.</i><p> - * + * <p><i>This is the AspectJ version.</i><p> + * * Each concrete aspect defines exactly what requests it is interested * in. For those requests, it declares how to deal with the request. - * + * * The proxy implementation is localized. Even clients need not set - * or remove proxies. - * + * or remove proxies. + * * Please note that the AspectJ version includes an additional proxy * that delegates safe request to a different object. An OO implementation * would be similar to the other OO proxies. @@ -61,39 +61,39 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; */ public class Main { - - /** + + /** * Creates a new Main object and runs the test suite. - */ - - public Main() { + */ + + public Main() { /** * The <i>RealSubject</i> that the client sends all requests to */ - - OutputImplementation real = new OutputImplementation(); - System.out.println("\n===> Issuing SAFE request..."); + OutputImplementation real = new OutputImplementation(); + + System.out.println("\n===> Issuing SAFE request..."); real.safeRequest ("Safe Reqeust"); - System.out.println("\n===> Issuing REGULAR request..."); + System.out.println("\n===> Issuing REGULAR request..."); real.regularRequest("Normal Request"); - System.out.println("\n===> Issuing UNSAFE request..."); + System.out.println("\n===> Issuing UNSAFE request..."); real.unsafeRequest ("Unsafe Request"); - System.out.println("\n===> Issuing SAFE request..."); + System.out.println("\n===> Issuing SAFE request..."); real.safeRequest ("Safe Reqeust"); - System.out.println("\n===> Issuing REGULAR request..."); + System.out.println("\n===> Issuing REGULAR request..."); real.regularRequest("Normal Request"); - System.out.println("\n===> Issuing UNSAFE request..."); + System.out.println("\n===> Issuing UNSAFE request..."); real.unsafeRequest ("Unsafe Request"); - } + } - /** + /** * Implements the driver for the proxy design pattern example. */ - public static void main (String[] args) { + public static void main (String[] args) { Main main = new Main(); } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java index 2023025d0..f067e8afa 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/OutputImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,32 +15,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Represents a <i>RealSubject</i> according to GoF. - * Note that it does not have to implement any interface in the AspectJ + * Represents a <i>RealSubject</i> according to GoF. + * Note that it does not have to implement any interface in the AspectJ * version. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ public class OutputImplementation { /** - * A type of <i>request(..)</i>. Prints the argument string to + * A type of <i>request(..)</i>. Prints the argument string to * <code>System.out</code> * * @param s the string to print */ - + public void safeRequest(String s) { System.out.println("[OutputImplementation.safeRequest()]: "+s); } @@ -55,7 +55,7 @@ public class OutputImplementation { public void regularRequest(String s) { System.out.println("[OutputImplementation.regularRequest()]: "+s); } - + /** * A type of <i>request(..)</i>. * @@ -65,4 +65,4 @@ public class OutputImplementation { public void unsafeRequest(String s) { System.out.println("[OutputImplementation.unsafeRequest()]: "+s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java index d157d44eb..e17aa2ef8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestBlocking.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,32 +15,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol; import org.aspectj.lang.JoinPoint; /** - * Implements a concrete Proxy pattern instance. Here, all unsafe requests - * from <code>Main</code> <code>OutputImplementation</code> - * are blocked.<p> + * Implements a concrete Proxy pattern instance. Here, all unsafe requests + * from <code>Main</code> <code>OutputImplementation</code> + * are blocked.<p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ + +public aspect RequestBlocking extends ProxyProtocol { -public aspect RequestBlocking extends ProxyProtocol { - - /** + /** * Assigns the <i>Subject</i> role to <code>OutputImplementation</code>. */ - + declare parents: OutputImplementation implements Subject; /** @@ -49,7 +49,7 @@ public aspect RequestBlocking extends ProxyProtocol { * OutputImplementation.unsafeRequest(..)</code>. */ - protected pointcut requests(): + protected pointcut requests(): call(* OutputImplementation.unsafeRequest(..)); /** @@ -58,15 +58,15 @@ public aspect RequestBlocking extends ProxyProtocol { * denied. * * @param caller the object responsible for the protected access - * @param subject the subject receiving the call + * @param subject the subject receiving the call * @param joinPoint the joinpoint associated with the protected access * * @return true if the access is from a Main object, false otherwise */ - protected boolean isProxyProtected(Object caller, - Subject subject, - JoinPoint joinPoint) { + protected boolean isProxyProtected(Object caller, + Subject subject, + JoinPoint joinPoint) { if (joinPoint.getThis() instanceof Main) { System.out.println("[RequestBlocking] intercepting unsafe " + "requests from Main"); diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java index da91e003a..aa4c236b8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestCounting.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,48 +15,48 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol; import org.aspectj.lang.JoinPoint; /** - * Implements a concrete proxy pattern instance. Here, all method calls from - * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p> + * Implements a concrete proxy pattern instance. Here, all method calls from + * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ + +public aspect RequestCounting extends ProxyProtocol { -public aspect RequestCounting extends ProxyProtocol { - /** * An internal counter for the number of calls to <code> * print(String)</code>. */ - + private int regularRequests = 0; - - /** + + /** * Assigns the <i>OutputSubject</i> role to <code>OutputImplementation</code>. */ - + declare parents: OutputImplementation implements Subject; /** - * Captures all accesses to the subject that should be protected by + * Captures all accesses to the subject that should be protected by * this pattern instance. Here: All calls to <code> * OutputImplementation.print(..)</code>. */ - protected pointcut requests(): + protected pointcut requests(): call(* OutputImplementation.regularRequest(..)); /** @@ -64,20 +64,20 @@ public aspect RequestCounting extends ProxyProtocol { * that come from <code>Main</code> objects are denied. * * @param caller the object responsible for the protected access - * @param subject the subject receiving the call + * @param subject the subject receiving the call * @param joinPoint the joinpoint associated with the protected access * * @return true if the access is from a Main object, false otherwise */ - protected boolean isProxyProtected(Object caller, - Subject subject, - JoinPoint joinPoint) { + protected boolean isProxyProtected(Object caller, + Subject subject, + JoinPoint joinPoint) { if (joinPoint.getThis() instanceof Main) { regularRequests++; System.out.println("[RequestCounter:] That was regular request nr. " + regularRequests); - } - return false; + } + return false; } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java index 053c5564a..6f8cbf1b3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/aspectj/RequestDelegation.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,84 +15,84 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.ProxyProtocol; import org.aspectj.lang.JoinPoint; /** - * Implements a concrete proxy pattern instance. Here, all method calls from - * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p> + * Implements a concrete proxy pattern instance. Here, all method calls from + * <code>Main</code> to <code>OutputImplementation.print(String)</code> are blocked.<p> * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ - -public aspect RequestDelegation extends ProxyProtocol { - - /** + */ + +public aspect RequestDelegation extends ProxyProtocol { + + /** * Assigns the <i>Subject</i> role to <code>OutputImplementation * </code>. */ - + declare parents: OutputImplementation implements Subject; - - private AlternateOutputImplementation alternateSubject = + + private AlternateOutputImplementation alternateSubject = new AlternateOutputImplementation(); /** - * Captures all accesses to the subject that should be protected by + * Captures all accesses to the subject that should be protected by * this pattern instance. Here: All calls to <code> * OutputImplementation.safeRequest(..)</code>. */ - protected pointcut requests(): + protected pointcut requests(): call(* OutputImplementation.safeRequest(..)); /** * Checks whether the request should be handled by the Proxy or not. - * Here: All accesses matched by the <code>protectedAccesses()</code> + * Here: All accesses matched by the <code>protectedAccesses()</code> * joinpoint. * * @param caller the object responsible for the protected access - * @param subject the subject receiving the call + * @param subject the subject receiving the call * @param joinPoint the joinpoint associated with the protected access * * @return true if the access is covered by the proxy, false otherwise */ - protected boolean isProxyProtected(Object caller, - Subject subject, + protected boolean isProxyProtected(Object caller, + Subject subject, JoinPoint joinPoint) { System.out.println("[RequestDelegation] delegating a safe request " + - "to a different type of object"); + "to a different type of object"); return true; } /** - * For delegation: Provides an alternative return value if access - * is proxy protected. A default implementation is supplied so that + * For delegation: Provides an alternative return value if access + * is proxy protected. A default implementation is supplied so that * concrete subaspects are not forced to implement the method. - * Here, it also calls an appropriate method on a delegate + * Here, it also calls an appropriate method on a delegate * (to illustrate how delegation would work). * * @param caller the object responsible for the proxy protected access - * @param subject the subject receiving the call - * @param joinPoint the joinpoint associated with the proxy protected + * @param subject the subject receiving the call + * @param joinPoint the joinpoint associated with the proxy protected * access * * @return an alternative return value */ - protected Object handleProxyProtection(Object caller, - Subject subject, + protected Object handleProxyProtection(Object caller, + Subject subject, JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); if (args != null) { diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java index e4e91283b..21e0a3294 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,39 +15,39 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the RequestCounter design pattern example.<p> + * Implements the driver for the RequestCounter design pattern example.<p> * * Intent: <i>Provide a surrogate or placeholder for another object to control * access to it.</i><p> * - * Participating objects are <code>OutputImplementation</code> and - * <code>RequestCounter</code> as <i>RealSubject</i> and <i>Proxy</i>, + * Participating objects are <code>OutputImplementation</code> and + * <code>RequestCounter</code> as <i>RealSubject</i> and <i>Proxy</i>, * respectively. - * + * * Both implement the <code>OutputSubject</code> interface, which represents * the <i>Subject</i> interface. * * Experimental setup: * <code>Main</code> issues three different kinds of requests to - * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice. + * the <i>RealSubject</i> (<code>OutputImplementation</code>) twice. * <UL> * <LI> SAFE requests are not affected * <LI> REGULAR request are counted * <LI> UNSAFE requests are blocked entirely. * </UL> * - * <p><i>This is the Java version.</i><p> + * <p><i>This is the Java version.</i><p> * - * <i>Proxy</i>s needs to implement all methods of - * <code>OutputSubject</code>, even those it is not interested in. + * <i>Proxy</i>s needs to implement all methods of + * <code>OutputSubject</code>, even those it is not interested in. * They need to be aware of their role in the pattern. * * @author Jan Hannemann @@ -55,29 +55,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * @version 1.1, 02/17/04 */ -public class Main { +public class Main { /** * Implements the driver for the proxy design pattern. <p> */ - public static void main (String[] args) { + public static void main (String[] args) { OutputSubject real = new OutputImplementation(); OutputSubject countingProxy = new RequestCounter(real); OutputSubject blockingProxy = new RequestBlocker(countingProxy); - - System.out.println("\n===> Issuing SAFE request..."); + + System.out.println("\n===> Issuing SAFE request..."); blockingProxy.safeRequest ("Safe Reqeust"); - System.out.println("\n===> Issuing REGULAR request..."); + System.out.println("\n===> Issuing REGULAR request..."); blockingProxy.regularRequest("Normal Request"); - System.out.println("\n===> Issuing UNSAFE request..."); + System.out.println("\n===> Issuing UNSAFE request..."); blockingProxy.unsafeRequest ("Unsafe Request"); - System.out.println("\n===> Issuing SAFE request..."); + System.out.println("\n===> Issuing SAFE request..."); blockingProxy.safeRequest ("Safe Reqeust"); - System.out.println("\n===> Issuing REGULAR request..."); + System.out.println("\n===> Issuing REGULAR request..."); blockingProxy.regularRequest("Normal Request"); - System.out.println("\n===> Issuing UNSAFE request..."); + System.out.println("\n===> Issuing UNSAFE request..."); blockingProxy.unsafeRequest ("Unsafe Request"); } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java index dab1bedd1..c161a7223 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputImplementation.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,17 +29,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ public class OutputImplementation implements OutputSubject { /** - * A type of <i>request(..)</i>. Prints the argument string to + * A type of <i>request(..)</i>. Prints the argument string to * <code>System.out</code> * * @param s the string to print */ - + public void safeRequest(String s) { System.out.println("[RealSubject.safeRequest()]: "+s); } @@ -54,7 +54,7 @@ public class OutputImplementation implements OutputSubject { public void regularRequest(String s) { System.out.println("[RealSubject.regularRequest()]: "+s); } - + /** * A type of <i>request(..)</i>. * @@ -64,4 +64,4 @@ public class OutputImplementation implements OutputSubject { public void unsafeRequest(String s) { System.out.println("[RealSubject.unsafeRequest()]: "+s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java index a6f9cf362..b1585912a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/OutputSubject.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,30 +15,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the <i>Subject</i> interface that is implemented by both + * Defines the <i>Subject</i> interface that is implemented by both * <code>RequestCounter</code> and <code>OutputImplementation</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ - -public interface OutputSubject { - + */ + +public interface OutputSubject { + /** * A type of <i>request(..)</i>. * * @param s the string to print */ - + public void safeRequest(String s); /** @@ -48,7 +48,7 @@ public interface OutputSubject { */ public void regularRequest(String s); - + /** * A type of <i>request(..)</i>. * @@ -57,4 +57,4 @@ public interface OutputSubject { public void unsafeRequest(String s); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java index be562498f..0b50b3bd9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestBlocker.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,18 +29,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ + +public class RequestBlocker implements OutputSubject { -public class RequestBlocker implements OutputSubject { - /** * a reference to the <i>Subject</i> (used to forward requests to) */ - - private OutputSubject realSubject; - + + private OutputSubject realSubject; + /** - * Creates a new <code>RequestBlocker</code> with the given + * Creates a new <code>RequestBlocker</code> with the given * <i>Subject</i>. * * @param subject The <i>Subject</i> to forward method calls to @@ -49,35 +49,35 @@ public class RequestBlocker implements OutputSubject { public RequestBlocker(OutputSubject subject) { this.realSubject = subject; } - + /** * Forwards the request to its subject. We are not interested in - * this kind of request, but must implement the method (and the - * request forwarding) anyway since the method is part of the + * this kind of request, but must implement the method (and the + * request forwarding) anyway since the method is part of the * <code>RequestBlocker</code> interface. * * @param s the string to print */ - + public void safeRequest(String s) { - realSubject.safeRequest(s); + realSubject.safeRequest(s); System.out.println("[RequestBlocker:] Not interested in safe requests," + - " but must implement anyway"); + " but must implement anyway"); } - + /** * Forwards the request to its subject. We are not interested in - * this kind of request, but must implement the method (and the - * request forwarding) anyway since the method is part of the + * this kind of request, but must implement the method (and the + * request forwarding) anyway since the method is part of the * <code>RequestBlocker</code> interface. * * @param s the string to print */ public void regularRequest(String s) { - realSubject.regularRequest(s); + realSubject.regularRequest(s); System.out.println("[RequestBlocker:] Not interested in regular requests," + - " but must implement anyway"); + " but must implement anyway"); } /** @@ -87,8 +87,8 @@ public class RequestBlocker implements OutputSubject { */ public void unsafeRequest(String s) { - realSubject.unsafeRequest(s); - System.out.println("[RequestBlocker:] " + s + " blocked."); + realSubject.unsafeRequest(s); + System.out.println("[RequestBlocker:] " + s + " blocked."); } - -}
\ No newline at end of file + +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java index ba55bc0ea..ebbe2fff4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/proxy/java/RequestCounter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -29,25 +29,25 @@ package ca.ubc.cs.spl.aspectPatterns.examples.proxy.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ + */ + +public class RequestCounter implements OutputSubject { -public class RequestCounter implements OutputSubject { - /** * a reference to the <i>Subject</i> (used to forward requests to) */ - - private OutputSubject realSubject; - + + private OutputSubject realSubject; + /** * An internal counter for the number of calls to <code> * print(String)</code>. */ - + private int regularRequests = 0; - + /** - * Creates a new <code>RequestCounter</code> with the given + * Creates a new <code>RequestCounter</code> with the given * <i>Subject</i>. * * @param subject The <i>Subject</i> to forward method calls to @@ -56,49 +56,49 @@ public class RequestCounter implements OutputSubject { public RequestCounter(OutputSubject subject) { this.realSubject = subject; } - + /** * Forwards the request to its subject. We are not interested in - * this kind of request, but must implement the method (and the - * request forwarding) anyway since the method is part of the + * this kind of request, but must implement the method (and the + * request forwarding) anyway since the method is part of the * <code>RequestBlocker</code> interface. * * @param s the string to print */ - + public void safeRequest(String s) { - realSubject.safeRequest(s); + realSubject.safeRequest(s); System.out.println("[RequestCounter:] Not interested in safe " + - "requests, but must implement anyway"); + "requests, but must implement anyway"); } - + /** - * Forwards the request to its subject and prints - * out how many times the <i>request()</i> has been called so far. + * Forwards the request to its subject and prints + * out how many times the <i>request()</i> has been called so far. * * @param s the string to print */ public void regularRequest(String s) { regularRequests++; - realSubject.regularRequest(s); + realSubject.regularRequest(s); System.out.println("[RequestCounter:] That was regular request nr. " + - regularRequests); + regularRequests); } /** * Forwards the request to its subject. We are not interested in - * this kind of request, but must implement the method (and the - * request forwarding) anyway since the method is part of the + * this kind of request, but must implement the method (and the + * request forwarding) anyway since the method is part of the * <code>RequestBlocker</code> interface. * * @param s the string to print */ public void unsafeRequest(String s) { - realSubject.unsafeRequest(s); + realSubject.unsafeRequest(s); System.out.println("[RequestCounter:] Not interested in unsafe requests," + - " but must implement anyway"); + " but must implement anyway"); } - -}
\ No newline at end of file + +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java index 18c258e66..194f893b4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,26 +15,26 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Singleton design pattern example.<p> + * Implements the driver for the Singleton design pattern example.<p> * * Intent: <i>Ensure that a class has only one instance and provide a global * point of access to it.</i><p> * - * Participating objects are <code>Printer</code> printer1, printer2, printer3 and + * Participating objects are <code>Printer</code> printer1, printer2, printer3 and * <code>PrinterSubclass</code> ps1, ps2, ps3.<p> * * Three different objects of both Printer and PrinterSubclass are - * instantiated and compared. + * instantiated and compared. * - * This Implementation treats the singleton property as a non-inherited + * This Implementation treats the singleton property as a non-inherited * property. This meant that <i>Singleton</i> classes can still be subclassed * and these subclasses can access the <i>Singleton</i> constructor normally. * @@ -43,7 +43,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/18/04 - * + * * @see Printer * @see PrinterSubclass */ @@ -55,12 +55,12 @@ public class Main { */ private static Printer printer1, printer2, printer3; - + // Experimental setup: Main creates three Printer objects. // The Printer implementation gives each object a unique ID // which is printed when print() is called. If the Singleton // implementation works, all three objects should be the same. - // + // // Implementation: AOP5 - One (concrete) aspect defines the behavior // of the pattern, creating a generic getInstance() method that // is attached to the Singleton interface. Another aspect assigns @@ -72,69 +72,69 @@ public class Main { // // Clients don't have to type-cast, they just use new(..) // - // Subclasses are automatically Singletons, too, unless + // Subclasses are automatically Singletons, too, unless // explicitly declared as non-singletons - - + + /** - * Implements the first test case. Creates 3 references to the + * Implements the first test case. Creates 3 references to the * <i>Singleton</i> by using the regular constructor. That should * create three identical objects. - */ - + */ + private static void test1() { System.out.println("\nTest 1: All three printers should have the " + "same ID"); - + printer1 = new Printer(); printer2 = new Printer(); - printer3 = new Printer(); - + printer3 = new Printer(); + printer1.print(); printer2.print(); - printer3.print(); + printer3.print(); } - + /** * Implements the second test case. Tests if the 3 objects from test 1 are * in fact identical - */ + */ private static void test2() { System.out.println("\nTest 2: All three objects should be identical"); - + System.out.print("\tThey are "); if ((printer1 == printer2) && (printer1 == printer3)) { System.out.println("identical"); } else { - System.out.println("not identical"); + System.out.println("not identical"); } } - + /** * Implements the third test case. Creates 3 instances of the <i>Singleton * </i>'s subclass. These objects should be different. - */ + */ private static void test3() { - System.out.println("\nTest 3: Ensuring that subclasses can access the" + System.out.println("\nTest 3: Ensuring that subclasses can access the" + "constructor"); System.out.println(" (All three outputs should be different)"); - + printer1 = new PrinterSubclass(); printer2 = new PrinterSubclass(); - printer3 = new PrinterSubclass(); - + printer3 = new PrinterSubclass(); + printer1.print(); printer2.print(); - printer3.print(); + printer3.print(); } - - + + /** * This is the driver for the <code>Singleton</code> case. It performes * three tests: @@ -147,7 +147,7 @@ public class Main { * objects should be different. * </OL> */ - + public static void main (String[] args) { System.out.println("Testing SINGLETON pattern (aspectj) ..."); test1(); @@ -155,4 +155,4 @@ public class Main { test3(); System.out.println("\n... done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java index 867b34b73..516b335bf 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/Printer.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,22 +15,22 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements a sample class that will be assigned the <i>Singleton</i> role * in this example. The class's functionality * is to store an instance-specific ID and provide a <code>print()</code> - * method that shows an object's ID. + * method that shows an object's ID. * * Note that in this implementation the class does not have to know * that it is a <i>Singleton</i> (i.e. has no pattern code in it). - * + * * Note further that instead of assigning the <i>Singleton</i> property * via the <code>declare parents</code> construct in the aspect, it is * possible to just add a <code>implements Singleton</doce> here. However, @@ -41,35 +41,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * @version 1.1, 02/18/04 */ -public class Printer { +public class Printer { /** * counts the instances of this class */ - + protected static int objectsSoFar = 0; /** * each instance has an ID to distinguish them. */ - + protected int id; /** * Creates a <code>Printer</code> object. Note that the constructor * is not protected; the protection is realized by the aspect. */ - + public Printer() { id = ++ objectsSoFar; } - + /** * Prints the instance's ID to <code>System.out</code>. */ - + public void print() { System.out.println("\tMy ID is "+id); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java index 8ec000bc5..01c9ce439 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/PrinterSubclass.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,32 +15,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements a sample subclass of the <i>Singleton</i> class. This class is + * Implements a sample subclass of the <i>Singleton</i> class. This class is * to test whether subclasses can still access the Singleton's constructor. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/18/04 - * + * * @see PrinterSingleton */ -public class PrinterSubclass extends Printer { +public class PrinterSubclass extends Printer { /** * Creates an instance of this class by calling <code>super()</code>. */ - + public PrinterSubclass() { super(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java index d87e6373c..47dcfd95c 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/aspectj/SingletonInstance.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.SingletonProtocol; @@ -33,28 +33,28 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.SingletonProtocol; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/18/04 - * + * * @see Printer * @see PrinterSubclass */ -public aspect SingletonInstance extends SingletonProtocol { - +public aspect SingletonInstance extends SingletonProtocol { + /** - * Assigns the Singleton to <code>Printer</code>. This is all that is + * Assigns the Singleton to <code>Printer</code>. This is all that is * necessary to provide <code>Printer</i>'s constructor with the * Singleton protection. */ - - declare parents: Printer implements Singleton; - + + declare parents: Printer implements Singleton; + /** * This declaration allows <code>PrinterSubclass</code> (and all its * subclasses) to access <code>Printer</code>'s constructor within * its constructor (to allow for <code>super(..)</code> calls). */ - - protected pointcut protectionExclusions(): - call((PrinterSubclass+).new(..)); -}
\ No newline at end of file + + protected pointcut protectionExclusions(): + call((PrinterSubclass+).new(..)); +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java index a03707666..3e681ec4e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,124 +15,124 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Singleton design pattern example.<p> + * Implements the driver for the Singleton design pattern example.<p> * * Intent: <i>Ensure that a class has only one instance and provide a global * point of access to it.</i><p> * - * Participating objects are <code>PrinterSingleton</code> printer1, printer2, printer3 and + * Participating objects are <code>PrinterSingleton</code> printer1, printer2, printer3 and * <code>PrinterSubclass</code> ps1, ps2, ps3.<p> * * Three different objects of both PrinterSingleton and PrinterSubclass are - * instantiated and compared. + * instantiated and compared. * - * This Implementation treats the singleton property as a non-inherited + * This Implementation treats the singleton property as a non-inherited * property. This meant that <i>Singleton</i> classes can still be subclassed * and these subclasses can access the <i>Singleton</i> constructor normally. * * <p><i>This is the Java version.</i><p> - * - * Making the singleton property non-inherited requires to make the + * + * Making the singleton property non-inherited requires to make the * constructor of the <i>Singleton</i> protected (so subtypes can still * invoke <code>super(..)</code> in their constructor). * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/18/04 - * + * * @see PrinterSingleton * @see PrinterSubclass */ -class Main { - +class Main { + /** * the three object references to instances of the <i>Singleton</i> class. */ - + private static PrinterSingleton printer1, printer2, printer3; /** - * Implements the first test case. Creates 3 references to the - * <i>Singleton</i> by (a) using the regular constructor and then by (b) + * Implements the first test case. Creates 3 references to the + * <i>Singleton</i> by (a) using the regular constructor and then by (b) * using a factory method. (a) should fail (but does not, since this * <code>Main</code> class is in the same package and can access the * protected constructor), (b) should create three identical objects. - */ - + */ + private static void test1() { System.out.println("\nTest 1a: Try to call regular constructor. " + "This should fail."); - + printer1 = new PrinterSingleton(); printer2 = new PrinterSingleton(); printer3 = new PrinterSingleton(); - + printer1.print(); printer2.print(); - printer3.print(); - + printer3.print(); + System.out.println("\t=> OO Problem: Classes in the same package can " + "access the protected constructor."); - + System.out.println("\nTest 1b: Using instance() instead. This hould " + "create three identical objects."); - + printer1 = PrinterSingleton.instance(); printer2 = PrinterSingleton.instance(); - printer3 = PrinterSingleton.instance(); - + printer3 = PrinterSingleton.instance(); + printer1.print(); printer2.print(); - printer3.print(); + printer3.print(); } - + /** * Implements the second test case. Tests if the 3 objects from test 1 are * in fact identical - */ + */ private static void test2() { System.out.println("\nTest 2: All three objects should be identical"); System.out.print("\tThey are "); - if ((printer1 == printer2) && (printer1 == printer3)) { - System.out.println("identical"); + if ((printer1 == printer2) && (printer1 == printer3)) { + System.out.println("identical"); } else { - System.out.println("not identical"); + System.out.println("not identical"); } } - + /** * Implements the third test case. Creates 3 instances of the <i>Singleton * </i>'s subclass. These objects should be different. - */ + */ private static void test3() { - System.out.println("\nTest 3: Ensuring that subclasses can access the" + System.out.println("\nTest 3: Ensuring that subclasses can access the" + " constructor"); System.out.println(" (All three outputs should be different)"); - + printer1 = new PrinterSubclass(); printer2 = new PrinterSubclass(); - printer3 = new PrinterSubclass(); - + printer3 = new PrinterSubclass(); + printer1.print(); printer2.print(); - printer3.print(); + printer3.print(); } - + /** * This is the driver for the <code>Singleton</code> case. It performes * three tests: @@ -146,12 +146,12 @@ class Main { * objects should be different. * </OL> */ - - public static void main (String[] args) { + + public static void main (String[] args) { System.out.println("Testing SINGLETON pattern (java) ..."); test1(); test2(); test3(); System.out.println("\n... done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java index ee3d090e3..1341749d3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSingleton.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -97,4 +97,3 @@ public class PrinterSingleton { System.out.println("\tMy ID is "+id); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java index 218f99206..b0c7a36e4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/singleton/java/PrinterSubclass.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements a sample subclass of the <i>Singleton</i> class. This class is + * Implements a sample subclass of the <i>Singleton</i> class. This class is * to test whether subclasses can still access the Singleton's constructor. * * @author Jan Hannemann @@ -31,13 +31,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.singleton.java; * @version 1.1, 02/18/04 */ -public class PrinterSubclass extends PrinterSingleton { - +public class PrinterSubclass extends PrinterSingleton { + /** * Creates an instance of this class by calling <code>super()</code>. */ - + public PrinterSubclass() { super(); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java index 4009e3291..ca2bdbb03 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,29 +15,29 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the State design pattern example.<p> + * Implements the driver for the State design pattern example.<p> * * Intent: <i>Allow an object to alter its behavior when its internal state * changes. The object will appear to change its class</i><p> * - * Participating objects are <code>Queue</code> as <i>Context</i>, and + * Participating objects are <code>Queue</code> as <i>Context</i>, and * <code>QueueNormal</code>, <code>QueueEmpty</code>, and <code>QueueFull * </code> as <i>ConcreteState</i>s. The <i>State</i> interface is defined in - * <code>QueueState</code>. - * <p> + * <code>QueueState</code>. + * <p> * * This example of the State design pattern models a Queue ADT with - * a limited capacity that has three different states: + * a limited capacity that has three different states: * <UL> - * <LI>Empty: The queue is empty + * <LI>Empty: The queue is empty * <LI>Normal: The queue is neither empty nor full * <LI>Full: The queue is full (# of elements = capacity) * </UL> @@ -53,19 +53,19 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * <LI>QueueState: State interface * <LI>QueueEmpty: ConcreteState1 * <LI>QueueNormal: ConcreteState2 - * <LI>QueueFull: ConcreteState3 + * <LI>QueueFull: ConcreteState3 * </UL> * <p><i>This is the AspectJ version.</i><p> * - * This implementation uses a concrete aspect to take care of all the state + * This implementation uses a concrete aspect to take care of all the state * transitions in the system. States are no longer tangled with each other - * as they do not have to know about their successor states. All state + * as they do not have to know about their successor states. All state * transitions are localized in the aspect. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see Queue * @see QueueState * @see QueueEmpty @@ -74,20 +74,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * @see QueueStateAspect */ -public class Main { +public class Main { /** * Implements insertion into a queue. Prints out status messages. * * @param queue the queue to insert into * @param s the string to insert into the queue - */ + */ public static void testInsert(Queue queue, String s) { System.out.print(" Trying to insert ["+s+"] into the queue ... "); boolean status = queue.insert(s); if (status == true) { - System.out.println("successful"); + System.out.println("successful"); } else { System.out.println("NOT successful, queue probably full"); } @@ -97,21 +97,21 @@ public class Main { * Implements deletion from a queue. Prints out status messages. * * @param queue the queue to delete items from - */ + */ public static void testRemove(Queue queue) { System.out.print(" Trying to remove 1st element of the queue ... "); - String item = (String) queue.getFirst(); + String item = (String) queue.getFirst(); boolean status = queue.removeFirst(); if (status == true) { - System.out.println("successful: "+item); + System.out.println("successful: "+item); } else { System.out.println("NOT successful: "+item); } } /** - * Implements the driver for the State design pattern example.<p> + * Implements the driver for the State design pattern example.<p> * * @param args the command line paramters, unused */ @@ -119,12 +119,12 @@ public class Main { public static void main(String[] args) { System.out.println("Testing Pattern: State - STARTING\n"); - + Queue queue = new Queue(); testInsert(queue, "This "); - testInsert(queue, "is "); + testInsert(queue, "is "); testInsert(queue, "a "); - testInsert(queue, "test"); + testInsert(queue, "test"); System.out.println(); testRemove(queue); testRemove(queue); @@ -135,4 +135,3 @@ public class Main { } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java index c5709666d..07ff2a756 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/Queue.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements the <i>context</i> of the queue example. This is effectively * a queue with limited capacity. Requests are forwarded to the current state - * object. + * object. * * @author Jan Hannemann * @author Gregor Kiczales @@ -33,53 +33,53 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; */ public class Queue { - + /** * the current state of this context - */ + */ + + protected QueueState state = new QueueEmpty(); - protected QueueState state = new QueueEmpty(); - /** - * Tries to insert an object into the queue. Returns true if successful, + * Tries to insert an object into the queue. Returns true if successful, * false otherwiese. * * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ + */ - public boolean insert(Object arg) { + public boolean insert(Object arg) { return state.insert(arg); } - + /** * Returns the first item in the queue * * @return the first item in the queue - */ + */ - public Object getFirst() { + public Object getFirst() { return state.getFirst(); } - + /** * Tries to remove an object from the queue. Returns true if successful, * false otherwiese. * * @return true if deletion was successful, false otherwise. - */ + */ - public boolean removeFirst() { + public boolean removeFirst() { return state.removeFirst(); - } - + } + /** * Sets the state of the context to the arguments state. * * @param state the new state for the context object. */ - + public void setState(QueueState state) { this.state = state; - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java index 579bea67e..57212fe6a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueEmpty.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,27 +15,27 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "empty" for the queue example. - * Removing items is impossible if the queue is empty. + * Implements the <i>ConcreteState</i> "empty" for the queue example. + * Removing items is impossible if the queue is empty. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see QueueNormal * @see QueueFull */ public class QueueEmpty implements QueueState { - + /** * Tries to insert an object into the queue. Returns true since it is * always possible to insert items into an empty queue. The appropriate @@ -43,34 +43,34 @@ public class QueueEmpty implements QueueState { * * @param arg the object to be inserted into the queue * @return true. - */ + */ - public boolean insert(Object arg) { - return true; + public boolean insert(Object arg) { + return true; } /** - * Returns the first item in the queue. Returns null since the queue is + * Returns the first item in the queue. Returns null since the queue is * empty. * * @return null. - */ + */ public Object getFirst() { return null; } /** - * Tries to remove an object from the queue. Returns false (queue is + * Tries to remove an object from the queue. Returns false (queue is * empty). * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return false. - */ + */ public boolean removeFirst(){ return false; - } + } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java index bf9b4e8b3..c1447194e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueFull.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "full" for the queue example. - * Inserting items is impossible if the queue is full. + * Implements the <i>ConcreteState</i> "full" for the queue example. + * Inserting items is impossible if the queue is full. * * @author Jan Hannemann * @author Gregor Kiczales @@ -39,13 +39,13 @@ public class QueueFull implements QueueState { /** * stores the items in the queue */ - + protected Object[] items; - + /** * stores the index of the first item in the queue. - */ - + */ + protected int first; /** @@ -54,32 +54,32 @@ public class QueueFull implements QueueState { * * @param arg the object to be inserted into the queue * @return false. - */ - - public boolean insert(Object arg) { + */ + + public boolean insert(Object arg) { return false; } /** - * Returns the first item in the queue. + * Returns the first item in the queue. * * @return the first item in the queue. - */ + */ - public Object getFirst() { + public Object getFirst() { return items[first]; } /** * Tries to remove an object from the queue. Returns true if successful, - * false otherwiese. The state transition to "normal" is implemented by + * false otherwiese. The state transition to "normal" is implemented by * the aspect. * - * @return true since it is always possible to delete an item from a + * @return true since it is always possible to delete an item from a * full queue - */ + */ - public boolean removeFirst(){ + public boolean removeFirst(){ return true; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java index f719d8f6a..2342b9fba 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueNormal.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "normal" for the queue example. + * Implements the <i>ConcreteState</i> "normal" for the queue example. * Inserting and deleting items is possible in this state. * * @author Jan Hannemann @@ -31,64 +31,64 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * @version 1.1, 02/17/04 * * @see QueueEmpty - * @see QueueFull + * @see QueueFull */ public class QueueNormal implements QueueState { - + /** * stores the items in the queue */ - + protected Object[] items = new Object[3]; /** * stores the index of the first item in the queue */ - - protected int first = 0; + + protected int first = 0; /** * stores the index of the last item in the queue */ - + protected int last = 0; /** - * Tries to insert an object into the queue. Returns true if successful, - * false otherwiese. Potential state changes to "full" are facilitated + * Tries to insert an object into the queue. Returns true if successful, + * false otherwiese. Potential state changes to "full" are facilitated * by the aspect. * * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ - + */ + public boolean insert(Object arg) { // Inserts a new Object into the queue - items[(last)%items.length] = arg; - last = (last+1) % items.length; + items[(last)%items.length] = arg; + last = (last+1) % items.length; return true; } /** - * Returns the first item in the queue. + * Returns the first item in the queue. * * @returns null. - */ + */ - public Object getFirst() { // Returns the first element in the queue + public Object getFirst() { // Returns the first element in the queue return items[first]; } /** * Tries to remove an object from the queue. Returns true if successful, - * false otherwiese. Potential state changes to "empty" are facilitated + * false otherwiese. Potential state changes to "empty" are facilitated * by the aspect. * * @return true if deletion was successful, false otherwise. - */ + */ - public boolean removeFirst(){ // Removes the first element from the queue - first = (first + 1) % items.length; + public boolean removeFirst(){ // Removes the first element from the queue + first = (first + 1) % items.length; return true; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java index 32de7a10c..bf65a924e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueState.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -62,4 +62,4 @@ public interface QueueState { public boolean removeFirst(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java index bfdcae8e4..aa5ef22da 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/aspectj/QueueStateAspect.java @@ -1,4 +1,4 @@ -package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; +package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,62 +15,62 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the state transitions for this state design pattern example. - * State transitions are realizied as <code>after</code> advice. The + * Implements the state transitions for this state design pattern example. + * State transitions are realizied as <code>after</code> advice. The * joinpoints are the calls from the context to its state object.<p> * - * Exisiting states are reused without a employing a flyweight mechanism or + * Exisiting states are reused without a employing a flyweight mechanism or * (inflexibly) modularizing the transitions in the context. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * */ public aspect QueueStateAspect { - - /** + + /** * the queue's "empty" state - */ - + */ + protected QueueEmpty empty = new QueueEmpty(); - /** + /** * the queue's "normal" state - */ + */ protected QueueNormal normal = new QueueNormal(); - /** + /** * the queue's "full" state - */ + */ - protected QueueFull full = new QueueFull(); + protected QueueFull full = new QueueFull(); - /** - * Sets the initial state of the queue to empty. + /** + * Sets the initial state of the queue to empty. * * @param queue the queue context that is initialized. */ - + after(Queue queue): initialization(new()) && target(queue) { queue.setState(empty); } - /** - * Updates the queue context's state after each call from it to the + /** + * Updates the queue context's state after each call from it to the * <code>insert(Object)</code> method if its current state. * * @param queue the queue context that makes the call. @@ -79,20 +79,20 @@ public aspect QueueStateAspect { */ after(Queue queue, QueueState qs, Object arg): call(boolean QueueState+.insert(Object)) && target(qs) && args(arg) && this(queue) { - if (qs == empty) { + if (qs == empty) { normal.insert(arg); queue.setState(normal); - } else if (qs == normal) { + } else if (qs == normal) { if (normal.first == normal.last) { full.items = normal.items; full.first = normal.first; queue.setState(full); } } - } - - /** - * Updates the queue context's state after each call from it to the + } + + /** + * Updates the queue context's state after each call from it to the * <code>removeFirst()</code> method if its current state. * * @param queue the queue context that makes the call. @@ -110,5 +110,5 @@ public aspect QueueStateAspect { queue.setState(empty); } } - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java index 423feb302..63bd00f7e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,33 +15,33 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the State design pattern example.<p> + * Implements the driver for the State design pattern example.<p> * * Intent: <i>Allow an object to alter its behavior when its internal state * changes. The object will appear to change its class</i><p> * - * Participating objects are <code>Queue</code> as <i>Context</i>, and + * Participating objects are <code>Queue</code> as <i>Context</i>, and * <code>QueueNormal</code>, <code>QueueEmpty</code>, and <code>QueueFull * </code> as <i>ConcreteState</i>s. The <i>State</i> interface is defined in * <code>QueueState</code>. This version implements an update-on-demand * logic (see GoF, implementation 1, page 308). The logic requires passing * the context to calls to methods defined on the state interface, and an - * interface for context objects. The interface is defined in + * interface for context objects. The interface is defined in * <code>QueueContext</code>. - * <p> + * <p> * * This example of the State design pattern models a Queue ADT with - * a limited capacity that has three different states: + * a limited capacity that has three different states: * <UL> - * <LI>Empty: The queue is empty + * <LI>Empty: The queue is empty * <LI>Normal: The queue is neither empty nor full * <LI>Full: The queue is full (# of elements = capacity) * </UL> @@ -57,14 +57,14 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * <LI>QueueState: State interface * <LI>QueueEmpty: ConcreteState1 * <LI>QueueNormal: ConcreteState2 - * <LI>QueueFull: ConcreteState3 + * <LI>QueueFull: ConcreteState3 * </UL> - * This implementation passes the context as an argument to its method + * This implementation passes the context as an argument to its method * calls to state objects, thus allowing for update on demand and removing * the constraint that Queue has to ask the states for the successor state * after each call. * - * According to GoF, this implementation is generally more flexible than + * According to GoF, this implementation is generally more flexible than * having the state transitions fixed in the context object. Note however * that this approach results in a tight coupling of <i>ConcreteState</i>s * and <i>Context</i> objects. @@ -74,7 +74,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see QueueContext * @see Queue * @see QueueState @@ -84,20 +84,20 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; */ -public class Main { - +public class Main { + /** * Implements insertion into a queue. Prints out status messages. * * @param queue the queue to insert into * @param s the string to insert into the queue - */ + */ private static void testInsert(Queue queue, String s) { System.out.print(" Trying to insert ["+s+"] into the queue ... "); boolean status = queue.insert(s); if (status == true) { - System.out.println("successful"); + System.out.println("successful"); } else { System.out.println("NOT successful, queue probably full"); } @@ -107,21 +107,21 @@ public class Main { * Implements deletion from a queue. Prints out status messages. * * @param queue the queue to delete items from - */ + */ private static void testRemove(Queue queue) { System.out.print(" Trying to remove 1st element of the queue ... "); - String item = (String) queue.getFirst(); + String item = (String) queue.getFirst(); boolean status = queue.removeFirst(); if (status == true) { - System.out.println("successful: "+item); + System.out.println("successful: "+item); } else { System.out.println("NOT successful: "+item); } } /** - * Implements the driver for the State design pattern example.<p> + * Implements the driver for the State design pattern example.<p> * * @param args the command line paramters, unused */ @@ -129,12 +129,12 @@ public class Main { public static void main(String[] args) { System.out.println("Testing Pattern: State - STARTING\n"); - + Queue queue = new Queue(); testInsert(queue, "This "); - testInsert(queue, "is "); + testInsert(queue, "is "); testInsert(queue, "a "); - testInsert(queue, "test"); + testInsert(queue, "test"); System.out.println(); testRemove(queue); testRemove(queue); @@ -144,4 +144,3 @@ public class Main { System.out.println("\nTesting Pattern: State - FINISHED"); } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java index 141a76560..229d8b538 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/Queue.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,71 +15,71 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements the <i>context</i> of the queue example. This is effectively * a queue with limited capacity. Requests are forwarded to the current state - * object. + * object. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 */ -public class Queue implements QueueContext { - +public class Queue implements QueueContext { + /** * the current <i>State</i> of this <i>Context</i> - */ - - protected QueueState state = new QueueEmpty(); - + */ + + protected QueueState state = new QueueEmpty(); + /** - * Tries to insert an object into the queue. Returns true if successful, + * Tries to insert an object into the queue. Returns true if successful, * false otherwiese. * * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ - - public boolean insert(Object arg) { + */ + + public boolean insert(Object arg) { return state.insert(this, arg); } - + /** * Returns the first item in the queue * * @return the first item in the queue - */ + */ - public Object getFirst() { + public Object getFirst() { return state.getFirst(this); } - + /** * Tries to remove an object from the queue. Returns true if successful, * false otherwise. * * @return true if deletion was successful, false otherwise. - */ + */ public boolean removeFirst() { // Removes the first element from the queue return state.removeFirst(this); - } - + } + /** * Sets the state of the context to the arguments state. * * @param state the new state for the context object. */ - + public void setState(QueueState state) { this.state = state; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java index 09ce140cb..6d7e34ff2 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueContext.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the interface for <i>Context</i>s within this queue example. The - * operation provided is <code>setState(QueueState)</code>. + * Defines the interface for <i>Context</i>s within this queue example. The + * operation provided is <code>setState(QueueState)</code>. * * @author Jan Hannemann * @author Gregor Kiczales @@ -38,6 +38,6 @@ public interface QueueContext { * * @param state the new state for the context object. */ - + public void setState(QueueState state); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java index a914dffd5..b681005c8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueEmpty.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,69 +15,69 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "empty" for the queue example. + * Implements the <i>ConcreteState</i> "empty" for the queue example. * Removing items is impossible if the queue is empty. Inserting items will * trigger a state change to "normal". * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see QueueNormal * @see QueueFull */ public class QueueEmpty implements QueueState { - + /** - * Tries to insert an object into the queue. Returns true if successful, + * Tries to insert an object into the queue. Returns true if successful, * false otherwiese. The state of the context * is changed to "normal" (queue is no longer empty). * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ - + */ + public boolean insert(QueueContext context, Object arg) { - QueueNormal nextState = new QueueNormal(); + QueueNormal nextState = new QueueNormal(); context.setState(nextState); - return nextState.insert(context, arg); + return nextState.insert(context, arg); } /** - * Returns the first item in the queue. Returns null since the queue is + * Returns the first item in the queue. Returns null since the queue is * empty. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return null. - */ + */ public Object getFirst(QueueContext context) { return null; } /** - * Tries to remove an object from the queue. Returns false (queue is + * Tries to remove an object from the queue. Returns false (queue is * empty). * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return false. - */ + */ public boolean removeFirst(QueueContext context){ return false; - } + } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java index 1e5f677d4..4659f8def 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueFull.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "full" for the queue example. + * Implements the <i>ConcreteState</i> "full" for the queue example. * Inserting items is impossible if the queue is full. Removing items will * trigger a state change to "normal". * @@ -40,18 +40,18 @@ public class QueueFull implements QueueState { /** * stores the items in the queue */ - + protected Object[] items; - + /** - * stores the index of the first item in the queue. - */ - + * stores the index of the first item in the queue. + */ + protected int first; /** * Creates a new QueueFull state object with the given set of elements - * and the given index. + * and the given index. * * @param items the content of the full queue * @param first the index of the first item in the queue @@ -66,25 +66,25 @@ public class QueueFull implements QueueState { * Tries to insert an object into the queue. Returns false since the * queue is full. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @param arg the object to be inserted into the queue * @return false. - */ - - public boolean insert(QueueContext context, Object arg) { + */ + + public boolean insert(QueueContext context, Object arg) { return false; } /** - * Returns the first item in the queue. + * Returns the first item in the queue. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return the first item in the queue. - */ + */ - public Object getFirst(QueueContext context) { + public Object getFirst(QueueContext context) { return items[first]; } @@ -92,14 +92,14 @@ public class QueueFull implements QueueState { * Tries to remove an object from the queue. Returns true if successful, * false otherwiese. The state of the context is changed to "normal". * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return true if deletion was successful, false otherwise. - */ + */ - public boolean removeFirst(QueueContext context){ - QueueState nextState = new QueueNormal(items, first, first); + public boolean removeFirst(QueueContext context){ + QueueState nextState = new QueueNormal(items, first, first); context.setState(nextState); return nextState.removeFirst(context); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java index cb006cf40..bcb6981a2 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueNormal.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the <i>ConcreteState</i> "normal" for the queue example. + * Implements the <i>ConcreteState</i> "normal" for the queue example. * Inserting and deleting items is possible in this state. * * @author Jan Hannemann @@ -31,32 +31,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * @version 1.1, 02/17/04 * * @see QueueEmpty - * @see QueueFull + * @see QueueFull */ public class QueueNormal implements QueueState { - + /** * stores the items in the queue */ - + protected Object[] items = new Object[3]; /** * stores the index of the first item in the queue */ - - protected int first = 0; + + protected int first = 0; /** * stores the index of the last item in the queue */ - + protected int last = 0; /** * Creates a new QueueNormal state object with the given set of elements - * and the given indices for first and last object. + * and the given indices for first and last object. * * @param items the content of the full queue * @param first the index of the first item in the queue @@ -68,28 +68,28 @@ public class QueueNormal implements QueueState { this.first = first; this.last = last; } - - /** + + /** * Alternate constructor that uses preset values for object variables. */ - + public QueueNormal() { } /** - * Tries to insert an object into the queue. Returns true if successful, + * Tries to insert an object into the queue. Returns true if successful, * false otherwiese. If the queue is full * after the insertion, the state of the context is changed to "full". * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ - + */ + public boolean insert(QueueContext context, Object arg) { - items[(last)%items.length] = arg; - last = (last+1) % items.length; + items[(last)%items.length] = arg; + last = (last+1) % items.length; if (first == last) { context.setState(new QueueFull(items, first)); } @@ -97,14 +97,14 @@ public class QueueNormal implements QueueState { } /** - * Returns the first item in the queue. + * Returns the first item in the queue. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return the first item in the queue. - */ + */ - public Object getFirst(QueueContext context) { + public Object getFirst(QueueContext context) { return items[first]; } @@ -114,16 +114,16 @@ public class QueueNormal implements QueueState { * the last one in the queue, the state of the context is changed to * "empty". * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return true if deletion was successful, false otherwise. - */ + */ - public boolean removeFirst(QueueContext context){ - first = (first + 1) % items.length; + public boolean removeFirst(QueueContext context){ + first = (first + 1) % items.length; if (first == last) { context.setState(new QueueEmpty()); } return true; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java index 7be872fc1..705ad923f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/state/java/QueueState.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,56 +15,56 @@ package ca.ubc.cs.spl.aspectPatterns.examples.state.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the interface for <i>State</i>s within this queue example. The + * Defines the interface for <i>State</i>s within this queue example. The * operations provided are <code>insert(..)</code>, <code>getFirst(..)</code>, - * and <code>removeFirst(..)</code>. + * and <code>removeFirst(..)</code>. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 */ -public interface QueueState { - +public interface QueueState { + /** - * Tries to insert an object into the queue. Returns true if successful, + * Tries to insert an object into the queue. Returns true if successful, * false otherwiese. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @param arg the object to be inserted into the queue * @return true if insertion was successful, false otherwise. - */ - + */ + public boolean insert(QueueContext context, Object arg); /** * Returns the first item in the queue * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return the first item in the queue - */ + */ - public Object getFirst(QueueContext context); + public Object getFirst(QueueContext context); /** * Tries to remove an object from the queue. Returns true if successful, * false otherwiese. * - * @param context the <i>Context</i> for this design pattern (for update + * @param context the <i>Context</i> for this design pattern (for update * on demand) * @return true if deletion was successful, false otherwise. - */ + */ - public boolean removeFirst(QueueContext context); + public boolean removeFirst(QueueContext context); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java index be404119f..18276668a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/BubbleSort.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements the bubblesort sorting strategy for int arrays. * @@ -34,7 +34,7 @@ public class BubbleSort { /** * Helper method that exchanges two values in an int array - * + * * @param numbers the int array * @param pos1 the position of the first element * @param pos2 the position of the second element @@ -48,12 +48,12 @@ public class BubbleSort { /** * Sorts an int array using basic bubblesort - * + * * @param numbers the int array to sort */ public void sort(int[] numbers) { - System.out.print("Sorting by BubbleSort..."); + System.out.print("Sorting by BubbleSort..."); for (int end = numbers.length; end > 1; end --) { for (int current = 0; current < end - 1; current ++) { if (numbers[current] > numbers[current+1]) { @@ -64,4 +64,3 @@ public class BubbleSort { System.out.println("done."); } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java index fa7d5f4d6..6eae6e396 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/LinearSort.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements the linear sort sorting strategy for int arrays. * @@ -31,10 +31,10 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; */ public class LinearSort { - + /** * Helper method that exchanges two values in an int array - * + * * @param numbers the int array * @param pos1 the position of the first element * @param pos2 the position of the second element @@ -49,17 +49,17 @@ public class LinearSort { /** * Sorts an int array - * + * * @param numbers the int array to sort */ public void sort(int[] numbers) { System.out.print("Sorting by LinearSort..."); - int lowest = 0; - + int lowest = 0; + for (int start = 0; start < numbers.length; start ++) { lowest = start; - + for (int current = start; current < numbers.length; current ++) { if (numbers[current] < numbers[lowest]) { lowest = current; @@ -69,4 +69,4 @@ public class LinearSort { } System.out.println("done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java index c219af7fe..5b9920f56 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,25 +15,25 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the strategy design pattern example.<p> + * Implements the driver for the strategy design pattern example.<p> * * Intent: <i>Define a family of algorithms, encapsulate each one, and make - * them interchangeable. Strategy lets the algorithm vary independently from + * them interchangeable. Strategy lets the algorithm vary independently from * clients that use it.</i><p> * * Participating objects are <code>LinearSort</code> and <i>BubbleSort</i> * as <i>Strategies</i>, and <code>Sorter</code> as <i>Context</i>. * * In this example, an array of 10 numbers is to be sorted. Depending on the - * number of arguments of the call to <code>Main</code>, linear sort or + * number of arguments of the call to <code>Main</code>, linear sort or * bubblesort are used as sorting algorithms. The interface for the strategies * is defined in <code>SortingStrategy</code>. * @@ -42,16 +42,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see LinearSort * @see BubbleSort */ -public class Main { +public class Main { /** * Returns the content of the int array in a string - * + * * @param numbers the int array to display * @returns a string with all the ints from the array */ @@ -60,37 +60,35 @@ public class Main { String out = ""; for (int i=0; i<numbers.length; i++) { out += (numbers[i] + " "); - } + } return out; } /** * Implements the driver for the strategy example. If called with more * than zero arguments, bubblesort is used to sort the array of ten - * numbers; otherwise linear sort. - */ - + * numbers; otherwise linear sort. + */ + public static void main(String[] args) { int[] numbers = {3, 2, 9, 8, 1, 5, 6, 4, 7, 0}; - + LinearSort sort1 = new LinearSort(); BubbleSort sort2 = new BubbleSort(); - + Sorter sorter = new Sorter(); - - + + if (args.length == 0) { SortingStrategy.aspectOf().setConcreteStrategy(sorter, sort1); - } + } else { SortingStrategy.aspectOf().setConcreteStrategy(sorter, sort2); } System.out.println("\nPreparing sort..."); - System.out.println("original: "+show(numbers)); + System.out.println("original: "+show(numbers)); numbers = sorter.sort(numbers); - System.out.println("sorted: "+show(numbers)); - } -} - - + System.out.println("sorted: "+show(numbers)); + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java index 0827addb5..6935c1b5d 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/Sorter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -36,4 +36,4 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * @version 1.1, 02/17/04 */ -public class Sorter {}
\ No newline at end of file +public class Sorter {} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java index 9657f08f6..764ad2935 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/aspectj/SortingStrategy.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java index 3009d9fd0..59066c161 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/BubbleSort.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -65,4 +65,3 @@ public class BubbleSort implements SortingStrategy { System.out.println("done."); } } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java index 0fa44cae1..22d570fb0 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/LinearSort.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Implements the linear sort sorting strategy for int arrays. * @@ -31,10 +31,10 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; */ public class LinearSort implements SortingStrategy{ - + /** * Helper method that exchanges two values in an int array - * + * * @param numbers the int array * @param pos1 the position of the first element * @param pos2 the position of the second element @@ -49,17 +49,17 @@ public class LinearSort implements SortingStrategy{ /** * Sorts an int array - * + * * @param numbers the int array to sort */ public void sort(int[] numbers) { System.out.print("Sorting by LinearSort..."); - int lowest = 0; - + int lowest = 0; + for (int start = 0; start < numbers.length; start ++) { lowest = start; - + for (int current = start; current < numbers.length; current ++) { if (numbers[current] < numbers[lowest]) { lowest = current; @@ -69,4 +69,4 @@ public class LinearSort implements SortingStrategy{ } System.out.println("done."); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java index 10df445f6..28eb85a36 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,18 +15,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** - * Implements the driver for the Strategy design pattern example.<p> + * Implements the driver for the Strategy design pattern example.<p> * * Intent: <i>Define a family of algorithms, encapsulate each one, and make - * them interchangeable. Strategy lets the algorithm vary independently from + * them interchangeable. Strategy lets the algorithm vary independently from * clients that use it.</i><p> * * Participating objects are <code>LinearSort</code> and <code>BubbleSort @@ -34,7 +34,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * * In this example, an array of 10 numbers is to be sorted. Depending on the * number of arguments of the call to <code>Main.main(..)</code>, linear sort - * or bubblesort are used as sorting algorithms. The interface for the + * or bubblesort are used as sorting algorithms. The interface for the * <i>strategies</i> is defined in <code>SortingStrategy</code>. * * <p><i>This is the Java version.</i><p> @@ -42,34 +42,32 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see LinearSort * @see BubbleSort */ - -public class Main { - + +public class Main { + /** * Implements the driver for the strategy example. If called with more * than zero arguments, bubblesort is used to sort the array of ten - * numbers; otherwise linear sort is used. - */ - + * numbers; otherwise linear sort is used. + */ + public static void main(String[] args) { int[] numbers = {3, 2, 9, 8, 1, 5, 6, 4, 7, 0}; - + SortingStrategy sort1 = new LinearSort(); SortingStrategy sort2 = new BubbleSort(); - + Sorter sorter; - + if (args.length == 0) { sorter = new Sorter(sort1, numbers); - } + } else { sorter = new Sorter(sort2, numbers); } } -} - - +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java index 4a53ffc39..635643049 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/Sorter.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,45 +15,45 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Sorts an int array with a provided sorting strategy. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see LinearSort * @see BubbleSort */ -public class Sorter { - +public class Sorter { + /** * Shows the original (unsorted) array, sorts it and shows the new * (sorted) array. - * + * * @param sort the sorting strategy * @param numbers the array of int to sort */ public Sorter(SortingStrategy sort, int[] numbers) { System.out.println("\nPreparing sort..."); - System.out.println("original: "+show(numbers)); + System.out.println("original: "+show(numbers)); sort.sort(numbers); - System.out.println("sorted: "+show(numbers)); + System.out.println("sorted: "+show(numbers)); System.out.println("Done sorting."); } /** * Returns the content of the int array in a string - * + * * @param numbers the int array to display * @returns a string with all the ints from the array */ @@ -63,7 +63,7 @@ public class Sorter { for (int i=0; i<numbers.length; i++) { out += (numbers[i] + " "); - } + } return out; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java index e5d647549..3f925134e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/strategy/java/SortingStrategy.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,13 +15,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.strategy.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * Declares the interface for sorting strategies * diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java index bededc15a..5941155d3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/DecoratedStringGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -64,6 +64,3 @@ public interface DecoratedStringGenerator { public String finalize (String s); } - - -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java index 2903a7191..d4ce7ad43 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/FancyGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -44,7 +44,7 @@ public class FancyGenerator implements DecoratedStringGenerator { public String prepare (String s) { return s.toLowerCase(); } - + /** * Filters a string. Capitalizes all consonants. * @@ -53,22 +53,22 @@ public class FancyGenerator implements DecoratedStringGenerator { */ public String filter (String s) { - s = s.replace('a', 'A'); + s = s.replace('a', 'A'); s = s.replace('e', 'E'); - s = s.replace('i', 'I'); + s = s.replace('i', 'I'); s = s.replace('o', 'O'); s = s.replace('u', 'U'); - return s; + return s; } - + /** * Finalizes a string by adding an explanation to it. * * @param s the string to finalize * @return the finalized string */ - + public String finalize (String s) { return (s+".\n(all consonants identified)"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java index aa7d6be80..77e37f957 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Generating.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,16 +15,16 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements an instance of the Template Method design pattern. - * Attaches the template method and its implementation to the + * Attaches the template method and its implementation to the * <i>AbstractClass</i>, thereby allowing it to be an interface. * * @author Jan Hannemann @@ -33,11 +33,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; */ public aspect Generating { - + /** * Defines the implementation of the <i>TemplateMethod()</i>. * Generates a string with certain decorations. - * + * * @param s the string to be used to generate a decorated string from */ @@ -48,4 +48,3 @@ public aspect Generating { return s; } } -
\ No newline at end of file diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java index fa4d447f2..7d98cf331 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements the driver for the Template Method design pattern example.<p> * - * Intent: <i>Define the skeleton of an algorithm in an operation, deferring + * Intent: <i>Define the skeleton of an algorithm in an operation, deferring * some steps to subclasses. Template Method lets subclasses redefine certain * steps of an algorithm without changing the algorithm's structure</i><p> * - * Participating objects are <code>SimpleGenerator</code> and - * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The + * Participating objects are <code>SimpleGenerator</code> and + * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The * <i>AbstractClass</i> is <code>DecoratedStringGenerator</code>. * <p> * * In this example, the template method <code>generate(String)</code> - * modifies a string in three steps and returns the result. While the + * modifies a string in three steps and returns the result. While the * SimpleGenerator does not change the string much, the - * FancyGenerator turns the string to lowercase, then capitalizes all + * FancyGenerator turns the string to lowercase, then capitalizes all * consonants and adds an explanantion to it. * * <p><i>This is the AspectJ version.</i><p> * - * Note that <i>AbstractClass</i> is an interface. The implementation of the + * Note that <i>AbstractClass</i> is an interface. The implementation of the * template method is provided by the aspect. * * @author Jan Hannemann @@ -51,9 +51,9 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; */ public class Main { - + /** - * Implements the driver for the Template Method design + * Implements the driver for the Template Method design * pattern example.<p> * * @param args the command line parameters, unused @@ -61,10 +61,10 @@ public class Main { public static void main(String[] args) { String original = "This Is The Original String To Be Processed"; - + DecoratedStringGenerator c1 = new SimpleGenerator(); DecoratedStringGenerator c2 = new FancyGenerator(); - + System.out.println("<Original>"); System.out.println(original); System.out.println("<SimpleGenerator>"); @@ -72,4 +72,4 @@ public class Main { System.out.println("<FancyGenerator>"); System.out.println(c2.generate(original)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java index c63a93ad9..c355c7046 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/aspectj/SimpleGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a <i>ConcreteClass</i> that decorates strings by adding a + * Implements a <i>ConcreteClass</i> that decorates strings by adding a * period at the end of them. * * @author Jan Hannemann @@ -43,7 +43,7 @@ public class SimpleGenerator implements DecoratedStringGenerator { public String prepare (String s) { return s; } - + /** * Filters a string. Does nothing. * @@ -65,4 +65,4 @@ public class SimpleGenerator implements DecoratedStringGenerator { public String finalize (String s) { return s+"."; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java index 55a520687..b2c82d959 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/DecoratedStringGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Defines the interface for generating decorated strings. - * In this example, it acts as the <i>AbstractClass</i>. - * + * Defines the interface for generating decorated strings. + * In this example, it acts as the <i>AbstractClass</i>. + * * The template method is <code>generate(String)</code>, * which uses all other methods defined in this abstract class. * @@ -34,8 +34,8 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * @version 1.1, 02/17/04 */ -public abstract class DecoratedStringGenerator { - +public abstract class DecoratedStringGenerator { + /** * Decorates a string. This is the <i>TemplateMethod()</i>. * @@ -49,7 +49,7 @@ public abstract class DecoratedStringGenerator { s = finalize(s); return s; } - + /** * Prepares a string for decoration. * @@ -60,7 +60,7 @@ public abstract class DecoratedStringGenerator { public abstract String prepare (String s); /** - * Filters a string. + * Filters a string. * * @param s the string to filter * @return the filtered string @@ -74,6 +74,6 @@ public abstract class DecoratedStringGenerator { * @param s the string to finalize * @return the finalized string */ - + public abstract String finalize (String s); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java index d55129bee..00f6e3f32 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/FancyGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -33,18 +33,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; */ public class FancyGenerator extends DecoratedStringGenerator { - + /** * Prepares a string for decoration. Turns the string into lowercase. * * @param s the string to filter * @return the prepared string */ - + public String prepare (String s) { return s.toLowerCase(); } - + /** * Filters a string. Capitalizes all consonants. * @@ -53,22 +53,22 @@ public class FancyGenerator extends DecoratedStringGenerator { */ public String filter (String s) { - s = s.replace('a', 'A'); + s = s.replace('a', 'A'); s = s.replace('e', 'E'); - s = s.replace('i', 'I'); + s = s.replace('i', 'I'); s = s.replace('o', 'O'); s = s.replace('u', 'U'); - return s; + return s; } - + /** * Finalizes a string by adding an explanation to it. * * @param s the string to finalize * @return the finalized string */ - + public String finalize (String s) { return (s+".\n(all consonants capitalized)"); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java index a9245b69b..bf04d6604 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,35 +15,35 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements the driver for the Template Method design pattern example.<p> * - * Intent: <i>Define the skeleton of an algorithm in an operation, deferring + * Intent: <i>Define the skeleton of an algorithm in an operation, deferring * some steps to subclasses. Template Method lets subclasses redefine certain * steps of an algorithm without changing the algorithm's structure</i><p> * - * Participating objects are <code>SimpleGenerator</code> and - * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The + * Participating objects are <code>SimpleGenerator</code> and + * <code>FancyGenerator</code> as <i>ConcreteClass</i>es. The * <i>AbstractClass</i> is <code>DecoratedStringGenerator</code>. * <p> * * In this example, the template method <code>generate(String)</code> - * modifies a string in three steps and returns the result. While the + * modifies a string in three steps and returns the result. While the * SimpleGenerator does not change the string much, the - * FancyGenerator turns the string to lowercase, then capitalizes all + * FancyGenerator turns the string to lowercase, then capitalizes all * consonants and adds an explanantion to it. * * <p><i>This is the Java version.</i><p> * * Note that <i>AbstractClass</i> does in fact have to be an abstract - * class (as opposed to an interface), to make it possible to define + * class (as opposed to an interface), to make it possible to define * a default implementation for the template method. * * @author Jan Hannemann @@ -54,18 +54,18 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; public class Main { /** - * Implements the driver for the Template Method design + * Implements the driver for the Template Method design * pattern example.<p> * * @param args the command line parameters, unused */ - + public static void main(String[] args) { String original = "This Is The Original String To Be Processed"; - + DecoratedStringGenerator c1 = new SimpleGenerator(); DecoratedStringGenerator c2 = new FancyGenerator(); - + System.out.println("<Original>"); System.out.println(original); System.out.println("<SimpleGenerator>"); @@ -73,4 +73,4 @@ public class Main { System.out.println("<FancyGenerator>"); System.out.println(c2.generate(original)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java index 425dcc9cd..1e82b7ba8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/templateMethod/java/SimpleGenerator.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.templateMethod.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a <i>ConcreteClass</i> that decorates strings by adding a + * Implements a <i>ConcreteClass</i> that decorates strings by adding a * period at the end of them. * * @author Jan Hannemann @@ -43,7 +43,7 @@ public class SimpleGenerator extends DecoratedStringGenerator { public String prepare (String s) { return s; } - + /** * Filters a string. Does nothing. * @@ -54,7 +54,7 @@ public class SimpleGenerator extends DecoratedStringGenerator { public String filter (String s) { return s; } - + /** * Finalizes a string by adding a period to it. * @@ -65,4 +65,4 @@ public class SimpleGenerator extends DecoratedStringGenerator { public String finalize (String s) { return s+"."; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java index 24dad0e39..0bb20cfb5 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeLeaf.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a + * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a * terminal binary tree element (leaf). * * @author Jan Hannemann @@ -38,24 +38,24 @@ public class BinaryTreeLeaf implements Visitable { */ protected int value; - + /** * Creates a new Leaf with the given value. * * @param value the value of the leaf */ - + public BinaryTreeLeaf(int value) { this.value = value; - } - - /** + } + + /** * Accessor for the leaf's value * * @return the leaf's value */ - + public int getValue() { return value; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java index 84b87122c..f6871a6ba 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/BinaryTreeNode.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -76,4 +76,4 @@ public class BinaryTreeNode implements Visitable { this.left = left; this.right = right; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java index 938f50f03..5966dc7c0 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,41 +15,41 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the driver for the Visitor design pattern example.<p> + * Implements the driver for the Visitor design pattern example.<p> * - * Intent: <i>Represents an operation to be performed on the elements of an + * Intent: <i>Represents an operation to be performed on the elements of an * object structure. Visitor lets you define a new operation without changing * the classes of the elements on which it operates</i><p> * - * Participating classes are <code>SummationVisitor</code> and - * <code>TraversalVisitor</code> as <i>ConcreteVisitor</i>s, implementing the + * Participating classes are <code>SummationVisitor</code> and + * <code>TraversalVisitor</code> as <i>ConcreteVisitor</i>s, implementing the * <code>VisitorProtocol.Visitor</code> interface. <BR> - * - * <code>BinaryTreeNode</code> and <code>BinaryTreeLeaf</code> are + * + * <code>BinaryTreeNode</code> and <code>BinaryTreeLeaf</code> are * <i>ConcreteElement</i>s, implementing the <code>Visitable</code> interface. * <p> * - * In this example, a binary tree that has int values as leafs is built. - * SummationVisitor is a <i>Visitor</i> that collects the sum of - * elements in the leafs (should be 6). - * - * TraversalVisitor is a <i>Visitor</i> that + * In this example, a binary tree that has int values as leafs is built. + * SummationVisitor is a <i>Visitor</i> that collects the sum of + * elements in the leafs (should be 6). + * + * TraversalVisitor is a <i>Visitor</i> that * collects a description of the tree like {{1,2},3} * * <p><i>This is the AspectJ version.</i><p> * * Note that <UL> - * <LI> Every visitor (even the inteface) has to know of each possible element - * type in the object structure. - * <LI> Nodes need not to know of the visitor interface; + * <LI> Every visitor (even the inteface) has to know of each possible element + * type in the object structure. + * <LI> Nodes need not to know of the visitor interface; * </UL> * * @author Jan Hannemann @@ -57,47 +57,47 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * @version 1.1, 02/17/04 */ -public class Main { - +public class Main { + /** - * Implements the driver for the Visitor design pattern example.<p> + * Implements the driver for the Visitor design pattern example.<p> * * @param args the command-line parameters, unused */ - public static void main(String[] args) { - + public static void main(String[] args) { + System.out.println("Building the tree (1): leaves"); - + BinaryTreeLeaf one = new BinaryTreeLeaf(1); BinaryTreeLeaf two = new BinaryTreeLeaf(2); BinaryTreeLeaf three = new BinaryTreeLeaf(3); - + System.out.println("Building the tree (1): regular nodes"); - + BinaryTreeNode regN = new BinaryTreeNode(one, two); BinaryTreeNode root = new BinaryTreeNode(regN, three); - + System.out.println("The tree now looks like this: "); System.out.println(" regN "); System.out.println(" / \\ "); System.out.println(" regN 3 "); System.out.println(" / \\ "); System.out.println(" 1 2 "); - + System.out.println("Visitor 1: SumVisitor, collects the sum of leaf"); System.out.println("values. Result should be 6."); - - SummationVisitor sumVisitor = new SummationVisitor(); + + SummationVisitor sumVisitor = new SummationVisitor(); root.accept(sumVisitor); - System.out.println(sumVisitor.report()); - + System.out.println(sumVisitor.report()); + System.out.println("Visitor 2: TraversalVisitor, collects a tree"); System.out.println("representation. Result should be {{1,2},3}."); - - TraversalVisitor traversalVisitor = new TraversalVisitor(); + + TraversalVisitor traversalVisitor = new TraversalVisitor(); root.accept(traversalVisitor); - System.out.println(traversalVisitor.report()); + System.out.println(traversalVisitor.report()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java index 928cbd90a..4aa0f7dfb 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/SummationVisitor.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol; /** - * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf + * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf * values in the tree. * * @author Jan Hannemann @@ -38,43 +38,43 @@ public class SummationVisitor implements VisitorProtocol.Visitor { /** * the colleced sum of leaf values */ - + protected int sum = 0; - + /** * Visits a non-terminal binary tree node. * * @param node the regular node */ - public void visitNode(VisitorProtocol.VisitableNode node) { + public void visitNode(VisitorProtocol.VisitableNode node) { if (node instanceof BinaryTreeNode) { - BinaryTreeNode rnode = (BinaryTreeNode) node; + BinaryTreeNode rnode = (BinaryTreeNode) node; rnode.left.accept(this); rnode.right.accept(this); } } - + /** * Visits a terminal tree node. * * @param node the leaf */ - public void visitLeaf(VisitorProtocol.VisitableNode node) { + public void visitLeaf(VisitorProtocol.VisitableNode node) { if (node instanceof BinaryTreeLeaf) { BinaryTreeLeaf leaf = (BinaryTreeLeaf) node; sum += leaf.getValue(); } } - - /** + + /** * Returns the result of the visitor's operation * * @return a string representing the sum of elemnent in the tree's leaves */ - + public String report() { return ">>> SumVisitor collected a sum of "+sum; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java index 2143cad72..eac9ecec3 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/TraversalVisitor.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -80,4 +80,4 @@ public class TraversalVisitor implements VisitorProtocol.Visitor { public String report() { return ">>> TraversalVisitor traversed the tree to: "+result; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java index cbf4e52b2..a43a6a0e4 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visitable.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -31,4 +31,3 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; */ public interface Visitable {} - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java index 17bae11fd..223c51d7b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/aspectj/Visiting.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.aspectj; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol; @@ -33,21 +33,21 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.VisitorProtocol; * @version 1.1, 02/17/04 */ -public aspect Visiting extends VisitorProtocol { - - /** +public aspect Visiting extends VisitorProtocol { + + /** * Assigns the <code>VisitableNote</code> role to <code>Visitable</code> */ declare parents: Visitable implements VisitableNode; - /** + /** * Assigns the <code>Node</code> role to <code>BinaryTreeNode</code> */ declare parents: BinaryTreeNode implements Node; - /** + /** * Assigns the <code>Leaf</code> role to <code>BinaryTreeLeaf</code> */ diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java index 38102d325..f73508769 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeLeaf.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a + * Implements a <i>ConcreteElement</i> of the aggregate strcuture. This is a * terminal binary tree element (leaf). * * @author Jan Hannemann @@ -31,41 +31,41 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * @version 1.1, 02/17/04 */ -public class BinaryTreeLeaf implements Visitable { - +public class BinaryTreeLeaf implements Visitable { + /** * the value stored in this leaf */ protected int value; - + /** * Accepts a visitor and calls <code>visitLeaf(Node) on it. * * @param visitor the NodeVisitor that is to be accepted. */ - + public void accept(BinaryTreeVisitor visitor) { visitor.visitLeaf(this); } - + /** * Creates a new <code>BinaryTreeLeaf</code> with the given value. * * @param value the value of the leaf */ - + public BinaryTreeLeaf(int value) { this.value = value; - } - - /** + } + + /** * Accessor for the leaf's value * * @return the leaf's value */ - + public int getValue() { return value; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java index 604749717..ed9768d7a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeNode.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -86,4 +86,4 @@ public class BinaryTreeNode implements Visitable { this.left = left; this.right = right; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java index 5ed0d22da..bd8e977a6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/BinaryTreeVisitor.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -30,30 +30,30 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * @author Gregor Kiczales * @version 1.1, 02/17/04 */ - -public interface BinaryTreeVisitor { - + +public interface BinaryTreeVisitor { + /** * Visits a non-terminal binary tree node. * * @param node the node to visit */ - - public void visitNode(Visitable node); + + public void visitNode(Visitable node); /** * Visits a leaf, which is a terminal tree node. * * @param node the leaf */ - + public void visitLeaf(Visitable node); - - /** + + /** * Returns the result of the visitor's operation * * @return a string describing the result of this visitor's operation. */ - + public String report(); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java index 0f336e61e..1a97fe482 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Main.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -101,4 +101,4 @@ public class Main { root.accept(traversalVisitor); System.out.println(traversalVisitor.report()); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java index 326775c1e..39b43c8a8 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/SummationVisitor.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf + * Implements a <i>ConcreteVisitor</i> that collects the sum of all leaf * values in the tree. * * @author Jan Hannemann @@ -32,43 +32,43 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; */ public class SummationVisitor implements BinaryTreeVisitor { - + /** * the colleced sum of leaf values */ - + protected int sum = 0; - + /** * Visits a non-terminal binary tree node. * * @param node the regular node */ - + public void visitNode(Visitable node) { - BinaryTreeNode rnode = (BinaryTreeNode) node; + BinaryTreeNode rnode = (BinaryTreeNode) node; rnode.left.accept(this); rnode.right.accept(this); } - + /** * Visits a terminal tree node. * * @param node the leaf */ - + public void visitLeaf(Visitable node) { BinaryTreeLeaf leaf = (BinaryTreeLeaf) node; sum += leaf.getValue(); } - - /** + + /** * Returns the result of the visitor's operation * * @return a string representation of the sum of leaf values */ - + public String report() { return ">>> SummationVisitor collected a sum of: "+sum; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java index 24dbffb58..6f78c50b6 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/TraversalVisitor.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -32,40 +32,40 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; */ public class TraversalVisitor implements BinaryTreeVisitor { - - /** + + /** * contains the accumulated result */ - + protected String result = ""; - + /** * Visits a non-terminal binary tree node. * * @param node the regular node */ - + public void visitNode(Visitable node) { BinaryTreeNode rnode = (BinaryTreeNode) node; - result += "{"; + result += "{"; rnode.getLeft().accept(this); result += ","; rnode.getRight().accept(this); result += "}"; } - + /** * Visits a terminal tree node. * * @param node the leaf */ - + public void visitLeaf(Visitable node) { BinaryTreeLeaf leaf = (BinaryTreeLeaf) node; result += leaf.getValue(); } - - /** + + /** * Returns the result of the visitor's operation * * @return a string representing a traversal of the tree @@ -74,4 +74,4 @@ public class TraversalVisitor implements BinaryTreeVisitor { public String report() { return ">>> TraversalVisitor traversed the tree to: "+result; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java index 4db9b475d..bb6bda812 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/examples/visitor/java/Visitable.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** @@ -30,14 +30,13 @@ package ca.ubc.cs.spl.aspectPatterns.examples.visitor.java; * @version 1.1, 02/17/04 */ -public interface Visitable { - +public interface Visitable { + /** * Accepts a <i>Visitor</i>. * * @param visitor the NodeVisitor that is to be accepted. */ - + public void accept(BinaryTreeVisitor visitor); } - diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java index 752e67fb8..14dee45db 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityException.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -44,4 +44,4 @@ public class ChainOfResponsibilityException extends RuntimeException { public ChainOfResponsibilityException(String s) { super(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java index f21e0b883..a47b67fae 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ChainOfResponsibilityProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -173,4 +173,4 @@ public abstract aspect ChainOfResponsibilityProtocol { public Handler getSuccessor(Handler handler) { return ((Handler) successors.get(handler)); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java index 03867b689..87abdcfd2 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Command.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,34 +15,34 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * This interface is implemented by <i>Command</i> objects. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 */ - -public interface Command { + +public interface Command { /** * Executes the command. * * @param receiver the object this command is manipulating. */ - + public void executeCommand(CommandReceiver receiver); /** * Queries the command's executable status. This interface method is - * optional (default: all commands are excutable); a default + * optional (default: all commands are excutable); a default * implementation is provided by the abstract CommandProtocol aspect. * * @returns a boolean indicating whether the command is excutable. diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java index 0933fa84c..f73a8785b 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandInvoker.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,24 +15,24 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * This interface is used by extending aspects to say what types * can be Invokers (i.e. senders of an executeCommand() call). * This role is assigned by concrete sub-aspects of the <code>CommandProtocol * </code> pattern aspect. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see CommandProtocol */ - -public interface CommandInvoker { }
\ No newline at end of file + +public interface CommandInvoker { } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java index 11951abba..ef6258be2 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import java.util.WeakHashMap; import java.util.Collection; import java.util.LinkedList; -import java.util.Iterator; +import java.util.Iterator; import ca.ubc.cs.spl.aspectPatterns.patternLibrary.Command; import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandInvoker; @@ -33,23 +33,23 @@ import ca.ubc.cs.spl.aspectPatterns.patternLibrary.CommandReceiver; /** * This is the abstract <i>Command</i> protocol. - * + * * Note that this implementation allows only for exactly one command per * invoker. That is usually sufficient, but alternate implementations - * could account for multiple commands by using composite + * could account for multiple commands by using composite * (macro) commands (either with or without defined order). - * - * To allow for some flexibility, commands can either be explicitly + * + * To allow for some flexibility, commands can either be explicitly * set or removed by <i>Client</i>s, or this can be done via - * pointcuts. - * + * pointcuts. + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 */ -public abstract aspect CommandProtocol { - +public abstract aspect CommandProtocol { + //////////////////////////////// // Invoker -> Command mapping // //////////////////////////////// @@ -57,43 +57,43 @@ public abstract aspect CommandProtocol { /** * stores the mapping between CommandInvokers and Commands */ - + private WeakHashMap mappingInvokerToCommand = new WeakHashMap(); - + /** * Sets a new command for an invoker * * @param invoker the object which will invoke the command * @param command the command to be set * @return the former command - */ - - public Object setCommand(CommandInvoker invoker, Command command) { - return mappingInvokerToCommand.put(invoker, command); + */ + + public Object setCommand(CommandInvoker invoker, Command command) { + return mappingInvokerToCommand.put(invoker, command); } - + /** * Removes a command from an invoker * * @param invoker the object which will no longer invoke the command * @param command the command to be removed * @return the former command - */ - - public Object removeCommand(CommandInvoker invoker) { - return setCommand(invoker, null); + */ + + public Object removeCommand(CommandInvoker invoker) { + return setCommand(invoker, null); } /** * Returns the command for an invoker * - * @param invoker the object for which to return the command + * @param invoker the object for which to return the command * @return the current command for the invoker - */ - - public Command getCommand(CommandInvoker invoker) { - return (Command) mappingInvokerToCommand.get(invoker); + */ + + public Command getCommand(CommandInvoker invoker) { + return (Command) mappingInvokerToCommand.get(invoker); } @@ -104,31 +104,31 @@ public abstract aspect CommandProtocol { /** * stores the mapping between Coammnds and Receivers */ - + private WeakHashMap mappingCommandToReceiver = new WeakHashMap(); - + /** * Sets a new receiver for a command * * @param command the command to be set - * @param receiver the object to be manipulated by the command's + * @param receiver the object to be manipulated by the command's * execute() method * @return the former receiver - */ - - public Object setReceiver(Command command, CommandReceiver receiver) { - return mappingCommandToReceiver.put(command, receiver); + */ + + public Object setReceiver(Command command, CommandReceiver receiver) { + return mappingCommandToReceiver.put(command, receiver); } - + /** * Returns the receiver for a particular command * - * @param invoker the object for which to return the command + * @param invoker the object for which to return the command * @returns the current command for the invoker - */ - - public CommandReceiver getReceiver(Command command) { - return (CommandReceiver) mappingCommandToReceiver.get(command); + */ + + public CommandReceiver getReceiver(Command command) { + return (CommandReceiver) mappingCommandToReceiver.get(command); } @@ -148,12 +148,12 @@ public abstract aspect CommandProtocol { /** - * Calls <code>executeCommand()</code> when the command is triggered. + * Calls <code>executeCommand()</code> when the command is triggered. * * @param invoker the object invoking the command - */ - - after(CommandInvoker invoker): commandTrigger(invoker) { + */ + + after(CommandInvoker invoker): commandTrigger(invoker) { Command command = getCommand(invoker); if (command != null) { CommandReceiver receiver = getReceiver(command); @@ -162,7 +162,7 @@ public abstract aspect CommandProtocol { // Do nothing: This Invoker has no associated command } } - + ////////////////////////////////// // setCommand() via PC & advice // @@ -172,7 +172,7 @@ public abstract aspect CommandProtocol { * The join points after which to set a command for an invoker. * This replaces the normally scattered <i>Invoker.add(Command)</i> calls. * The pointcut is provided in addition to the setCommand() method above, - * to allow all pattern code to be removed from concrete invokers. + * to allow all pattern code to be removed from concrete invokers. * * This PC is non-abstract, to make it optional for sub-aspcects to define * it. @@ -181,23 +181,23 @@ public abstract aspect CommandProtocol { * @param command the command to be attached to the invoker */ - protected pointcut setCommandTrigger(CommandInvoker invoker, Command command); + protected pointcut setCommandTrigger(CommandInvoker invoker, Command command); /** - * Calls <code>addCommand()</code> when a command should be set. + * Calls <code>addCommand()</code> when a command should be set. * * @param invoker the invoker to attach the command to * @param command the command to be attached to the invoker - */ - - after (CommandInvoker invoker, Command command): - setCommandTrigger(invoker, command) { + */ + + after (CommandInvoker invoker, Command command): + setCommandTrigger(invoker, command) { if (invoker != null) { setCommand(invoker, command); } else { - // If the invoker is null, the command cannot be set. - // Either ignore this case or throw an exception + // If the invoker is null, the command cannot be set. + // Either ignore this case or throw an exception } } @@ -209,9 +209,9 @@ public abstract aspect CommandProtocol { * The join points after which to remove a command from an invoker. * This replaces the normally scattered <code>Invoker.remove(Command) * </code> calls. - * + * * The pointcut is provided in addition to the <code>removeCommand() - * </code> method above, to allow all pattern code to be removed from + * </code> method above, to allow all pattern code to be removed from * concrete invokers. * * This PC is non-abstract, to make it optional for sub-aspcects to define @@ -220,20 +220,20 @@ public abstract aspect CommandProtocol { * @param invoker the invoker to remove the command from */ - protected pointcut removeCommandTrigger(CommandInvoker invoker); - + protected pointcut removeCommandTrigger(CommandInvoker invoker); + /** - * Calls <code>removeCommand()</code> when a command should be removed. + * Calls <code>removeCommand()</code> when a command should be removed. * * @param invoker the invoker to remove the command from - */ - - after(CommandInvoker invoker): removeCommandTrigger(invoker) { + */ + + after(CommandInvoker invoker): removeCommandTrigger(invoker) { if (invoker != null) { removeCommand(invoker); } else { - // If the invoker is null, the command cannot be removed. - // Either ignore this case or throw an exception + // If the invoker is null, the command cannot be removed. + // Either ignore this case or throw an exception } } @@ -243,13 +243,13 @@ public abstract aspect CommandProtocol { /** * Provides a deault implementation for the isExecutable method defined - * in the Command interface. + * in the Command interface. * * @return true (default implementation). Can be overwritten by concrete * aspects or even concrete commands. - */ + */ public boolean Command.isExecutable() { return true; - } + } } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java index 0a7f8e458..1de2006af 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CommandReceiver.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,25 +15,25 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + /** * This interface is used by extending aspects to say what types * can be Receivers (i.e. manipulated by a command object receiving an * executeCommand() call). * This role is assigned by concrete sub-aspects of the <code>CommandProtocol * </code> pattern aspect. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - * + * * @see CommandProtocol */ - -public interface CommandReceiver { }
\ No newline at end of file + +public interface CommandReceiver { } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java index bab9e74dc..490abb937 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/CompositeProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,25 +15,25 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import java.util.Enumeration; import java.util.WeakHashMap; -import java.util.Vector; +import java.util.Vector; /** - * Defines the abstract Composite design pattern.<p> - * + * Defines the abstract Composite design pattern.<p> + * * It maintains the mapping between composites and their children, defines the * Component, Composite, and Leaf roles, and implements facilities to * implements methods that work on the whole aggregate structure. * - * <p><i>This is the AspectJ version.</i><p> + * <p><i>This is the AspectJ version.</i><p> * * Each concrete subaspect does the following things: <UL> * <LI> Defines which classes are Components and Leafs @@ -46,14 +46,14 @@ import java.util.Vector; * @version 1.1, 02/06/04 */ -public abstract aspect CompositeProtocol { - +public abstract aspect CompositeProtocol { + /** - * Defines the Component role. The role is public to allow clients to + * Defines the Component role. The role is public to allow clients to * handle objects of that type. */ - - public interface Component {} + + public interface Component {} /** * Defines the Composite role. Composites are Components that can have @@ -62,7 +62,7 @@ public abstract aspect CompositeProtocol { */ protected interface Composite extends Component {} - + /** * Defines the Leaf role. Leafs are Components that can not have * children. This role is only used within the pattern context, thus it @@ -70,14 +70,14 @@ public abstract aspect CompositeProtocol { */ protected interface Leaf extends Component {} - + /** * stores the mapping between components and their children - */ + */ private WeakHashMap perComponentChildren = new WeakHashMap(); - /** + /** * Returns a vector of the children of the argument component */ @@ -89,16 +89,16 @@ public abstract aspect CompositeProtocol { } return children; } - + /** * Client-accessible method to add a new child to a composite * * @param composite the composite to add a new child to * @param component the new child to add */ - - public void addChild(Composite composite, Component component) { - getChildren(composite).add(component); + + public void addChild(Composite composite, Component component) { + getChildren(composite).add(component); } /** @@ -108,63 +108,63 @@ public abstract aspect CompositeProtocol { * @param component the child to remove */ - public void removeChild(Composite composite, Component component) { - getChildren(composite).remove(component); + public void removeChild(Composite composite, Component component) { + getChildren(composite).remove(component); } - + /** - * Client-accessible method to get an Enumeration of all children of + * Client-accessible method to get an Enumeration of all children of * a composite * * @param composite the composite to add a new child to * @param component the new child to add */ - public Enumeration getAllChildren(Component c) { - return getChildren(c).elements(); + public Enumeration getAllChildren(Component c) { + return getChildren(c).elements(); } - /** - * Defines an interface for visitors that operate on the composite + /** + * Defines an interface for visitors that operate on the composite * structure. These visitors are implemented by concrete sub-aspects * and used in the <code>recurseOperation(Component, Visitor)</code> * method. This construct is needed to allow for method forwarding: * A composite that receives a method forwards the request to all its * children. */ - - protected interface Visitor { - + + protected interface Visitor { + /** * Generic method that performs an unspecified operation on compoennts * * @param c the component to perform the operation on */ - + public void doOperation(Component c); } - /** - * Implements the method-forwarding logic: If a method is to be applied + /** + * Implements the method-forwarding logic: If a method is to be applied * to the aggregate structure, each composite forwards it to its children * * @param c the current component * @param v the visitor representing the operation to be performed */ - public void recurseOperation(Component c, Visitor v) { // This implements the logic that Composites forward + public void recurseOperation(Component c, Visitor v) { // This implements the logic that Composites forward for (Enumeration enum = getAllChildren(c); enum.hasMoreElements(); ) { // method calls to their children Component child = (Component) enum.nextElement(); v.doOperation(child); } } - - - - /** - * Defines an interface for visitors that operate on the composite + + + + /** + * Defines an interface for visitors that operate on the composite * structure. These visitors are implemented by comcrete sub-aspects * and used in the <code>recurseOperation(Component, Visitor)<>/code> * method. This construct is needed to allow for method forwarding: @@ -173,22 +173,22 @@ public abstract aspect CompositeProtocol { * * This version allows for a return value of Object type. For some odd * reason AJDT complains if this type is declared protected (as it should - * be). Note that Visitor above works fine as protected. + * be). Note that Visitor above works fine as protected. */ public interface FunctionVisitor { - + /** * Generic method that performs an unspecified operation on components * * @param c the component to perform the operation on */ - + public Object doFunction(Component c); } - - /** - * Implements the method-forwarding logic: If a method is to be applied + + /** + * Implements the method-forwarding logic: If a method is to be applied * to the aggregate structure, each composite forwards it to its children. * This version allows for a return value of Object type, effectively * enableing collecting aggregate results on the composite structure. @@ -204,6 +204,5 @@ public abstract aspect CompositeProtocol { results.add(fv.doFunction(child)); } return results.elements(); - } -} - + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java index 9092d9675..d482e95ee 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/FlyweightProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,42 +15,42 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ - + import java.util.Hashtable; /** - * Implements a the abstracted Flyweight design pattern. Included is the + * Implements a the abstracted Flyweight design pattern. Included is the * general creation-on-demand logic. Concrete subaspects are used to * defines the actual <i>FlyweightFactories</i>. * * Concrete subaspects need only to assign the flyweight roles and to * overwrite the <code>createFlyweight(Object)<code> method. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/11/04 */ public abstract aspect FlyweightProtocol { - - /** + + /** * stores the existing <i>Flyweight</i> by key */ private Hashtable flyweights = new Hashtable(); - /** + /** * defines the <i>Flyweight</i> role. */ protected interface Flyweight{}; - + /** * Creates a <i>Flyweight</i> for a given key. This method is called by * <code>getFlyweight(Object)</code> if the flyweight does not already @@ -61,10 +61,10 @@ public abstract aspect FlyweightProtocol { */ protected abstract Flyweight createFlyweight(Object key); - + /** * Returns the <i>Flyweight</i> for a particular key. - * If the appropriate <i>Flyweight</i> does not yet exist, it is created + * If the appropriate <i>Flyweight</i> does not yet exist, it is created * on demand. * * @param key the key identifying the particular <i>Flyweight</i> @@ -76,8 +76,8 @@ public abstract aspect FlyweightProtocol { return (Flyweight) flyweights.get(key); } else { Flyweight flyweight = createFlyweight(key); - flyweights.put(key, flyweight); + flyweights.put(key, flyweight); return flyweight; } } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java index b676ed98b..831e26d55 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MediatorProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.WeakHashMap; @@ -41,19 +41,19 @@ import java.util.Iterator; * * <li> what operations on the <i>Colleague</i> trigger <i>Mediator</i> * updates.<br> - * This is done by concretizing the <code>change(Colleague)</code> + * This is done by concretizing the <code>change(Colleague)</code> * pointcut * * <li> how to mediate <br> * this is done by concretizing - * <code>notifyMediator(Colleague, Mediator)</code> + * <code>notifyMediator(Colleague, Mediator)</code> * </ol> * * Note that in this implementation, the work of updating is a method * on the sub-aspect, not a method introduced on the <i>Mediator</i>. This * allows one class of object to be the <i>Mediator</i> in different kinds of * mediation relationships, each of which has a different updating - * behavior. + * behavior. * * @author Jan Hannemann * @author Gregor Kiczales @@ -62,19 +62,19 @@ import java.util.Iterator; public abstract aspect MediatorProtocol { - + /** * Declares the Colleague role. * Roles are modeled as (empty) interfaces. */ - - protected interface Colleague { } + + protected interface Colleague { } /** * Declares the <code>Mediator</code> role. * Roles are modeled as (empty) interfaces. */ - + protected interface Mediator { } /** @@ -82,12 +82,12 @@ public abstract aspect MediatorProtocol { * Mediator</i>s. For each <i>Colleague</i>, its <i>Mediator</i> * is stored. */ - + private WeakHashMap mappingColleagueToMediator = new WeakHashMap(); /** - * Returns the <i>Mediator</i> of + * Returns the <i>Mediator</i> of * a particular <i>Colleague</i>. Used internally. * * @param colleague the <i>Colleague</i> for which to return the mediator @@ -95,21 +95,21 @@ public abstract aspect MediatorProtocol { */ private Mediator getMediator(Colleague colleague) { - Mediator mediator = + Mediator mediator = (Mediator) mappingColleagueToMediator.get(colleague); return mediator; } - + /** - * Sets the <i>Mediator</i> for a <i>Colleague</i>. This is a method - * on the pattern aspect, not on any of the participants. + * Sets the <i>Mediator</i> for a <i>Colleague</i>. This is a method + * on the pattern aspect, not on any of the participants. * * @param colleague the <i>Colleague</i> to set a new <i>Mediator</i> for * @param mediator the new <i>Mediator</i> to set - */ - - public void setMediator(Colleague colleague, Mediator mediator) { - mappingColleagueToMediator.put(colleague, mediator); + */ + + public void setMediator(Colleague colleague, Mediator mediator) { + mappingColleagueToMediator.put(colleague, mediator); } @@ -125,8 +125,8 @@ public abstract aspect MediatorProtocol { /** * Call updateObserver to update each observer. - */ - + */ + after(Colleague c): change(c) { notifyMediator(c, getMediator(c)); } @@ -136,7 +136,7 @@ public abstract aspect MediatorProtocol { * to a <code>Colleague</code> occurs. To be concretized by sub-aspects. * * @param c the <i>Colleague</i> on which a change of interest occured - * @param m the <i>Mediator</i> to be notifed of the change + * @param m the <i>Mediator</i> to be notifed of the change */ protected abstract void notifyMediator(Colleague c, Mediator m); diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java index 0acf0b5e5..3703610b9 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/Memento.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,37 +15,37 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Declares the methods for setting and getting the state for <i>Memento</i>s. - * + * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/12/04 */ -public interface Memento { +public interface Memento { /** * Sets the state of this <i>Memento</i> give the passed state. - * - * + * + * * @param state the state to store */ - + public void setState(Object state); /** * Returns the state of this <i>Memento</i> give the passed originator. - * + * * @return the state stored by this <i>Memento</i> */ - public Object getState(); + public Object getState(); } diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java index 8c361ed81..582919cfc 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoException.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,15 +15,15 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements an exception that occurs if an incorrect <i>Originator</i> is used + * Implements an exception that occurs if an incorrect <i>Originator</i> is used * * @author Jan Hannemann * @author Gregor Kiczales @@ -32,15 +32,15 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * @see MementoProtocol */ -public class MementoException extends RuntimeException { +public class MementoException extends RuntimeException { /** * Creates a MementoException * - * @param s the error message + * @param s the error message */ - + public MementoException(String s) { super(s); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java index 7697a0f58..ac328e1e1 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/MementoProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the abstract Memento design pattern. It defines the role of + * Implements the abstract Memento design pattern. It defines the role of * <i>Originator</i>. The <i>Memento</i> role is client-usable and as such - * defined outside this aspect. + * defined outside this aspect. * * Concrete sub-aspects overwrite the two abstract methods to define how * <i>Memento</i>s get generated and how they are used to restore the state @@ -35,14 +35,14 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * @author Gregor Kiczales * @version 1.1, 02/12/04 */ - + public abstract aspect MementoProtocol { - + /** * Defines the <i>Originator</i> type. Used only internally. */ - protected interface Originator {} + protected interface Originator {} /** * Creates a <i>Memento</i> object for an <i>Originator</i> @@ -50,11 +50,11 @@ public abstract aspect MementoProtocol { * @param o the <i>Originator</i> to create a <i>Memento</i> for * @return the <i>Memento</i> storing the originator's state */ - + public abstract Memento createMementoFor(Originator o); - + /** - * Restores this <i>Originator</i> to a former state encapsulated in the + * Restores this <i>Originator</i> to a former state encapsulated in the * <i>Memento</i> passed * * @param o the <i>Originator</i> to restore @@ -62,4 +62,4 @@ public abstract aspect MementoProtocol { */ public abstract void setMemento(Originator o, Memento m); -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java index da403022b..7ad37461e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ObserverProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.WeakHashMap; @@ -44,7 +44,7 @@ import java.util.Iterator; * * <li> how to update the observers <br> * this is done by defining a method on - * updateObserver(Subject, Observer) + * updateObserver(Subject, Observer) * </ol> * * Note that in this implementation, the work of updating is a method @@ -59,16 +59,16 @@ import java.util.Iterator; * @author Gregor Kiczales * @version 1.1, 02/13/04 */ - -public abstract aspect ObserverProtocol { - - + +public abstract aspect ObserverProtocol { + + /** * This interface is used by extending aspects to say what types * can be <i>Subject</i>s. It models the <i>Subject</i> role. */ - protected interface Subject { } + protected interface Subject { } /** @@ -84,19 +84,19 @@ public abstract aspect ObserverProtocol { * Observer</i>s. For each <i>Subject</i>, a <code>LinkedList</code> * is of its <i>Observer</i>s is stored. */ - + private WeakHashMap perSubjectObservers; /** - * Returns a <code>Collection</code> of the <i>Observer</i>s of + * Returns a <code>Collection</code> of the <i>Observer</i>s of * a particular subject. Used internally. * * @param subject the <i>subject</i> for which to return the <i>Observer</i>s * @return a <code>Collection</code> of s's <i>Observer</i>s */ - protected List getObservers(Subject subject) { + protected List getObservers(Subject subject) { if (perSubjectObservers == null) { perSubjectObservers = new WeakHashMap(); } @@ -108,42 +108,42 @@ public abstract aspect ObserverProtocol { return observers; } - + /** * Adds an <i>Observer</i> to a <i>Subject</i>. This is the equivalent of <i> - * attach()</i>, but is a method on the pattern aspect, not the - * <i>Subject</i>. + * attach()</i>, but is a method on the pattern aspect, not the + * <i>Subject</i>. * * @param s the <i>Subject</i> to attach a new <i>Observer</i> to * @param o the new <i>Observer</i> to attach - */ - - public void addObserver(Subject subject, Observer observer) { - getObservers(subject).add(observer); + */ + + public void addObserver(Subject subject, Observer observer) { + getObservers(subject).add(observer); } - + /** * Removes an observer from a <i>Subject</i>. This is the equivalent of <i> - * detach()</i>, but is a method on the pattern aspect, not the <i>Subject</i>. + * detach()</i>, but is a method on the pattern aspect, not the <i>Subject</i>. * * @param s the <i>Subject</i> to remove the <i>Observer</i> from * @param o the <i>Observer</i> to remove - */ - - public void removeObserver(Subject subject, Observer observer) { - getObservers(subject).remove(observer); + */ + + public void removeObserver(Subject subject, Observer observer) { + getObservers(subject).remove(observer); } /** * The join points after which to do the update. * It replaces the normally scattered calls to <i>notify()</i>. To be * concretized by sub-aspects. - */ - + */ + protected abstract pointcut subjectChange(Subject s); /** - * Calls <code>updateObserver(..)</code> after a change of interest to + * Calls <code>updateObserver(..)</code> after a change of interest to * update each <i>Observer</i>. * * @param subject the <i>Subject</i> on which the change occured @@ -154,14 +154,14 @@ public abstract aspect ObserverProtocol { while ( iter.hasNext() ) { updateObserver(subject, ((Observer)iter.next())); } - } - + } + /** * Defines how each <i>Observer</i> is to be updated when a change * to a <i>Subject</i> occurs. To be concretized by sub-aspects. * * @param subject the <i>Subject</i> on which a change of interest occured - * @param observer the <i>Observer</i> to be notifed of the change + * @param observer the <i>Observer</i> to be notifed of the change */ protected abstract void updateObserver(Subject subject, Observer observer); diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java index 79ef7cd56..35dec7597 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/PrototypeProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,58 +15,58 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** * Implements the abstract Prototype design pattern. It attaches a default * <code>clone()</code> method on all <i>Prototype</i> participants and * provides a static <code>cloneObject(Prototype)</clone> method. The default - * implementation of that method is to try to use the <code>clone()</code> + * implementation of that method is to try to use the <code>clone()</code> * method and, failing that, to call its protected <code> - * createCloneFor(Prototype)</code> method. Concrete subaspects can either + * createCloneFor(Prototype)</code> method. Concrete subaspects can either * overwrite none or one (or both) of the methods to tailor their * particular design pattern instance to its individual needs * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/13/04 - */ + */ + +public abstract aspect PrototypeProtocol { -public abstract aspect PrototypeProtocol { - /** * Defines the <i>Prototype</i> role. */ - + protected interface Prototype {} - + /** * Attaches a default <code>clone()</code> method to all prototypes. * This makes use of Java's clone() mechanism that creates a deep copy * of the object in question. - * + * * @return a copy of the object */ - public Object Prototype.clone() throws CloneNotSupportedException { + public Object Prototype.clone() throws CloneNotSupportedException { return super.clone(); } - + /** * Provides a static default aspect method for cloning prototypes. * It uses the attached clone() method if possible. If not, it calls the * static <code>createCloneFor(Prototype)</code> method. - * + * * @param object the prototype object to clone * @return a copy of the object */ - - + + public Object cloneObject(Prototype object) { try { return object.clone(); @@ -74,18 +74,18 @@ public abstract aspect PrototypeProtocol { return createCloneFor(object); } } - + /** * Provides an alternative method for cases when the default - * <code>clone()</code> method fails. This method can be + * <code>clone()</code> method fails. This method can be * overwritten by concrete subaspects. In this default implementation * it return null. - * + * * @param object the prototype object to clone * @return a copy of the object, but null in this case */ - protected Object createCloneFor(Prototype object) { + protected Object createCloneFor(Prototype object) { return null; } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java index 856a681a9..3d3b87a3f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/ProxyProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,17 +15,17 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ -import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.JoinPoint; /** - * Defines the abstracted Proxy design pattern.<p> + * Defines the abstracted Proxy design pattern.<p> * * Concrete sub-aspects define the following: <UL> * <LI> Which class(es) are <i>RealSubject</i>s @@ -38,78 +38,78 @@ import org.aspectj.lang.JoinPoint; * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/17/04 - */ - -public abstract aspect ProxyProtocol { - + */ + +public abstract aspect ProxyProtocol { + /** * Defines the Subject role (used for correct typing) */ - - protected interface Subject {} - + + protected interface Subject {} + /** - * Captures all accesses to the subject that should be covered by + * Captures all accesses to the subject that should be covered by * this pattern instance. */ - - protected abstract pointcut requests(); - - /** - * Extends the <code>requests()</code> pointcut to include a + + protected abstract pointcut requests(); + + /** + * Extends the <code>requests()</code> pointcut to include a * field for the joinpoint. Used internally only. */ - - private pointcut requestsByCaller(Object caller): + + private pointcut requestsByCaller(Object caller): requests() && this(caller); /** - * Intercepts accesses to protected parts of the OutputSubject. - * If access is proxy protected, the method + * Intercepts accesses to protected parts of the OutputSubject. + * If access is proxy protected, the method * <code>handleProxyProtection(..)</code> is called instead. * * @param caller the object responsible for the protected access * @param subject the subject receiving the call */ - Object around(Object caller, Subject subject): - requestsByCaller(caller) && target(subject) { - + Object around(Object caller, Subject subject): + requestsByCaller(caller) && target(subject) { + if (! isProxyProtected(caller, subject, thisJoinPoint) ) - return proceed(caller, subject); + return proceed(caller, subject); return handleProxyProtection(caller, subject, thisJoinPoint); - } - + } + /** * Checks whether the request should be handled by the Proxy or not * * @param caller the object responsible for the protected access - * @param subject the subject receiving the call + * @param subject the subject receiving the call * @param joinPoint the joinpoint associated with the protected access * * @return true if the access is covered by the proxy, false otherwise */ - - protected abstract boolean isProxyProtected(Object caller, - Subject subject, + + protected abstract boolean isProxyProtected(Object caller, + Subject subject, JoinPoint joinPoint); /** - * For delegation: Provides an alternative return value if access - * is proxy protected. A default implementation is supplied so that + * For delegation: Provides an alternative return value if access + * is proxy protected. A default implementation is supplied so that * concrete subaspects are not forced to implement the method. * * @param caller the object responsible for the proxy protected access - * @param subject the subject receiving the call - * @param joinPoint the joinpoint associated with the proxy protected + * @param subject the subject receiving the call + * @param joinPoint the joinpoint associated with the proxy protected * access * * @return an alternative return value */ - protected Object handleProxyProtection(Object caller, - Subject subject, + protected Object handleProxyProtection(Object caller, + Subject subject, JoinPoint joinPoint) { - return null; + return null; } -} +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java index fddd603da..e6042669f 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/SingletonProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,11 +15,11 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ import java.util.Hashtable; @@ -47,15 +47,15 @@ import java.util.Hashtable; * @author Gregor Kiczales * @version 1.1, 02/18/04 */ - + public abstract aspect SingletonProtocol { - + /** * stores the <i>Singleton</i> instances */ - - private Hashtable singletons = new Hashtable(); - + + private Hashtable singletons = new Hashtable(); + /** * Defines the <i>Singleton</i> role. It is realized as <code>public * </code> to allow for more flexibility (i.e., alternatively, types @@ -64,30 +64,30 @@ public abstract aspect SingletonProtocol { */ public interface Singleton {} - + /** * Placeholder for exceptions to the <i>Singleton</i>'s constructor - * protection. For example, non-singleton subclasses may need to + * protection. For example, non-singleton subclasses may need to * access the protected constructor of the <i>Singleton</i> normally. - * + * * An alternative implementation would be to define an interface * for singleton exceptions similar to the one above. */ - + protected pointcut protectionExclusions(); /** * Protects the <i>Singleton</i>'s constructor. Creates the unique * instance on demant and returns it instead of a new object. - * - * @return the singleton instance + * + * @return the singleton instance */ - - Object around(): call((Singleton+).new(..)) && !protectionExclusions() { - Class singleton = thisJoinPoint.getSignature().getDeclaringType(); + + Object around(): call((Singleton+).new(..)) && !protectionExclusions() { + Class singleton = thisJoinPoint.getSignature().getDeclaringType(); if (singletons.get(singleton) == null) { // How to access the static instance variable here? - singletons.put(singleton, proceed()); + singletons.put(singleton, proceed()); } return singletons.get(singleton); - } -}
\ No newline at end of file + } +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java index 0e3291460..53aa7eb4e 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/StrategyProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -17,7 +17,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ @@ -84,4 +84,4 @@ public abstract aspect StrategyProtocol { public Strategy getConcreteStrategy(Context c) { return (Strategy) strategyPerContext.get(c); } -}
\ No newline at end of file +} diff --git a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java index b1c30546c..c27ae9c3a 100644 --- a/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java +++ b/docs/sandbox/ubc-design-patterns/src/ca/ubc/cs/spl/aspectPatterns/patternLibrary/VisitorProtocol.java @@ -7,7 +7,7 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at - * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * either https://www.mozilla.org/MPL/ or https://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License @@ -15,27 +15,27 @@ package ca.ubc.cs.spl.aspectPatterns.patternLibrary; * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. - * + * * For more details and the latest version of this code, please see: - * http://www.cs.ubc.ca/labs/spl/projects/aodps.html + * https://www.cs.ubc.ca/labs/spl/projects/aodps.html * - * Contributor(s): + * Contributor(s): */ /** - * Implements the abstracted Visitor design pattern.<p> + * Implements the abstracted Visitor design pattern.<p> * - * Intent: <i>Represents an operation to be performed on the elements of an + * Intent: <i>Represents an operation to be performed on the elements of an * object structure. Visitor lets you define a new operation without changing * the classes of the elements on which it operates</i><p> * * Note that this implementation only deals with two different kind of nodes: - * terminal and non-terminal nodes. In cases where the aggregate structure - * contains more types of nodes, this aspect cannot be used without - * modifications. <p> + * terminal and non-terminal nodes. In cases where the aggregate structure + * contains more types of nodes, this aspect cannot be used without + * modifications. <p> * * Note further that whenever the aggregate structure is unimportant, the - * additional functionality can be added in a much sipmler using + * additional functionality can be added in a much sipmler using * AspectJ's open classes mechanism (i.e., by using inter-type declarations * to implement the desired functionality). * @@ -50,11 +50,11 @@ public abstract aspect VisitorProtocol { * Defines the <i>Element</i> role. The inerface is public so that * <i>ConcreteVisitor</i>s can use the type. */ - + public interface VisitableNode {} /** - * Defines a <i>ConcreteElement</i> role for non-terminal nodes in + * Defines a <i>ConcreteElement</i> role for non-terminal nodes in * a binary tree structure. The interface is protected as it is only used * by concrete subaspects. */ @@ -62,25 +62,25 @@ public abstract aspect VisitorProtocol { protected interface Node extends VisitableNode {} /** - * Defines a <i>ConcreteElement</i> role for terminal nodes in + * Defines a <i>ConcreteElement</i> role for terminal nodes in * a tree structure. The inerface is protected as it is only used * by concrete subaspects. */ - protected interface Leaf extends VisitableNode {} - + protected interface Leaf extends VisitableNode {} + /** - * This interface is implemented by <i>ConcreteVisitor</i>s. + * This interface is implemented by <i>ConcreteVisitor</i>s. */ - + public interface Visitor { - + /** * Defines a method signature for visiting regular nodes. * * @param node the regular node to visit */ - + public void visitNode(VisitableNode node); /** @@ -99,32 +99,32 @@ public abstract aspect VisitorProtocol { public String report(); } - + /** - * Declares <code>accept(..)</code> for visitable nodes + * Declares <code>accept(..)</code> for visitable nodes * * @param visitor the visitor that is to be accepted */ - + public void VisitableNode.accept(Visitor visitor) {} - + /** - * Declares <code>accept(..)</code> for regular nodes + * Declares <code>accept(..)</code> for regular nodes * * @param visitor the visitor that is to be accepted */ - - public void Node.accept(Visitor visitor) { - visitor.visitNode(this); + + public void Node.accept(Visitor visitor) { + visitor.visitNode(this); } - + /** - * Declares <code>accept(..)</code> for leaf nodes + * Declares <code>accept(..)</code> for leaf nodes * * @param visitor the visitor that is to be accepted */ - public void Leaf.accept(Visitor visitor) { - visitor.visitLeaf(this); + public void Leaf.accept(Visitor visitor) { + visitor.visitLeaf(this); } -}
\ No newline at end of file +} |