Browse Source

Update javadoc.

Mikael Capelle 6 years ago
parent
commit
17da90c32c

+ 1
- 1
src/main/org/insa/graph/GraphStatistics.java View File

@@ -100,7 +100,7 @@ public class GraphStatistics {
100 100
      * 
101 101
      * @param boundingBox Bounding-box for the graph.
102 102
      * @param nbRoadOneWay Number of one-way roads in the graph.
103
-     * @param nbRoadTwoTayws Number of two-ways roads in the graph.
103
+     * @param nbRoadTwoWays Number of two-ways roads in the graph.
104 104
      * @param maximumSpeed Maximum speed of any road of the graph. You can use
105 105
      *        {@link #NO_MAXIMUM_SPEED} to indicate that the graph has no maximum
106 106
      *        speed limit.

+ 33
- 5
src/main/org/insa/graphics/AlgorithmPanel.java View File

@@ -139,6 +139,19 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
139 139
     List<ActionListener> startActionListeners = new ArrayList<>();
140 140
 
141 141
     /**
142
+     * Create a new AlgorithmPanel with the given parameters.
143
+     * 
144
+     * @param parent Parent component for this panel. Only use for centering
145
+     *        dialogs.
146
+     * @param baseAlgorithm Base algorithm for this algorithm panel.
147
+     * @param title Title of the panel.
148
+     * @param nodeNames Names of the input nodes.
149
+     * @param enableModeSelection <code>true</code> to enable {@link Mode}
150
+     *        selection.
151
+     * @param enableArcFilterSelection <code>true</code> to enable {@link ArcFilter}
152
+     *        selection.
153
+     * 
154
+     * @see ArcFilterFactory
142 155
      */
143 156
     public AlgorithmPanel(Component parent, Class<? extends AbstractAlgorithm<?>> baseAlgorithm,
144 157
             String title, String[] nodeNames, boolean enableModeSelection,
@@ -312,7 +325,7 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
312 325
      * 
313 326
      * @param title Title for the label.
314 327
      * 
315
-     * @return
328
+     * @return A new JLabel containing the given title with proper font.
316 329
      */
317 330
     protected JLabel createTitleLabel(String title) {
318 331
         JLabel titleLabel = new JLabel(title);
@@ -328,7 +341,12 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
328 341
     /**
329 342
      * Create the combo box for the algorithm selection.
330 343
      * 
331
-     * @return
344
+     * @param baseAlgorithm Base algorithm for which the select box should be
345
+     *        created.
346
+     * 
347
+     * @return A new JComboBox containing algorithms for the given base algorithm.
348
+     * 
349
+     * @see AlgorithmFactory
332 350
      */
333 351
     protected JComboBox<String> createAlgoritmSelectComboBox(
334 352
             Class<? extends AbstractAlgorithm<?>> baseAlgorithm) {
@@ -343,8 +361,9 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
343 361
     /**
344 362
      * Create a node input panel with the given node input names.
345 363
      * 
346
-     * @param nodeNames
347
-     * @return
364
+     * @param nodeNames Field names for the inputs to create.
365
+     * 
366
+     * @return A new NodesInputPanel containing inputs for the given names.
348 367
      */
349 368
     protected NodesInputPanel createNodesInputPanel(String[] nodeNames) {
350 369
         final Color[] nodeColors = { new Color(57, 172, 115), new Color(255, 77, 77),
@@ -358,6 +377,15 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
358 377
         return panel;
359 378
     }
360 379
 
380
+    /**
381
+     * Check if the given list of nodes does not contain any <code>null</code>
382
+     * value.
383
+     * 
384
+     * @param nodes List of {@link Node} to check.
385
+     * 
386
+     * @return <code>true</code> if the list does not contain any <code>null</code>
387
+     *         value, <code>false</code> otherwise.
388
+     */
361 389
     protected boolean allNotNull(List<Node> nodes) {
362 390
         boolean allNotNull = true;
363 391
         for (Node node: nodes) {
@@ -382,7 +410,7 @@ public class AlgorithmPanel extends JPanel implements DrawingChangeListener {
382 410
     /**
383 411
      * Add a new start action listener to this class.
384 412
      * 
385
-     * @param listener
413
+     * @param listener Listener to add.
386 414
      */
387 415
     public void addStartActionListener(ActionListener listener) {
388 416
         this.startActionListeners.add(listener);

+ 14
- 5
src/main/org/insa/graphics/NodesInputPanel.java View File

@@ -59,7 +59,7 @@ public class NodesInputPanel extends JPanel
59 59
          * @param point
60 60
          * 
61 61
          * @return the closest node to the given point, or null if no node is "close
62
-         * enough".
62
+         *         enough".
63 63
          */
64 64
         public Node findClosestNode(Point point) {
65 65
             Node minNode = null;
@@ -124,14 +124,23 @@ public class NodesInputPanel extends JPanel
124 124
     private NodeFinder nodeFinder;
125 125
 
126 126
     /**
127
-     * @param drawing Original drawing used (see {@link:newDrawingLoaded}).
128
-     * @param graph Original graph used (see {@link:newGraphLoaded});
127
+     * Create a new NodesInputPanel.
128
+     * 
129 129
      */
130 130
     public NodesInputPanel() {
131 131
         super(new GridBagLayout());
132 132
         initInputToFill();
133 133
     }
134 134
 
135
+    /**
136
+     * Add an InputChanged listener to this panel. This listener will be notified by
137
+     * a {@link InputChangedEvent} each time an input in this panel change (click,
138
+     * clear, manual input).
139
+     * 
140
+     * @param listener Listener to add.
141
+     * 
142
+     * @see InputChangedEvent
143
+     */
135 144
     public void addInputChangedListener(ActionListener listener) {
136 145
         inputChangeListeners.add(listener);
137 146
     }
@@ -293,7 +302,7 @@ public class NodesInputPanel extends JPanel
293 302
 
294 303
     /**
295 304
      * @return The node for the given text field, or null if the content of the text
296
-     * field is invalid.
305
+     *         field is invalid.
297 306
      */
298 307
     protected Node getNodeForInput(JTextField textfield) {
299 308
         try {
@@ -307,7 +316,7 @@ public class NodesInputPanel extends JPanel
307 316
 
308 317
     /**
309 318
      * @return List of nodes associated with the input. Some nodes may be null if
310
-     * their associated input is invalid.
319
+     *         their associated input is invalid.
311 320
      */
312 321
     public List<Node> getNodeForInputs() {
313 322
         List<Node> nodes = new ArrayList<>(nodeInputs.size());

+ 7
- 2
src/main/org/insa/graphics/StreamCapturer.java View File

@@ -12,8 +12,8 @@ public class StreamCapturer extends OutputStream {
12 12
     private JTextArea output;
13 13
 
14 14
     /**
15
-     * @param prefix
16
-     * @param output
15
+     * @param output Output JTextArea to which this stream should print.
16
+     * @param prefix Prefix to add to each line of this output.
17 17
      */
18 18
     public StreamCapturer(JTextArea output, String prefix) {
19 19
         this.prefix = prefix;
@@ -21,6 +21,11 @@ public class StreamCapturer extends OutputStream {
21 21
         this.output = output;
22 22
     }
23 23
 
24
+    /**
25
+     * Create a new StreamCapturer without prefix.
26
+     * 
27
+     * @param output Output JTextArea to which this stream should print.
28
+     */
24 29
     public StreamCapturer(JTextArea output) {
25 30
         this(output, null);
26 31
     }

+ 0
- 4
src/main/org/insa/graphics/drawing/components/BasicDrawing.java View File

@@ -398,7 +398,6 @@ public class BasicDrawing extends JPanel implements Drawing {
398 398
 
399 399
     /*
400 400
      * (non-Javadoc)
401
-     * 
402 401
      * @see org.insa.graphics.drawing.Drawing#clear()
403 402
      */
404 403
     @Override
@@ -414,7 +413,6 @@ public class BasicDrawing extends JPanel implements Drawing {
414 413
 
415 414
     /*
416 415
      * (non-Javadoc)
417
-     * 
418 416
      * @see org.insa.graphics.drawing.Drawing#clearOverlays()
419 417
      */
420 418
     @Override
@@ -458,7 +456,6 @@ public class BasicDrawing extends JPanel implements Drawing {
458 456
 
459 457
     /*
460 458
      * (non-Javadoc)
461
-     * 
462 459
      * @see
463 460
      * org.insa.graphics.drawing.Drawing#addDrawingClickListener(org.insa.graphics.
464 461
      * drawing.DrawingClickListener)
@@ -470,7 +467,6 @@ public class BasicDrawing extends JPanel implements Drawing {
470 467
 
471 468
     /*
472 469
      * (non-Javadoc)
473
-     * 
474 470
      * @see org.insa.graphics.drawing.Drawing#removeDrawingClickListener(org.insa.
475 471
      * graphics.drawing.DrawingClickListener)
476 472
      */

+ 43
- 3
src/main/org/insa/graphics/utils/FileUtils.java View File

@@ -16,8 +16,26 @@ public class FileUtils {
16 16
     // Preferences
17 17
     private static Preferences preferences = Preferences.userRoot().node(FileUtils.class.getName());
18 18
 
19
+    /**
20
+     * Type of folder with associated preferred folder and path filters.
21
+     *
22
+     */
19 23
     public enum FolderType {
20
-        Map, PathInput, PathOutput
24
+
25
+        /**
26
+         * Folder type for graph files input (*.mapgr).
27
+         */
28
+        Map,
29
+
30
+        /**
31
+         * Folder type for path inputs (*.path).
32
+         */
33
+        PathInput,
34
+
35
+        /**
36
+         * Folder type for path outputs (*.path).
37
+         */
38
+        PathOutput
21 39
     }
22 40
 
23 41
     private static class PreferencesEntry {
@@ -55,7 +73,11 @@ public class FileUtils {
55 73
     }
56 74
 
57 75
     /**
76
+     * @param folderType Type of folder to retrieve.
77
+     * 
58 78
      * @return A File instance pointing to the preferred folder for the given type.
79
+     * 
80
+     * @see FolderType
59 81
      */
60 82
     public static File getPreferredFolder(FolderType folderType) {
61 83
         PreferencesEntry entry = folderToEntry.get(folderType);
@@ -66,12 +88,18 @@ public class FileUtils {
66 88
         return folder;
67 89
     }
68 90
 
91
+    /**
92
+     * @param folderType Type of folder to update.
93
+     * @param newPreferredFolder New preferred folder.
94
+     */
69 95
     public static void updatePreferredFolder(FolderType folderType, File newPreferredFolder) {
70 96
         PreferencesEntry entry = folderToEntry.get(folderType);
71 97
         preferences.put(entry.key, newPreferredFolder.getAbsolutePath());
72 98
     }
73 99
 
74 100
     /**
101
+     * @param folderType Type of folder for which the filter should be retrieved.
102
+     * 
75 103
      * @return A FileFilter corresponding to input graph files.
76 104
      */
77 105
     public static FileFilter getFileFilter(FolderType folderType) {
@@ -79,8 +107,12 @@ public class FileUtils {
79 107
     }
80 108
 
81 109
     /**
82
-     * @param folderType
83
-     * @return
110
+     * @param folderType Type of folder for which a file chooser should be created.
111
+     * @param defaultFileName Default file name to show, or null to not show any
112
+     *        file.
113
+     * 
114
+     * @return A new JFileChooser pointing to the preferred folder for the given
115
+     *         folderType, with the given default file selected (if given).
84 116
      */
85 117
     public static JFileChooser createFileChooser(FolderType folderType, String defaultFileName) {
86 118
         JFileChooser chooser = new JFileChooser();
@@ -104,6 +136,14 @@ public class FileUtils {
104 136
         return chooser;
105 137
     }
106 138
 
139
+    /**
140
+     * @param folderType Type of folder for which a file chooser should be created.
141
+     * 
142
+     * @return A new JFileChooser pointing to the preferred folder for the given
143
+     *         folderType.
144
+     * 
145
+     * @see #createFileChooser(FolderType, String)
146
+     */
107 147
     public static JFileChooser createFileChooser(FolderType folderType) {
108 148
         return createFileChooser(folderType, null);
109 149
     }

Loading…
Cancel
Save