From 006461bff4463d476683d80dacc7ec9b66e6fc3e Mon Sep 17 00:00:00 2001 From: lokesh1990 Date: Thu, 7 Apr 2016 14:11:37 -0400 Subject: [PATCH] adding javadoc --- doc/javadoc/allclasses-frame.html | 8 +- doc/javadoc/allclasses-noframe.html | 8 +- doc/javadoc/code/game/models/MapLogger.html | 545 ++++++++++++++++++ .../code/{map => game/models}/MapModel.html | 120 ++-- .../code/game/models/class-use/MapLogger.html | 166 ++++++ .../models}/class-use/MapModel.html | 60 +- .../code/game/models/package-frame.html | 21 + .../code/game/models/package-summary.html | 150 +++++ .../code/game/models/package-tree.html | 141 +++++ doc/javadoc/code/game/models/package-use.html | 180 ++++++ doc/javadoc/code/map/MapMaker.html | 14 +- doc/javadoc/code/map/MyGuiFile.html | 29 +- doc/javadoc/code/map/NewMapDialog.html | 22 +- doc/javadoc/code/map/Util.html | 75 ++- doc/javadoc/code/map/class-use/MapMaker.html | 4 +- doc/javadoc/code/map/class-use/MyGuiFile.html | 6 +- .../code/map/class-use/NewMapDialog.html | 4 +- doc/javadoc/code/map/class-use/Util.html | 4 +- doc/javadoc/code/map/package-frame.html | 5 +- doc/javadoc/code/map/package-summary.html | 18 +- doc/javadoc/code/map/package-tree.html | 9 +- doc/javadoc/code/map/package-use.html | 9 +- doc/javadoc/code/tests/AllTests.html | 14 +- doc/javadoc/code/tests/MapLoggerTest.html | 298 ++++++++++ doc/javadoc/code/tests/MapModelTest.html | 60 +- doc/javadoc/code/tests/MyGuiFileTest.html | 24 +- .../code/tests/class-use/AllTests.html | 4 +- .../code/tests/class-use/MapLoggerTest.html | 124 ++++ .../code/tests/class-use/MapModelTest.html | 4 +- .../code/tests/class-use/MyGuiFileTest.html | 4 +- doc/javadoc/code/tests/package-frame.html | 5 +- doc/javadoc/code/tests/package-summary.html | 15 +- doc/javadoc/code/tests/package-tree.html | 5 +- doc/javadoc/code/tests/package-use.html | 4 +- doc/javadoc/constant-values.html | 4 +- doc/javadoc/deprecated-list.html | 4 +- doc/javadoc/help-doc.html | 4 +- doc/javadoc/index-files/index-1.html | 16 +- doc/javadoc/index-files/index-10.html | 31 +- doc/javadoc/index-files/index-11.html | 24 +- doc/javadoc/index-files/index-12.html | 4 +- doc/javadoc/index-files/index-13.html | 6 +- doc/javadoc/index-files/index-2.html | 10 +- doc/javadoc/index-files/index-3.html | 6 +- doc/javadoc/index-files/index-4.html | 38 +- doc/javadoc/index-files/index-5.html | 4 +- doc/javadoc/index-files/index-6.html | 25 +- doc/javadoc/index-files/index-7.html | 4 +- doc/javadoc/index-files/index-8.html | 4 +- doc/javadoc/index-files/index-9.html | 8 +- doc/javadoc/index.html | 2 +- doc/javadoc/overview-frame.html | 5 +- doc/javadoc/overview-summary.html | 10 +- doc/javadoc/overview-tree.html | 12 +- doc/javadoc/package-list | 1 + doc/javadoc/serialized-form.html | 109 +++- src/code/game/models/MapLogger.java | 2 +- src/code/game/models/MapModel.java | 3 +- src/code/map/MapMaker.java | 8 +- src/code/map/MyGuiFile.java | 16 +- src/code/map/NewMapDialog.java | 2 +- src/code/map/Util.java | 11 +- src/code/tests/AllTests.java | 6 + src/code/tests/MapLoggerTest.java | 15 +- src/code/tests/MyGuiFileTest.java | 1 - 65 files changed, 2261 insertions(+), 293 deletions(-) create mode 100644 doc/javadoc/code/game/models/MapLogger.html rename doc/javadoc/code/{map => game/models}/MapModel.html (72%) create mode 100644 doc/javadoc/code/game/models/class-use/MapLogger.html rename doc/javadoc/code/{map => game/models}/class-use/MapModel.html (55%) create mode 100644 doc/javadoc/code/game/models/package-frame.html create mode 100644 doc/javadoc/code/game/models/package-summary.html create mode 100644 doc/javadoc/code/game/models/package-tree.html create mode 100644 doc/javadoc/code/game/models/package-use.html create mode 100644 doc/javadoc/code/tests/MapLoggerTest.html create mode 100644 doc/javadoc/code/tests/class-use/MapLoggerTest.html diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html index b950bb7..cbc7948 100644 --- a/doc/javadoc/allclasses-frame.html +++ b/doc/javadoc/allclasses-frame.html @@ -2,9 +2,9 @@ - + All Classes - + @@ -13,8 +13,10 @@

