From fb5b5326d9fe642b9ca0631c3da739bf775f6374 Mon Sep 17 00:00:00 2001 From: Udo Borkowski Date: Fri, 6 Nov 2015 10:56:50 +0100 Subject: [PATCH] Documentation: improve JavaDoc comments; Prepare Release 1.0.3 --- org.abego.treelayout.demo/CHANGES.txt | 12 +++++ org.abego.treelayout.demo/pom.xml | 4 +- .../treelayout/demo/SampleTreeFactory.java | 4 +- .../abego/treelayout/demo/svg/SVGDemo.java | 4 +- .../demo/svg/SVGForTextInBoxTree.java | 4 +- .../abego/treelayout/demo/svg/SVGUtil.java | 27 +++++----- .../treelayout/demo/swing/SwingDemo.java | 4 +- .../demo/swing/TextInBoxTreePane.java | 2 +- .../CHANGES.txt | 7 +++ org.abego.treelayout.netbeans.demo/pom.xml | 6 +-- org.abego.treelayout.netbeans/CHANGES.txt | 7 +++ org.abego.treelayout.netbeans/pom.xml | 4 +- .../netbeans/AbegoTreeLayoutForNetbeans.java | 6 +-- org.abego.treelayout/CHANGES.txt | 7 +++ org.abego.treelayout/pom.xml | 2 +- .../org/abego/treelayout/Configuration.java | 46 ++++++++-------- .../abego/treelayout/NodeExtentProvider.java | 10 ++-- .../abego/treelayout/TreeForTreeLayout.java | 10 ++-- .../java/org/abego/treelayout/TreeLayout.java | 27 ++++++---- .../internal/util/java/lang/IterableUtil.java | 4 +- .../util/java/lang/string/StringUtil.java | 2 +- .../internal/util/java/util/IteratorUtil.java | 4 +- .../internal/util/java/util/ListUtil.java | 2 +- .../org/abego/treelayout/package-info.java | 53 ++++++++++--------- .../util/AbstractTreeForTreeLayout.java | 8 +-- .../treelayout/util/DefaultConfiguration.java | 13 +++-- .../util/DefaultTreeForTreeLayout.java | 6 +-- .../util/FixedNodeExtentProvider.java | 4 +- org.abego.treelayout/src/website/index.html | 2 +- 29 files changed, 175 insertions(+), 116 deletions(-) diff --git a/org.abego.treelayout.demo/CHANGES.txt b/org.abego.treelayout.demo/CHANGES.txt index 0a834cc..aff5981 100644 --- a/org.abego.treelayout.demo/CHANGES.txt +++ b/org.abego.treelayout.demo/CHANGES.txt @@ -10,6 +10,18 @@ abego Software GmbH, Germany CHANGES ============================================================================= +----------------------------------------------------------------------------- +Release 1.0.3 (2015-11-05) + +Documentation + +* Improve JavaDoc comments +I +CodeQuality + +* Fix issue in SVG demo code that may cause some resource not to be released. + (Thanks to the HP Fortify Open Review team for reporting) + ----------------------------------------------------------------------------- Release 1.0.1 (2011-11-16) diff --git a/org.abego.treelayout.demo/pom.xml b/org.abego.treelayout.demo/pom.xml index 418d4f3..5b46321 100644 --- a/org.abego.treelayout.demo/pom.xml +++ b/org.abego.treelayout.demo/pom.xml @@ -7,7 +7,7 @@ org.abego.treelayout org.abego.treelayout.demo - 1.0.3-SNAPSHOT + 1.0.3 jar abego TreeLayout Core Demo @@ -84,7 +84,7 @@ org.abego.treelayout org.abego.treelayout.core - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/SampleTreeFactory.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/SampleTreeFactory.java index 9ed83d5..bf17a6e 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/SampleTreeFactory.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/SampleTreeFactory.java @@ -40,7 +40,7 @@ public class SampleTreeFactory { /** - * Returns a "Sample" tree with {@link TextInBox} items as nodes. + * @return a "Sample" tree with {@link TextInBox} items as nodes. */ public static TreeForTreeLayout createSampleTree() { TextInBox root = new TextInBox("root", 40, 20); @@ -63,7 +63,7 @@ public static TreeForTreeLayout createSampleTree() { } /** - * Returns a "Sample" tree with {@link TextInBox} items as nodes. + * @return a "Sample" tree with {@link TextInBox} items as nodes. */ public static TreeForTreeLayout createSampleTree2() { TextInBox root = new TextInBox("prog", 40, 20); diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGDemo.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGDemo.java index 69312f7..3ab752a 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGDemo.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGDemo.java @@ -42,7 +42,7 @@ *

* The rendered SVG looks like this: *

- * + * A tree rendered using SVG *

* Link: The SVG file (only viewable in SVG aware * browsers) @@ -54,6 +54,8 @@ public class SVGDemo { /** * Returns an SVG text displaying a tree with nodes placed according to a * layout created by {@link TreeLayout}. + * + * @param args [unused] */ public static void main(String[] args) { // get the sample tree diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGForTextInBoxTree.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGForTextInBoxTree.java index 66495aa..f0da0d5 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGForTextInBoxTree.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGForTextInBoxTree.java @@ -65,7 +65,7 @@ private Rectangle2D.Double getBoundsOfNode(TextInBox node) { } /** - * Specifies the {@link TreeLayout} to be rendered as SVG. + * @param treeLayout the {@link TreeLayout} to be rendered as SVG */ public SVGForTextInBoxTree(TreeLayout treeLayout) { this.treeLayout = treeLayout; @@ -123,7 +123,7 @@ private String generateDiagram() { } /** - * Returns the tree layout in SVG format. + * @return the rendered tree, described in SVG format. */ public String getSVG() { if (svgText == null) { diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java index b5ee4a6..383edbf 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java @@ -108,13 +108,14 @@ public static String svg(Number x, Number y, Number width, Number height, /** * - * @param x - * @param y - * @param width - * @param height - * @param style + * @param x   + * @param y   + * @param width   + * @param height   + * @param style   * @param extraAttributes * [default:""] + * @return an SVG 'rect' tag with the given parameters */ public static String rect(String x, String y, String width, String height, String style, String extraAttributes) { @@ -130,13 +131,14 @@ public static String rect(String x, String y, String width, String height, /** * - * @param x - * @param y - * @param width - * @param height - * @param style + * @param x   + * @param y   + * @param width   + * @param height   + * @param style   * @param extraAttributes * [default:""] + * @return an SVG 'rect' tag with the given parameters */ public static String rect(Number x, Number y, Number width, Number height, String style, String extraAttributes) { @@ -209,8 +211,9 @@ private static boolean viewSVG(File file) throws IOException { /** * Creates a sample SVG file "demo.svg" * - * @param args - * @throws IOException + * @param args option '-view': view the just created file + * (may not be supported on all platforms) + * @throws IOException   */ public static void main(String[] args) throws IOException { String s = doc(svg( diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/SwingDemo.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/SwingDemo.java index 36ff0b5..f77e531 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/SwingDemo.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/SwingDemo.java @@ -52,7 +52,7 @@ *

* Screenshot: *

- * + * A tree rendered using Swing * * @author Udo Borkowski (ub@abego.org) */ @@ -85,6 +85,8 @@ private static TreeForTreeLayout getSampleTree(String treeName) { /** * Shows a dialog with a tree in a layout created by {@link TreeLayout}, * using the Swing component {@link TextInBoxTreePane}. + * + * @param args args[0]: treeName (default="") */ public static void main(String[] args) { // get the sample tree diff --git a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/TextInBoxTreePane.java b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/TextInBoxTreePane.java index eb4d98c..30acaaa 100644 --- a/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/TextInBoxTreePane.java +++ b/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/swing/TextInBoxTreePane.java @@ -65,7 +65,7 @@ private Rectangle2D.Double getBoundsOfNode(TextInBox node) { * Specifies the tree to be displayed by passing in a {@link TreeLayout} for * that tree. * - * @param treeLayout + * @param treeLayout the {@link TreeLayout} to be displayed */ public TextInBoxTreePane(TreeLayout treeLayout) { this.treeLayout = treeLayout; diff --git a/org.abego.treelayout.netbeans.demo/CHANGES.txt b/org.abego.treelayout.netbeans.demo/CHANGES.txt index 82bb268..274fa23 100644 --- a/org.abego.treelayout.netbeans.demo/CHANGES.txt +++ b/org.abego.treelayout.netbeans.demo/CHANGES.txt @@ -10,6 +10,13 @@ abego Software GmbH, Germany CHANGES ============================================================================= +----------------------------------------------------------------------------- +Release 1.0.3 (2015-11-05) + +Documentation + +* Improve JavaDoc comments + ----------------------------------------------------------------------------- Release 1.0.1 (2011-11-16) diff --git a/org.abego.treelayout.netbeans.demo/pom.xml b/org.abego.treelayout.netbeans.demo/pom.xml index 709e2d6..7686ec8 100644 --- a/org.abego.treelayout.netbeans.demo/pom.xml +++ b/org.abego.treelayout.netbeans.demo/pom.xml @@ -7,7 +7,7 @@ org.abego.treelayout org.abego.treelayout.netbeans.demo - 1.0.3-SNAPSHOT + 1.0.3 jar Demo for abego TreeLayout NetBeans Integration @@ -84,13 +84,13 @@ org.abego.treelayout org.abego.treelayout.core - 1.0.3-SNAPSHOT + 1.0.3 org.abego.treelayout org.abego.treelayout.netbeans - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/org.abego.treelayout.netbeans/CHANGES.txt b/org.abego.treelayout.netbeans/CHANGES.txt index e0146d5..ff492a1 100644 --- a/org.abego.treelayout.netbeans/CHANGES.txt +++ b/org.abego.treelayout.netbeans/CHANGES.txt @@ -11,6 +11,13 @@ abego Software GmbH, Germany CHANGES ============================================================================= +----------------------------------------------------------------------------- +Release 1.0.3 (2015-11-05) + +Documentation + +* Improve JavaDoc comments + ----------------------------------------------------------------------------- Release 1.0.1 (2011-11-16) diff --git a/org.abego.treelayout.netbeans/pom.xml b/org.abego.treelayout.netbeans/pom.xml index 3a09087..9056dc7 100644 --- a/org.abego.treelayout.netbeans/pom.xml +++ b/org.abego.treelayout.netbeans/pom.xml @@ -7,7 +7,7 @@ org.abego.treelayout org.abego.treelayout.netbeans - 1.0.3-SNAPSHOT + 1.0.3 jar abego TreeLayout NetBeans Integration @@ -84,7 +84,7 @@ org.abego.treelayout org.abego.treelayout.core - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/org.abego.treelayout.netbeans/src/main/java/org/abego/treelayout/netbeans/AbegoTreeLayoutForNetbeans.java b/org.abego.treelayout.netbeans/src/main/java/org/abego/treelayout/netbeans/AbegoTreeLayoutForNetbeans.java index d23f29b..b946d95 100644 --- a/org.abego.treelayout.netbeans/src/main/java/org/abego/treelayout/netbeans/AbegoTreeLayoutForNetbeans.java +++ b/org.abego.treelayout.netbeans/src/main/java/org/abego/treelayout/netbeans/AbegoTreeLayoutForNetbeans.java @@ -57,16 +57,16 @@ *

* E.g. * + * * * * * * - * - * + * + * * *
Comparison abego TreeLayout and NetBeans GraphLayout
AbegoTreeLayoutForNetbeansDefault NetBeans Layout
A tree rendered using abego TreeLayoutA tree rendered using default NetBeans GraphLayout
- *

*

Usage

* Assume you already have added the tree elements (nodes and edges) to a * GraphScene scene and the root node is stored in root. Then diff --git a/org.abego.treelayout/CHANGES.txt b/org.abego.treelayout/CHANGES.txt index 697d578..fe2ebde 100644 --- a/org.abego.treelayout/CHANGES.txt +++ b/org.abego.treelayout/CHANGES.txt @@ -11,6 +11,13 @@ abego Software GmbH, Germany CHANGES ============================================================================= +----------------------------------------------------------------------------- +Release 1.0.3 (2015-11-05) + +Documentation + +* Improve JavaDoc comments + ----------------------------------------------------------------------------- Release 1.0.2 (2015-01-19) diff --git a/org.abego.treelayout/pom.xml b/org.abego.treelayout/pom.xml index ab1e603..9e935a2 100644 --- a/org.abego.treelayout/pom.xml +++ b/org.abego.treelayout/pom.xml @@ -7,7 +7,7 @@ org.abego.treelayout org.abego.treelayout.core - 1.0.3-SNAPSHOT + 1.0.3 bundle abego TreeLayout Core diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/Configuration.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/Configuration.java index ef5c9e3..e0bd8f6 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/Configuration.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/Configuration.java @@ -34,10 +34,10 @@ * Used to configure the tree layout algorithm. *

* Also see this overview. - * + *

* @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public interface Configuration { @@ -59,8 +59,9 @@ public enum Location { *

* By default the root of the tree is located at the top of the diagram. * However one may also put it at the left, right or bottom of the diagram. - *

+ *

* + * * * * @@ -68,10 +69,10 @@ public enum Location { * * * - * - * - * - * + * + * + * + * * *
Possible Root Positions
Top (Default)LeftBottom
Tree with root at topTree with root at left sideTree with root at right sideTree with root at bottom
* @@ -94,25 +95,27 @@ public enum AlignmentInLevel { * may also align them "towards the root" or "away from the root". When the * root is located at the top this means the nodes are aligned "to the top * of the level" or "to the bottom of the level". - *

+ *

* + * * * * * * * - * + * * + * src="doc-files/TreeGraphView-TowardsRoot.png" alt="Tree with root at top and nodes aligned to top"> * + * src="doc-files/TreeGraphView-AwayFromRoot.png" alt="Tree with root at top and nodes aligned to bottom"> * *
Alignment in level when root is at the top
Center (Default)TowardsRoot ("top of level")AwayFromRoot ("bottom of level")
Tree with root at top and nodes center aligned
*

* Alignment in level when root is at the left: *

* + * * * * @@ -121,11 +124,11 @@ public enum AlignmentInLevel { * * * + * src="doc-files/TreeGraphView-Center-RootLeft.png" alt="Tree with root at left side and nodes center aligned"> * + * src="doc-files/TreeGraphView-TowardsRoot-RootLeft.png" alt="Tree with root at left side and nodes left aligned"> * + * src="doc-files/TreeGraphView-AwayFromRoot-RootLeft.png" alt="Tree with root at left side and nodes right aligned"> * *
Table: Possible Alignments of Nodes (when root at left side)
Center (Default)TowardsRoot ("left of level")
* @@ -144,13 +147,12 @@ public enum AlignmentInLevel { /** * Returns the size of the gap between subsequent levels. *

- * + * gapBetweenLevels Visualization * - * @param nextLevel - * [nextLevel > 0] + * @param nextLevel [nextLevel > 0] * * @return the size of the gap between level (nextLevel-1) and nextLevel - * [result >= 0] + * [result >= 0] */ double getGapBetweenLevels(int nextLevel); @@ -160,13 +162,13 @@ public enum AlignmentInLevel { * In the layout there will be a gap of at least the returned size between * both given nodes. *

- * + * gapBetweenNodes Visualization *

* node1 and node2 are at the same level and are placed next to each other. * - * @param node1 - * @param node2 - * @return the minimal size of the gap between node1 and node2 [result >= 0] + * @param node1   + * @param node2   + * @return the minimal size of the gap between node1 and node2 [result >= 0] */ double getGapBetweenNodes(TreeNode node1, TreeNode node2); } diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/NodeExtentProvider.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/NodeExtentProvider.java index 6d6a681..2265b71 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/NodeExtentProvider.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/NodeExtentProvider.java @@ -36,22 +36,22 @@ * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public interface NodeExtentProvider { /** * Returns the width of the given treeNode. * - * @param treeNode - * @return [result >= 0] + * @param treeNode   + * @return [result >= 0] */ double getWidth(TreeNode treeNode); /** * Returns the height of the given treeNode. * - * @param treeNode - * @return [result >= 0] + * @param treeNode   + * @return [result >= 0] */ double getHeight(TreeNode treeNode); } \ No newline at end of file diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java index db78a79..14f1df2 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java @@ -39,12 +39,12 @@ * {@link org.abego.treelayout.util.AbstractTreeForTreeLayout} to implement this * interface or even use the * {@link org.abego.treelayout.util.DefaultTreeForTreeLayout} class directly. - *

+ *

* Also see this overview. * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public interface TreeForTreeLayout { @@ -62,7 +62,7 @@ public interface TreeForTreeLayout { *

* Time Complexity: O(1) * - * @param node + * @param node   * @return true iff node is a leaf in the tree, i.e. has no children. */ boolean isLeaf(TreeNode node); @@ -72,8 +72,8 @@ public interface TreeForTreeLayout { *

* Time Complexity: O(1) * - * @param node - * @param parentNode + * @param node   + * @param parentNode   * @return true iff the node is a child of the given parentNode */ boolean isChildOfParent(TreeNode node, TreeNode parentNode); diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java index 6384664..7f054db 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java @@ -51,14 +51,14 @@ *

* The nodes with their final layout can be retrieved through * {@link #getNodeBounds()}. - *

+ *

* See this summary to get an overview how to * use TreeLayout. * * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public class TreeLayout { /* @@ -90,6 +90,8 @@ public class TreeLayout { /** * Returns the Tree the layout is created for. + * + * @return the Tree the layout is created for */ public TreeForTreeLayout getTree() { return tree; @@ -102,6 +104,8 @@ public TreeForTreeLayout getTree() { /** * Returns the {@link NodeExtentProvider} used by this {@link TreeLayout}. + * + * @return the {@link NodeExtentProvider} used by this {@link TreeLayout} */ public NodeExtentProvider getNodeExtentProvider() { return nodeExtentProvider; @@ -155,6 +159,8 @@ private double getNodeSize(TreeNode treeNode) { /** * Returns the Configuration used by this {@link TreeLayout}. + * + * @return the Configuration used by this {@link TreeLayout} */ public Configuration getConfiguration() { return configuration; @@ -243,7 +249,7 @@ private void calcSizeOfLevels(TreeNode node, int level) { /** * Returns the number of levels of the tree. * - * @return [level > 0] + * @return [level > 0] */ public int getLevelCount() { return sizeOfLevel.size(); @@ -257,8 +263,8 @@ public int getLevelCount() { * the left or right the size of a level is the maximal width of the nodes * of that level. * - * @param level - * @return the size of the level [level >= 0 && level < levelCount] + * @param level   + * @return the size of the level [level >= 0 && level < levelCount] */ public double getSizeOfLevel(int level) { checkArg(level >= 0, "level must be >= 0"); @@ -687,7 +693,7 @@ private void secondWalk(TreeNode v, double m, int level, double levelStart) { * Returns the layout of the tree nodes by mapping each node of the tree to * its bounds (position and size). *

- * For each rectangle x and y will be >= 0. At least one rectangle will have + * For each rectangle x and y will be >= 0. At least one rectangle will have * an x == 0 and at least one rectangle will have an y == 0. * * @return maps each node of the tree to its bounds (position and size). @@ -718,10 +724,13 @@ public Map getNodeBounds() { * In addition to the tree the {@link NodeExtentProvider} and the * {@link Configuration} must be given. * - * @param useIdentity + * @param tree   + * @param nodeExtentProvider   + * @param configuration   + * @param useIdentity * [default: false] when true, identity ("==") is used instead of * equality ("equals(...)") when checking nodes. Within a tree - * each node must only be once (using this check). + * each node must only exist once (using this check). */ public TreeLayout(TreeForTreeLayout tree, NodeExtentProvider nodeExtentProvider, @@ -879,7 +888,7 @@ public DumpConfiguration() { * Prints a dump of the tree to the given printStream, using the node's * "toString" method. * - * @param printStream + * @param printStream   * @param dumpConfiguration * [default: new DumpConfiguration()] */ diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java index ae6f21f..b36e923 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java @@ -61,8 +61,8 @@ public Iterator iterator() { *

* I.e. the iterator does the reverse of the {@link List#iterator()}. * - * @param - * @param list + * @param Type of elements in the list + * @param list   * @return a reverse {@link Iterable} of the list */ public static Iterable createReverseIterable(List list) { diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java index 227556a..80f5123 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java @@ -99,7 +99,7 @@ public static String quote(String s, String nullResult) { /** * see {@link #quote(String, String)} * - * @param s + * @param s the string to quote * @return nullable */ public static String quote(String s) { diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/IteratorUtil.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/IteratorUtil.java index 98a16e2..13e4ec5 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/IteratorUtil.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/IteratorUtil.java @@ -71,8 +71,8 @@ public void remove() { *

* I.e. the iterator does the reverse of the {@link List#iterator()}. * - * @param - * @param list + * @param Type of elements in the list + * @param list   * @return a reverse {@link Iterator} of the list */ public static Iterator createReverseIterator(List list) { diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java index dcaabdb..6ffbc1a 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java @@ -42,7 +42,7 @@ public class ListUtil { /** * - * @param + * @param Type of elements in the list * @param list [!list.isEmpty()] * @return the last element of the list */ diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/package-info.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/package-info.java index b861084..20cc0c8 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/package-info.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/package-info.java @@ -63,7 +63,7 @@ x-coordinate of a node is given by its level

Here an example tree layout:

- + Simple Tree with 6 nodes @@ -94,12 +94,12 @@ interface to access such a tree.

Example: Extending AbstractTreeForTreeLayout

Assume you have a tree consisting of nodes of type StringTreeNode:

-

+ UML diagram for StringTreeNode

As StringTreeNode provides the children in a list and you can get the parent for each node you can extend {@link org.abego.treelayout.util.AbstractTreeForTreeLayout AbstractTreeForTreeLayout} to create your TreeForTreeLayout implementation. You only need to implement two methods and - the constructor:

+ the constructor:

  public class StringTreeAsTreeForTreeLayout extends
      AbstractTreeForTreeLayout<StringTreeNode> {
@@ -124,10 +124,10 @@ public class StringTreeAsTreeForTreeLayout extends
  

Example: Using the DefaultTreeForTreeLayout

Assume you want to create a tree with TextInBox items as nodes:

-

+ UML diagram for TextInBox

As you have no own tree implementation yet you may as well use - {@link org.abego.treelayout.util.DefaultTreeForTreeLayout DefaultTreeForTreeLayout} to create the tree:

+ {@link org.abego.treelayout.util.DefaultTreeForTreeLayout DefaultTreeForTreeLayout} to create the tree:

  TextInBox root = new TextInBox("root", 40, 20);
  TextInBox n1 = new TextInBox("n1", 30, 20);
@@ -145,9 +145,9 @@ public class StringTreeAsTreeForTreeLayout extends
  tree.addChild(n1, n1_3);
  tree.addChild(root, n2);
  tree.addChild(n2, n2_1);
- 

+

This will create a tree like this:

- + Tree created with SVG

NodeExtentProvider

@@ -162,10 +162,10 @@ TreeLayout also needs to know the extent (width and height) of each node in the

Example

Assume you want to create a tree with TextInBox items as nodes:

-

+ UML diagram for TextInBox

Here each node contains its width and height. So your NodeExtentProvider may - look like this:

+ look like this:
  public class TextInBoxNodeExtentProvider implements
          NodeExtentProvider<TextInBox> {
 
@@ -196,10 +196,10 @@ public class TextInBoxNodeExtentProvider implements
 
  

Root Position

- By default the root of the tree is located at the top of the diagram. However - one may also put it at the left, right or bottom of the diagram. -

+ By default the root of the tree is located at the top of the diagram. + However one may also put it at the left, right or bottom of the diagram. + @@ -207,15 +207,15 @@ public class TextInBoxNodeExtentProvider implements - - - - + + + +
Possible Root Positions
Top (Default) LeftBottom
Tree with root at topTree with root at left sideTree with root at right sideTree with root at bottom

See {@link org.abego.treelayout.Configuration#getRootLocation() getRootLocation}. - +

@@ -227,28 +227,29 @@ public class TextInBoxNodeExtentProvider implements level" or "to the bottom of the level".

+ - - - + + +
Alignment in level when root is at the top
Center (Default) TowardsRoot ("top of level") AwayFromRoot ("bottom of level")
Tree with root at top and nodes center alignedTree with root at top and nodes aligned to topTree with root at top and nodes aligned to bottom
-

Alignment in level when root is at the left:

+ - - - + + +
Alignment in level when root is at the left
Center (Default) TowardsRoot ("left of level") AwayFromRoot
("right of level")
Tree with root at left side and nodes center alignedTree with root at left side and nodes left alignedTree with root at left side and nodes right aligned
@@ -261,7 +262,7 @@ public class TextInBoxNodeExtentProvider implements The gap between subsequent levels and the minimal gap between nodes can be configured.

- + levels, gapBetweenLevels and gapBetweenNodes Visualization

See {@link org.abego.treelayout.Configuration#getGapBetweenLevels(int) getGapBetweenLevels} and {@link org.abego.treelayout.Configuration#getGapBetweenNodes(Object, Object) getGapBetweenNodes}. @@ -287,7 +288,7 @@ public class TextInBoxNodeExtentProvider implements MacBook Pro 2.4 GHz Intel Core 2 Duo (2 GB Memory (-Xmx2000m)). The variously sized trees were created randomly.

- + Chart: Performance of TreeLayout on random trees

The picture illustrates the linear time behavior of the algorithm and shows the applicability also for large number of nodes. In this setting it takes diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/AbstractTreeForTreeLayout.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/AbstractTreeForTreeLayout.java index 042a79f..920aff6 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/AbstractTreeForTreeLayout.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/AbstractTreeForTreeLayout.java @@ -36,7 +36,7 @@ import org.abego.treelayout.internal.util.java.util.ListUtil; /** - * Provides an easy way to implement the {@link TreeForTreeLayout} interface by + * Provides an easy way to implement the {@link org.abego.treelayout.TreeForTreeLayout} interface by * defining just two simple methods and a constructor. *

* To use this class the underlying tree must provide the children as a list @@ -48,7 +48,7 @@ * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ abstract public class AbstractTreeForTreeLayout implements TreeForTreeLayout { @@ -58,7 +58,7 @@ abstract public class AbstractTreeForTreeLayout implements *

* Time Complexity: O(1) * - * @param node + * @param node   * @return [nullable] the parent of the node, or null when the node is a * root. */ @@ -73,7 +73,7 @@ abstract public class AbstractTreeForTreeLayout implements *

* A client must not modify the returned list. * - * @param node + * @param node   * @return the children of the given node. When node is a leaf the list is * empty. */ diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultConfiguration.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultConfiguration.java index a803934..2abc530 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultConfiguration.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultConfiguration.java @@ -40,7 +40,7 @@ * @author Udo Borkowski (ub@abego.org) * * - * @param + * @param Type of elements used as nodes in the tree */ public class DefaultConfiguration implements Configuration { @@ -48,8 +48,8 @@ public class DefaultConfiguration implements /** * Specifies the constants to be used for this Configuration. * - * @param gapBetweenLevels - * @param gapBetweenNodes + * @param gapBetweenLevels   + * @param gapBetweenNodes   * @param location * [default: {@link org.abego.treelayout.Configuration.Location#Top Top}] * @param alignmentInLevel @@ -72,6 +72,10 @@ public DefaultConfiguration(double gapBetweenLevels, *

* see * {@link #DefaultConfiguration(double, double, org.abego.treelayout.Configuration.Location, org.abego.treelayout.Configuration.AlignmentInLevel)} + *

+ * @param gapBetweenLevels   + * @param gapBetweenNodes   + * @param location   */ public DefaultConfiguration(double gapBetweenLevels, double gapBetweenNodes, Location location) { @@ -85,6 +89,9 @@ public DefaultConfiguration(double gapBetweenLevels, *

* see * {@link #DefaultConfiguration(double, double, org.abego.treelayout.Configuration.Location, org.abego.treelayout.Configuration.AlignmentInLevel)} + *

+ * @param gapBetweenLevels   + * @param gapBetweenNodes   */ public DefaultConfiguration(double gapBetweenLevels, double gapBetweenNodes) { diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java index 396fb55..38cf7db 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java @@ -38,7 +38,7 @@ /** - * Provides a generic implementation for the {@link TreeForTreeLayout} + * Provides a generic implementation for the {@link org.abego.treelayout.TreeForTreeLayout} * interface, applicable to any type of tree node. *

* It allows you to create a tree "from scratch", without creating any new @@ -52,7 +52,7 @@ * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public class DefaultTreeForTreeLayout extends AbstractTreeForTreeLayout { @@ -92,7 +92,7 @@ public List getChildrenList(TreeNode node) { /** * - * @param node + * @param node   * @return true iff the node is in the tree */ public boolean hasNode(TreeNode node) { diff --git a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/FixedNodeExtentProvider.java b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/FixedNodeExtentProvider.java index f5b300e..f97acbd 100644 --- a/org.abego.treelayout/src/main/java/org/abego/treelayout/util/FixedNodeExtentProvider.java +++ b/org.abego.treelayout/src/main/java/org/abego/treelayout/util/FixedNodeExtentProvider.java @@ -29,7 +29,7 @@ */ package org.abego.treelayout.util; -import static org.abego.treelayout.internal.util.Contract.*; +import static org.abego.treelayout.internal.util.Contract.checkArg; import org.abego.treelayout.NodeExtentProvider; @@ -39,7 +39,7 @@ * * @author Udo Borkowski (ub@abego.org) * - * @param + * @param Type of elements used as nodes in the tree */ public class FixedNodeExtentProvider implements NodeExtentProvider { diff --git a/org.abego.treelayout/src/website/index.html b/org.abego.treelayout/src/website/index.html index 380d9b8..bb35610 100644 --- a/org.abego.treelayout/src/website/index.html +++ b/org.abego.treelayout/src/website/index.html @@ -119,7 +119,7 @@

Download and Installa <dependency> <groupId>org.abego.treelayout</groupId> <artifactId>org.abego.treelayout.core</artifactId> - <version>1.0.2</version> + <version>1.0.3</version> </dependency> ... </dependencies>