All Classes

diff --git a/doc/javadoc/index-files/index-5.html b/doc/javadoc/index-files/index-5.html index 54cf2a1..eba98fd 100644 --- a/doc/javadoc/index-files/index-5.html +++ b/doc/javadoc/index-files/index-5.html @@ -2,9 +2,9 @@ - + I-Index - + diff --git a/doc/javadoc/index-files/index-6.html b/doc/javadoc/index-files/index-6.html index 06d5f05..152abc4 100644 --- a/doc/javadoc/index-files/index-6.html +++ b/doc/javadoc/index-files/index-6.html @@ -2,9 +2,9 @@ - + M-Index - + @@ -82,24 +82,37 @@

M

Main method of the class which instantiates the object and display the window to the player.
+
MapLogger - Class in code.game.models
+
+
A super class of MapModel.
+
+
MapLogger() - Constructor for class code.game.models.MapLogger
+
 
+
MapLoggerTest - Class in code.tests
+
+
This class contains test case methods for testing the log entries which are recorded in the map file and + also the details of the map such as the creation time, history of edits, etc.
+
+
MapLoggerTest() - Constructor for class code.tests.MapLoggerTest
+
 
MapMaker - Class in code.map
MapMaker class is used to create the map design after the player select the grid dimension or edit an already existing map.
-
MapMaker(MapModel, boolean, MyGuiFile) - Constructor for class code.map.MapMaker
+
MapMaker(MapModel, boolean, MyGuiFile) - Constructor for class code.map.MapMaker
Constructor method of the MapMaker class which creates and initializes the UI and display it to the player.
-
MapModel - Class in code.map
+
MapModel - Class in code.game.models
The MapModel class is the model class for the map object.
-
MapModel(String, int[][]) - Constructor for class code.map.MapModel
+
MapModel(String, int[][]) - Constructor for class code.game.models.MapModel
Constructor method of the class to create a map model from an already existing file.
-
MapModel(int, int) - Constructor for class code.map.MapModel
+
MapModel(int, int) - Constructor for class code.game.models.MapModel
Constructor method to create a new map model.
diff --git a/doc/javadoc/index-files/index-7.html b/doc/javadoc/index-files/index-7.html index 43ab815..906567f 100644 --- a/doc/javadoc/index-files/index-7.html +++ b/doc/javadoc/index-files/index-7.html @@ -2,9 +2,9 @@ - + N-Index - + diff --git a/doc/javadoc/index-files/index-8.html b/doc/javadoc/index-files/index-8.html index 0da3518..8f60d33 100644 --- a/doc/javadoc/index-files/index-8.html +++ b/doc/javadoc/index-files/index-8.html @@ -2,9 +2,9 @@ - + P-Index - + diff --git a/doc/javadoc/index-files/index-9.html b/doc/javadoc/index-files/index-9.html index 6f33ece..71ac15f 100644 --- a/doc/javadoc/index-files/index-9.html +++ b/doc/javadoc/index-files/index-9.html @@ -2,9 +2,9 @@ - + R-Index - + @@ -78,9 +78,9 @@

R

Method to read an already existing map from file and create a map model object of the read map.
-
row_input - Variable in class code.map.NewMapDialog
+
rowInput - Variable in class code.map.NewMapDialog
 
-
rSize - Variable in class code.map.MapModel
+
rSize - Variable in class code.game.models.MapModel
 
A C D G I M N P R S T U V  diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html index 92051aa..a2bcfdc 100644 --- a/doc/javadoc/index.html +++ b/doc/javadoc/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) @@ -13,6 +13,7 @@

Packages

diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html index ee410ab..6186018 100644 --- a/doc/javadoc/overview-summary.html +++ b/doc/javadoc/overview-summary.html @@ -2,9 +2,9 @@ - + Overview - + @@ -78,10 +78,14 @@ -code.map +code.game.models   +code.map +  + + code.tests   diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html index 8a8140e..1fb9275 100644 --- a/doc/javadoc/overview-tree.html +++ b/doc/javadoc/overview-tree.html @@ -2,9 +2,9 @@ - + Class Hierarchy - + @@ -73,6 +73,7 @@

Hierarchy For All Packages

Package Hierarchies: @@ -114,7 +115,12 @@

Class Hierarchy

-
  • code.map.MapModel
  • +
  • code.game.models.MapLogger (implements java.io.Serializable) +
      +
    • code.game.models.MapModel (implements java.io.Serializable)
    • +
    +
  • +
  • code.tests.MapLoggerTest
  • code.tests.MapModelTest
  • code.tests.MyGuiFileTest
  • code.map.Util
  • diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list index 6baba32..f13c38f 100644 --- a/doc/javadoc/package-list +++ b/doc/javadoc/package-list @@ -1,2 +1,3 @@ +code.game.models code.map code.tests diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html index 63ab844..07dd417 100644 --- a/doc/javadoc/serialized-form.html +++ b/doc/javadoc/serialized-form.html @@ -2,9 +2,9 @@ - + Serialized Form - + @@ -75,6 +75,79 @@

    Serialized Form

    • +

      Package code.game.models

      +
        +
      • + + +

        Class code.game.models.MapLogger extends java.lang.Object implements Serializable

        +
        +
        serialVersionUID:
        +
        8899L
        +
        +
          +
        • +

          Serialized Fields

          +
            +
          • +

            mapName

            +
            java.lang.String mapName
            +
          • +
          • +

            creationTime

            +
            java.lang.String creationTime
            +
          • +
          • +

            editHistory

            +
            java.util.ArrayList<E> editHistory
            +
          • +
          • +

            playHistory

            +
            java.util.ArrayList<E> playHistory
            +
          • +
          • +

            topFiveScores

            +
            java.util.ArrayList<E> topFiveScores
            +
          • +
          • +

            filePath

            +
            java.io.File filePath
            +
          • +
          +
        • +
        +
      • +
      • + + +

        Class code.game.models.MapModel extends MapLogger implements Serializable

        +
        +
        serialVersionUID:
        +
        8899L
        +
        +
          +
        • +

          Serialized Fields

          +
            +
          • +

            mapArray

            +
            int[][] mapArray
            +
          • +
          • +

            rSize

            +
            int rSize
            +
          • +
          • +

            cSize

            +
            int cSize
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    • Package code.map

      • @@ -90,12 +163,12 @@

        contentPane

        javax.swing.JPanel contentPane
      • -

        m_currMap

        -
        MapModel m_currMap
        +

        currMap

        +
        MapModel currMap
      • -

        panel_1

        -
        java.awt.Panel panel_1
        +

        mapPanel

        +
        java.awt.Panel mapPanel
      • panelsHolder

        @@ -138,20 +211,20 @@

        Class code.map.M

        Serialized Fields

      • @@ -170,12 +243,12 @@

        contentPanel

        javax.swing.JPanel contentPanel
      • -

        col_input

        -
        javax.swing.JSpinner col_input
        +

        colInput

        +
        javax.swing.JSpinner colInput
      • -

        row_input

        -
        javax.swing.JSpinner row_input
        +

        rowInput

        +
        javax.swing.JSpinner rowInput
      • isCompleted

        diff --git a/src/code/game/models/MapLogger.java b/src/code/game/models/MapLogger.java index d9b8742..61b68ce 100644 --- a/src/code/game/models/MapLogger.java +++ b/src/code/game/models/MapLogger.java @@ -23,7 +23,7 @@ public class MapLogger implements Serializable{ * dependency. */ private static final long serialVersionUID = 8899; - // attributes of the class goes here + // attributes for storing map details and log info private String mapName; private String creationTime; private ArrayList editHistory; diff --git a/src/code/game/models/MapModel.java b/src/code/game/models/MapModel.java index 2c34e0b..65be35e 100644 --- a/src/code/game/models/MapModel.java +++ b/src/code/game/models/MapModel.java @@ -12,7 +12,6 @@ * * @author Lokesh * @author Umer - * * @version 1.0.0.0 */ @@ -24,7 +23,7 @@ public class MapModel extends MapLogger implements Serializable{ * dependency. */ private static final long serialVersionUID = 8899; - // attributes of the class goes here + // attributes for storing the map private int[][] mapArray; public int rSize, cSize; diff --git a/src/code/map/MapMaker.java b/src/code/map/MapMaker.java index 690a618..1a9e0d2 100644 --- a/src/code/map/MapMaker.java +++ b/src/code/map/MapMaker.java @@ -42,7 +42,7 @@ @SuppressWarnings("serial") public class MapMaker extends JFrame { - // class attribute declarations + // viewer class attribute declaration private JPanel contentPane; // main container panel private MapModel currMap; // MapModel class to hold the map object private Panel mapPanel = new Panel(); // panel to hold the map grid @@ -74,16 +74,12 @@ public boolean saveToFile() { if (fileChooser.showSaveDialog(MapMaker.this) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); - // save to file - - + currMap.addEditHistory(Util.addDate("")); // write object to file - FileOutputStream fos= new FileOutputStream(file); ObjectOutputStream oos= new ObjectOutputStream(fos); - // oos.writeObject(currMap.GetMapArray()); oos.writeObject(currMap); oos.close(); fos.close(); diff --git a/src/code/map/MyGuiFile.java b/src/code/map/MyGuiFile.java index 7f9d064..d7b2d65 100644 --- a/src/code/map/MyGuiFile.java +++ b/src/code/map/MyGuiFile.java @@ -46,6 +46,10 @@ public class MyGuiFile extends JFrame { private final String DEFAULT_FILE_PATH = System.getProperty("user.dir") + "/maps"; private MapModel mapObj; + /** + * Method to expose the map model object. + * @return map model object which is currently being used by the application. + */ public MapModel getMapModelObj() { return mapObj; } /** @@ -172,7 +176,9 @@ public void actionPerformed(ActionEvent arg0) { mnNewMenu.add(mntmNewMenuItem); JMenuItem mntmNewMenuItem1 = new JMenuItem("Open "); - // action listener for the open menu item for opening a new file. + /** + * action listener for the open menu item for opening a new file. + */ mntmNewMenuItem1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -194,7 +200,9 @@ public void actionPerformed(ActionEvent e) { JMenu mnHelp = new JMenu("About"); menuBar.add(mnHelp); - // action listener for about menu item + /** + * action listener for about menu item + */ JMenuItem mntmAbout = new JMenuItem("About"); mntmAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -221,7 +229,9 @@ public void actionPerformed(ActionEvent e) { panel.add(comboBox); JButton btnNewButton = new JButton("Open File"); - // action listener for open file button to open the file selected in the combo box. + /** + * action listener for open file button to open the file selected in the combo box. + */ btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(comboBox.getItemCount() == 1 || comboBox.getSelectedItem() == null) diff --git a/src/code/map/NewMapDialog.java b/src/code/map/NewMapDialog.java index 01af227..5c3505e 100644 --- a/src/code/map/NewMapDialog.java +++ b/src/code/map/NewMapDialog.java @@ -24,7 +24,7 @@ @SuppressWarnings("serial") public class NewMapDialog extends JDialog { - // attributes of the class goes here + // attributes for handling UI outside class. private JPanel contentPanel = new JPanel(); public JSpinner colInput = new JSpinner(); public JSpinner rowInput = new JSpinner(); diff --git a/src/code/map/Util.java b/src/code/map/Util.java index cbe59af..12f6c0b 100644 --- a/src/code/map/Util.java +++ b/src/code/map/Util.java @@ -23,13 +23,20 @@ public class Util { public static final int TOOL_POINT_PATH = 2; + /** + * Method to get the current date and time as string. + * @return Returns the current date time as a string. + */ public static String getDate(){ Date date = new Date(); return date.toString(); } - /* - * @param logText for certain aspect of game + /** + * Method to add current date time to a log entry. + * + * @param logText log entry to which date time has to be added. + * @return log entry with the current date time appended to it. */ public static String addDate(String logText){ return getDate() + logText; diff --git a/src/code/tests/AllTests.java b/src/code/tests/AllTests.java index 3734683..7574bc3 100644 --- a/src/code/tests/AllTests.java +++ b/src/code/tests/AllTests.java @@ -4,6 +4,12 @@ import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; +/** + * Test suite for all the 17 test cases in the map maker project. + * + * @author lokesh + * @version 1.0.3.0 + */ @RunWith(Suite.class) @SuiteClasses({ MapLoggerTest.class, MapModelTest.class, MyGuiFileTest.class }) public class AllTests { diff --git a/src/code/tests/MapLoggerTest.java b/src/code/tests/MapLoggerTest.java index 88af59d..79028f4 100644 --- a/src/code/tests/MapLoggerTest.java +++ b/src/code/tests/MapLoggerTest.java @@ -13,6 +13,13 @@ import code.map.MyGuiFile; import code.map.Util; +/** + * This class contains test case methods for testing the log entries which are recorded in the map file and + * also the details of the map such as the creation time, history of edits, etc. + * + * @author lokesh + * @version 1.0.1.0 + */ public class MapLoggerTest { /** @@ -22,6 +29,7 @@ public class MapLoggerTest { @Test public void testMapCreatnTime() { + // create a map model object int[][] mapArray = new int[][]{ { 0, 1, 0, 0 }, { 0, 2, 0, 0}, { 0, 3, 4, 0}, @@ -38,7 +46,6 @@ public void testMapCreatnTime() { // write object to file FileOutputStream fos= new FileOutputStream(file); ObjectOutputStream oos= new ObjectOutputStream(fos); - // oos.writeObject(currMap.GetMapArray()); oos.writeObject(mMapModel); oos.close(); fos.close(); @@ -47,6 +54,8 @@ public void testMapCreatnTime() { Assert.fail("Exception"); } + // read back the file and check if the creation time in the map matches with the + // expected creation time. MyGuiFile mTestFrame = new MyGuiFile(); mTestFrame.readMapFrmFile("tempmap.map", System.getProperty("user.dir") + "/maps"); assertTrue(creatnTime.equals(mTestFrame.getMapModelObj().getCreationTime())); @@ -60,9 +69,11 @@ public void testMapCreatnTime() { @Test public void testMapEditTime() { + // read a already existing map from file. MyGuiFile mTestFrame = new MyGuiFile(); mTestFrame.readMapFrmFile("tempmap.map", System.getProperty("user.dir") + "/maps"); + // add an edit time to the file String currTime = Util.addDate(""); mTestFrame.getMapModelObj().addEditHistory(currTime); @@ -81,6 +92,8 @@ public void testMapEditTime() { Assert.fail("Exception"); } + // read the map file agian and check if the last edit time matches with the + // expected edit time. mTestFrame = new MyGuiFile(); mTestFrame.readMapFrmFile("tempmap.map", System.getProperty("user.dir") + "/maps"); assertTrue(mTestFrame.getMapModelObj().getEditHistory().contains(currTime)); diff --git a/src/code/tests/MyGuiFileTest.java b/src/code/tests/MyGuiFileTest.java index 003059f..0e0b8e3 100644 --- a/src/code/tests/MyGuiFileTest.java +++ b/src/code/tests/MyGuiFileTest.java @@ -58,7 +58,6 @@ public void testMapModificatnInFile() { // write object to file FileOutputStream fos= new FileOutputStream(file); ObjectOutputStream oos= new ObjectOutputStream(fos); - // oos.writeObject(currMap.GetMapArray()); oos.writeObject(mTestFrame.getMapModelObj()); oos.close(); fos.close();