diff --git a/src/org/jetuml/application/Clipboard.java b/src/org/jetuml/application/Clipboard.java index 2461c6d3b..37c75a7f0 100644 --- a/src/org/jetuml/application/Clipboard.java +++ b/src/org/jetuml/application/Clipboard.java @@ -301,7 +301,7 @@ public boolean validPaste(Diagram pDiagram) private static boolean validElementFor( DiagramElement pElement, Diagram pDiagram ) { // PointNodes are allowed in all diagrams despite not being contained in prototypes. - if ( pElement.getClass() == PointNode.class ) + if( pElement.getClass() == PointNode.class ) { return true; } diff --git a/src/org/jetuml/diagram/builder/DiagramBuilder.java b/src/org/jetuml/diagram/builder/DiagramBuilder.java index d32435beb..fd1278e93 100644 --- a/src/org/jetuml/diagram/builder/DiagramBuilder.java +++ b/src/org/jetuml/diagram/builder/DiagramBuilder.java @@ -507,7 +507,7 @@ private Point computePosition(Dimension pDimension, Point pRequestedPosition) { newX = aCanvasDimension.width() - pDimension.width(); } - if (newY + pDimension.height() > aCanvasDimension.height()) + if(newY + pDimension.height() > aCanvasDimension.height()) { newY = aCanvasDimension.height() - pDimension.height(); } diff --git a/src/org/jetuml/diagram/builder/SequenceDiagramBuilder.java b/src/org/jetuml/diagram/builder/SequenceDiagramBuilder.java index b55d53c00..b867f68f7 100644 --- a/src/org/jetuml/diagram/builder/SequenceDiagramBuilder.java +++ b/src/org/jetuml/diagram/builder/SequenceDiagramBuilder.java @@ -80,7 +80,7 @@ else if(pElement instanceof Edge) } result.addAll(getCorrespondingReturnEdges(result)); //Implicit parameter nodes downstream of constructor calls should not be removed - if (pElement instanceof ConstructorEdge) + if(pElement instanceof ConstructorEdge) { result.removeIf(element -> element instanceof ImplicitParameterNode); } @@ -242,7 +242,7 @@ private boolean isConstructorExecution(Node pNode) } for( Edge edge : diagram().edges() ) { - if ( edge.end() == pNode && edge.getClass() == ConstructorEdge.class ) + if( edge.end() == pNode && edge.getClass() == ConstructorEdge.class ) { return true; } @@ -346,7 +346,7 @@ private Optional getConstructorEdge(Node pNode) } for( Edge edge : diagram().edges() ) { - if ( edge.end() == pNode && edge.getClass() == ConstructorEdge.class ) + if( edge.end() == pNode && edge.getClass() == ConstructorEdge.class ) { return Optional.of(edge); } @@ -434,7 +434,7 @@ else if( pNode.getClass() == CallNode.class ) downstreamElements.addAll(getEdgeDownStreams(edge)); } } - else if ( pNode.getClass() == ImplicitParameterNode.class ) + else if( pNode.getClass() == ImplicitParameterNode.class ) { downstreamElements.addAll(pNode.getChildren()); for( Node child: pNode.getChildren() ) diff --git a/src/org/jetuml/geom/EdgePath.java b/src/org/jetuml/geom/EdgePath.java index e0fc88df6..6304972bb 100644 --- a/src/org/jetuml/geom/EdgePath.java +++ b/src/org/jetuml/geom/EdgePath.java @@ -53,7 +53,7 @@ public EdgePath(Line...pLines) { assert pLines.length > 0; aPoints.add(pLines[0].getPoint1()); - for (Line line : pLines) + for(Line line : pLines) { aPoints.add(line.getPoint2()); } @@ -99,26 +99,26 @@ public int hashCode() @Override public boolean equals(Object pObj) { - if (this == pObj) + if(this == pObj) { return true; } - if (pObj == null) + if(pObj == null) { return false; } - if (getClass() != pObj.getClass()) + if(getClass() != pObj.getClass()) { return false; } EdgePath other = (EdgePath) pObj; - if (other.aPoints.size() != this.aPoints.size()) + if(other.aPoints.size() != this.aPoints.size()) { return false; } - for (int i = 0; i < aPoints.size(); i++) + for(int i = 0; i < aPoints.size(); i++) { - if (!other.aPoints.get(i).equals(aPoints.get(i))) + if(!other.aPoints.get(i).equals(aPoints.get(i))) { return false; } diff --git a/src/org/jetuml/gui/AboutDialog.java b/src/org/jetuml/gui/AboutDialog.java index e02523f94..d4846494e 100644 --- a/src/org/jetuml/gui/AboutDialog.java +++ b/src/org/jetuml/gui/AboutDialog.java @@ -108,7 +108,7 @@ private Scene createScene() aStage.requestFocus(); aStage.addEventHandler(KeyEvent.KEY_PRESSED, pEvent -> { - if (pEvent.getCode() == KeyCode.ENTER) + if(pEvent.getCode() == KeyCode.ENTER) { aStage.close(); } diff --git a/src/org/jetuml/gui/DiagramCanvas.java b/src/org/jetuml/gui/DiagramCanvas.java index 64119ece1..b29d61403 100644 --- a/src/org/jetuml/gui/DiagramCanvas.java +++ b/src/org/jetuml/gui/DiagramCanvas.java @@ -191,7 +191,7 @@ public void paste() */ private static void shiftElements(Iterable pElements, int pShiftAmount) { - for (DiagramElement element: pElements) + for(DiagramElement element: pElements) { if(element instanceof Node) { @@ -362,7 +362,7 @@ public void booleanPreferenceChanged(BooleanPreference pPreference) @Override public void integerPreferenceChanged(IntegerPreference pPreference) { - if ( pPreference == IntegerPreference.fontSize ) + if( pPreference == IntegerPreference.fontSize ) { paintPanel(); } @@ -628,19 +628,19 @@ private void alignMoveToGrid() int dy = snappedPosition.getY() - bounds.getY(); //ensure the bounds of the entire selection are not outside the walls of the canvas - if (entireBounds.getMaxX() + dx > getWidth()) + if(entireBounds.getMaxX() + dx > getWidth()) { dx -= GRID_SIZE; } - else if (entireBounds.getX() + dx <= 0) + else if(entireBounds.getX() + dx <= 0) { dx += GRID_SIZE; } - if (entireBounds.getMaxY() + dy > getHeight()) + if(entireBounds.getMaxY() + dy > getHeight()) { dy -= GRID_SIZE; } - else if (entireBounds.getY() <= 0) + else if(entireBounds.getY() <= 0) { dy += GRID_SIZE; } diff --git a/src/org/jetuml/gui/EditorFrame.java b/src/org/jetuml/gui/EditorFrame.java index b80e03236..53a277bdf 100644 --- a/src/org/jetuml/gui/EditorFrame.java +++ b/src/org/jetuml/gui/EditorFrame.java @@ -423,7 +423,7 @@ private void close() alert.setHeaderText(RESOURCES.getString("dialog.close.title")); alert.showAndWait(); - if (alert.getResult() == ButtonType.YES) + if(alert.getResult() == ButtonType.YES) { removeGraphFrameFromTabbedPane(diagramTab); } @@ -451,7 +451,7 @@ public void close(DiagramTab pDiagramTab) alert.setHeaderText(RESOURCES.getString("dialog.close.title")); alert.showAndWait(); - if (alert.getResult() == ButtonType.YES) + if(alert.getResult() == ButtonType.YES) { removeGraphFrameFromTabbedPane(pDiagramTab); } @@ -655,7 +655,7 @@ private int getNumberOfUsavedDiagrams() public void exit() { final int modcount = getNumberOfUsavedDiagrams(); - if (modcount > 0) + if(modcount > 0) { Alert alert = new Alert(AlertType.CONFIRMATION, MessageFormat.format(RESOURCES.getString("dialog.exit.ok"), new Object[] { Integer.valueOf(modcount) }), @@ -666,7 +666,7 @@ public void exit() alert.setHeaderText(RESOURCES.getString("dialog.exit.title")); alert.showAndWait(); - if (alert.getResult() == ButtonType.YES) + if(alert.getResult() == ButtonType.YES) { Preferences.userNodeForPackage(JetUML.class).put("recent", aRecentFiles.serialize()); System.exit(0); diff --git a/src/org/jetuml/gui/NotificationService.java b/src/org/jetuml/gui/NotificationService.java index ee6ad8c6d..f029057d9 100644 --- a/src/org/jetuml/gui/NotificationService.java +++ b/src/org/jetuml/gui/NotificationService.java @@ -72,9 +72,9 @@ public static NotificationService instance() */ public void setMainStage(Stage pStage) { - this.aMainStage = pStage; + aMainStage = pStage; - if (pStage != null) + if(pStage != null) { // Window position and size listener for notifications ChangeListener stageTransformationListener = (pObservableValue, pOldValue, pNewValue) -> @@ -100,12 +100,12 @@ public void updateNotificationPosition() ArrayList reverseNotifications = new ArrayList<>(aNotifications); Collections.reverse(reverseNotifications); - for (Notification notification : reverseNotifications) + for(Notification notification : reverseNotifications) { notification.setPosition(x, y); y = y - notification.getHeight() - NOTIFICATION_DISPLAY_SPACING; - if (y < aMainStage.getY()) + if(y < aMainStage.getY()) { notification.close(); aNotifications.remove(notification); @@ -120,7 +120,7 @@ public void updateNotificationPosition() */ public void spawnNotification(Notification pNotification) { - if (aMainStage == null) + if(aMainStage == null) { return; } @@ -144,7 +144,7 @@ public void spawnNotification(Notification pNotification) */ public void spawnNotification(String pText, ToastNotification.Type pType) { - if (aMainStage == null) + if(aMainStage == null) { return; } diff --git a/src/org/jetuml/gui/PropertySheet.java b/src/org/jetuml/gui/PropertySheet.java index 1b121afbb..9ffecdf0c 100644 --- a/src/org/jetuml/gui/PropertySheet.java +++ b/src/org/jetuml/gui/PropertySheet.java @@ -227,18 +227,18 @@ private static void addTabbingFeature(TextArea pTextArea) { final String aFocusEventText = "TAB_TO_FOCUS_EVENT"; - if (!KeyCode.TAB.equals(pKeyEvent.getCode())) + if(!KeyCode.TAB.equals(pKeyEvent.getCode())) { return; } - if (pKeyEvent.isAltDown() || pKeyEvent.isMetaDown() || pKeyEvent.isShiftDown() || !(pKeyEvent.getSource() instanceof TextArea)) + if(pKeyEvent.isAltDown() || pKeyEvent.isMetaDown() || pKeyEvent.isShiftDown() || !(pKeyEvent.getSource() instanceof TextArea)) { return; } final TextArea textAreaSource = (TextArea) pKeyEvent.getSource(); - if (pKeyEvent.isControlDown()) + if(pKeyEvent.isControlDown()) { - if (!aFocusEventText.equalsIgnoreCase(pKeyEvent.getText())) + if(!aFocusEventText.equalsIgnoreCase(pKeyEvent.getText())) { pKeyEvent.consume(); textAreaSource.replaceSelection("\t"); diff --git a/src/org/jetuml/gui/tips/TipDialog.java b/src/org/jetuml/gui/tips/TipDialog.java index 4a255d47d..94b736f69 100644 --- a/src/org/jetuml/gui/tips/TipDialog.java +++ b/src/org/jetuml/gui/tips/TipDialog.java @@ -148,7 +148,7 @@ private Scene createScene() aStage.requestFocus(); aStage.addEventHandler(KeyEvent.KEY_PRESSED, pEvent -> { - if (pEvent.getCode() == KeyCode.ESCAPE) + if(pEvent.getCode() == KeyCode.ESCAPE) { aStage.close(); } diff --git a/src/org/jetuml/gui/tips/TipLoader.java b/src/org/jetuml/gui/tips/TipLoader.java index 2c2830018..9e5a9cd29 100644 --- a/src/org/jetuml/gui/tips/TipLoader.java +++ b/src/org/jetuml/gui/tips/TipLoader.java @@ -76,7 +76,7 @@ private static String inputStreamToString(InputStream pStream) throws IOExceptio { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[BYTES_IN_KILOBYTE]; - for (int length; (length = pStream.read(buffer)) != -1; ) + for(int length; (length = pStream.read(buffer)) != -1; ) { result.write(buffer, 0, length); } @@ -138,7 +138,7 @@ private static List convertJsonObjectToTipElements(JsonObject pTip) { List elements = new ArrayList<>(); - for (Object contentObject : pTip.getJsonArray(TipFieldName.CONTENT.asString())) + for(Object contentObject : pTip.getJsonArray(TipFieldName.CONTENT.asString())) { JsonObject contentJsonObject = (JsonObject) contentObject; Media media = discoverMediaUsed(contentJsonObject); @@ -153,7 +153,7 @@ private static List convertJsonObjectToTipElements(JsonObject pTip) */ private static Media discoverMediaUsed(JsonObject pTipContent) { - for (Media media : Media.values()) + for(Media media : Media.values()) { if(pTipContent.hasProperty(media.name().toLowerCase())) { diff --git a/src/org/jetuml/gui/tips/ViewedTips.java b/src/org/jetuml/gui/tips/ViewedTips.java index 9231fb1e2..3323b6163 100644 --- a/src/org/jetuml/gui/tips/ViewedTips.java +++ b/src/org/jetuml/gui/tips/ViewedTips.java @@ -42,7 +42,7 @@ public ViewedTips(int pFirstTipOfTheDayId) aCurrentTipId = pFirstTipOfTheDayId; - if (pFirstTipOfTheDayId == NUM_TIPS) + if(pFirstTipOfTheDayId == NUM_TIPS) { aNewNextTipOfTheDayId = 1; } @@ -86,7 +86,7 @@ public int getNewNextTipOfTheDayId() private void updateCurrentTipIdToNextTipId() { - if (aCurrentTipId == NUM_TIPS) + if(aCurrentTipId == NUM_TIPS) { aCurrentTipId = 1; } @@ -98,7 +98,7 @@ private void updateCurrentTipIdToNextTipId() private void updateCurrentTipIdToPreviousTipId() { - if (aCurrentTipId == 1) + if(aCurrentTipId == 1) { aCurrentTipId = NUM_TIPS; } @@ -114,9 +114,9 @@ private void updateCurrentTipIdToPreviousTipId() */ private void updateNextTipOfTheDayId() { - if (aCurrentTipId == aNewNextTipOfTheDayId) + if(aCurrentTipId == aNewNextTipOfTheDayId) { - if (aNewNextTipOfTheDayId == NUM_TIPS) + if(aNewNextTipOfTheDayId == NUM_TIPS) { aNewNextTipOfTheDayId = 1; } diff --git a/src/org/jetuml/persistence/json/CharacterBuffer.java b/src/org/jetuml/persistence/json/CharacterBuffer.java index 56ce062b1..e28143bcb 100644 --- a/src/org/jetuml/persistence/json/CharacterBuffer.java +++ b/src/org/jetuml/persistence/json/CharacterBuffer.java @@ -97,7 +97,7 @@ void skipBlanks() while (hasMore()) { char character = next(); - if (!isWhitespace(character)) + if(!isWhitespace(character)) { backUp(); return; @@ -131,11 +131,11 @@ boolean isNext(char pCharacter) @Override public String toString() { - if (aPosition >= 0 && aPosition < aCharacters.length()) + if(aPosition >= 0 && aPosition < aCharacters.length()) { return String.format("At position %d [%s]", aPosition, aCharacters.charAt(aPosition)); } - else if (aPosition < 0) + else if(aPosition < 0) { return "Positioned at the beginning"; } diff --git a/src/org/jetuml/persistence/json/JsonIntegerParser.java b/src/org/jetuml/persistence/json/JsonIntegerParser.java index ca0783601..b52bb5406 100644 --- a/src/org/jetuml/persistence/json/JsonIntegerParser.java +++ b/src/org/jetuml/persistence/json/JsonIntegerParser.java @@ -32,7 +32,7 @@ final class JsonIntegerParser implements JsonValueParser @Override public boolean isApplicable(ParsableCharacterBuffer pInput) { - if (!pInput.hasMore() ) + if(!pInput.hasMore() ) { return false; } diff --git a/src/org/jetuml/persistence/json/JsonStringParser.java b/src/org/jetuml/persistence/json/JsonStringParser.java index 0503fbc46..fa6a28a77 100644 --- a/src/org/jetuml/persistence/json/JsonStringParser.java +++ b/src/org/jetuml/persistence/json/JsonStringParser.java @@ -91,7 +91,7 @@ else if( next == CHAR_UNICODE_ESCAPE ) */ private static char parseUnicode(ParsableCharacterBuffer pInput) { - if (!pInput.hasMore(NUMBER_OF_UNICODE_DIGITS)) + if(!pInput.hasMore(NUMBER_OF_UNICODE_DIGITS)) { throw new JsonParsingException(pInput.position()); } @@ -141,16 +141,16 @@ public String parse(ParsableCharacterBuffer pInput) while (pInput.hasMore()) { char next = pInput.next(); - if (isISOControl(next)) + if(isISOControl(next)) { throw new JsonParsingException(pInput.position()); } - else if (next == CHAR_ESCAPE) + else if(next == CHAR_ESCAPE) { pInput.backUp(); result.append(parseEscape(pInput)); } - else if (next == CHAR_QUOTE) + else if(next == CHAR_QUOTE) { return result.toString(); } diff --git a/src/org/jetuml/rendering/AbstractDiagramRenderer.java b/src/org/jetuml/rendering/AbstractDiagramRenderer.java index dd054697a..6ece77de0 100644 --- a/src/org/jetuml/rendering/AbstractDiagramRenderer.java +++ b/src/org/jetuml/rendering/AbstractDiagramRenderer.java @@ -121,9 +121,9 @@ protected Optional deepFindNode(Node pNode, Point pPoint) public Rectangle getBounds() { Rectangle bounds = null; - for (Node node : aDiagram.rootNodes()) + for(Node node : aDiagram.rootNodes()) { - if (bounds == null) + if(bounds == null) { bounds = getBounds(node); } @@ -132,11 +132,11 @@ public Rectangle getBounds() bounds = bounds.add(getBounds(node)); } } - for (Edge edge : aDiagram.edges()) + for(Edge edge : aDiagram.edges()) { bounds = bounds.add(getBounds(edge)); } - if (bounds == null) + if(bounds == null) { return new Rectangle(0, 0, 0, 0); } diff --git a/src/org/jetuml/rendering/CanvasFont.java b/src/org/jetuml/rendering/CanvasFont.java index 304bf0e25..0e71b3623 100644 --- a/src/org/jetuml/rendering/CanvasFont.java +++ b/src/org/jetuml/rendering/CanvasFont.java @@ -141,7 +141,7 @@ public int getBaselineOffset(boolean pBold, boolean pItalic) @Override public void integerPreferenceChanged(IntegerPreference pPreference) { - if ( pPreference == IntegerPreference.fontSize && aFont.getSize() != UserPreferences.instance().getInteger(pPreference) ) + if( pPreference == IntegerPreference.fontSize && aFont.getSize() != UserPreferences.instance().getInteger(pPreference) ) { refreshAttributes(); } diff --git a/src/org/jetuml/rendering/ClassDiagramRenderer.java b/src/org/jetuml/rendering/ClassDiagramRenderer.java index c8c89096f..4f46eeb39 100644 --- a/src/org/jetuml/rendering/ClassDiagramRenderer.java +++ b/src/org/jetuml/rendering/ClassDiagramRenderer.java @@ -189,9 +189,9 @@ private void layoutSegmentedEdges(EdgePriority pEdgePriority) private void layoutDependencyEdges() { assert diagram().getType() == DiagramType.CLASS; - for (Edge edge : diagram().edges()) + for(Edge edge : diagram().edges()) { - if (priorityOf(edge)==EdgePriority.DEPENDENCY) + if(priorityOf(edge)==EdgePriority.DEPENDENCY) { //Determine the start and end connection points Side attachedEndSide = attachedSide(edge, edge.end()); Point startPoint = getConnectionPoint(edge.start(), edge, attachedEndSide.mirrored()); @@ -210,7 +210,7 @@ private void layoutSelfEdges() List selfEdges = diagram().edges().stream() .filter(edge -> priorityOf(edge) == EdgePriority.SELF_EDGE) .collect(toList()); - for (Edge edge : selfEdges) + for(Edge edge : selfEdges) { //Determine the corner where the self-edge should be placed NodeCorner corner = getSelfEdgeCorner(edge); @@ -229,7 +229,7 @@ private void layoutSelfEdges() private NodeCorner getSelfEdgeCorner(Edge pEdge) { assert priorityOf(pEdge) == EdgePriority.SELF_EDGE; - for (NodeCorner corner : NodeCorner.values()) + for(NodeCorner corner : NodeCorner.values()) { //Get a 2D array of [startPoint, endPoint] for a self edge at the corner Point[] points = toPoints(corner, pEdge.end()); //Return the first corner with available start and end points @@ -262,7 +262,7 @@ private EdgePath buildSelfEdge(Edge pEdge, NodeCorner pCorner) Point middleBend; Point lastBend; //determine location of first bend: either 20px above or 20px below the start point - if (NodeCorner.horizontalSide(pCorner) == Direction.NORTH) + if(NodeCorner.horizontalSide(pCorner) == Direction.NORTH) { firstBend = new Point(startPoint.getX(), startPoint.getY() - (2 * TEN_PIXELS)); } @@ -271,7 +271,7 @@ private EdgePath buildSelfEdge(Edge pEdge, NodeCorner pCorner) firstBend = new Point(startPoint.getX(), startPoint.getY() + (2 * TEN_PIXELS)); } //determine location of middle and last bends - if (NodeCorner.verticalSide(pCorner) == Direction.EAST) + if(NodeCorner.verticalSide(pCorner) == Direction.EAST) { middleBend = new Point(firstBend.getX() + (4 * TEN_PIXELS), firstBend.getY()); lastBend = new Point(endPoint.getX() + (2 * TEN_PIXELS), endPoint.getY()); @@ -299,8 +299,8 @@ private void storeMergedEndEdges(Side pDirection, List pEdgesToMergeEnd) //Merged edges will share a common end point Point sharedEndPoint = getConnectionPoint(pEdgesToMergeEnd.get(0).end(), pEdgesToMergeEnd.get(0), pDirection.mirrored()); //get the individual start points for each edge - Map startPoints = new HashMap(); - for (Edge e : pEdgesToMergeEnd) + Map startPoints = new HashMap<>(); + for(Edge e : pEdgesToMergeEnd) { startPoints.put(e, getConnectionPoint(e.start(), e, pDirection)); } @@ -316,7 +316,7 @@ private void storeMergedEndEdges(Side pDirection, List pEdgesToMergeEnd) midLineCoordinate = getVerticalMidLine(closestStartPoint, sharedEndPoint, pDirection, pEdgesToMergeEnd.get(0)); } //Build and store each edge's EdgePath - for (Edge edge : pEdgesToMergeEnd) + for(Edge edge : pEdgesToMergeEnd) { EdgePath path = buildSegmentedEdgePath(pDirection, startPoints.get(edge), midLineCoordinate, sharedEndPoint); aEdgeStorage.store(edge, path); @@ -336,8 +336,8 @@ private void storeMergedStartEdges(Side pDirection, List pEdgesToMergeStar //Get the shared start point for all pEdgesToMerge Point startPoint = getConnectionPoint(pEdgesToMergeStart.get(0).start(), pEdgesToMergeStart.get(0), pDirection); //Get the individual end points for each edge - Map endPoints = new HashMap(); - for (Edge edge : pEdgesToMergeStart) + Map endPoints = new HashMap<>(); + for(Edge edge : pEdgesToMergeStart) { endPoints.put(edge, getConnectionPoint(edge.end(), edge, pDirection.mirrored())); } @@ -356,7 +356,7 @@ private void storeMergedStartEdges(Side pDirection, List pEdgesToMergeStar pEdgesToMergeStart.get(0)); } //Build and store each edge's EdgePath - for (Edge edge : pEdgesToMergeStart) + for(Edge edge : pEdgesToMergeStart) { EdgePath path = buildSegmentedEdgePath(pDirection, startPoint, midLineCoordinate, endPoints.get(edge)); aEdgeStorage.store(edge, path); @@ -457,13 +457,13 @@ private int getHorizontalMidLine(Point pStart, Point pEnd, Side pEdgeDirection, //Check for any edge in storage which is attached to pEdge's start and end nodes // "Shared-node edges" require a different layout strategy: List storedEdgesWithSameNodes = aEdgeStorage.getEdgesWithSameNodes(pEdge); - if (!storedEdgesWithSameNodes.isEmpty()) + if(!storedEdgesWithSameNodes.isEmpty()) { return horizontalMidlineForSharedNodeEdges(storedEdgesWithSameNodes.get(0), pEdge, pEdgeDirection); } //Otherwise, find the closest edge which conflicts with pEdge Optional closestStoredEdge = closestConflictingHorizontalSegment(pEdgeDirection, pEdge); - if (closestStoredEdge.isEmpty()) + if(closestStoredEdge.isEmpty()) { //If there are no conflicting segments, return the y-coordinate equidistant between the start and end points return pEnd.getY() + ((pStart.getY() - pEnd.getY()) / 2); @@ -492,14 +492,14 @@ private int getVerticalMidLine(Point pStart, Point pEnd, Side pEdgeDirection, Ed assert pStart != null && pEnd != null; //Check for any edge in storage which shares the same 2 nodes as pEdge: List storedEdgesWithSameNodes = aEdgeStorage.getEdgesWithSameNodes(pEdge); - if (!storedEdgesWithSameNodes.isEmpty()) + if(!storedEdgesWithSameNodes.isEmpty()) { //"Shared-node edges" require a different layout strategy return verticalMidlineForSharedNodeEdges(storedEdgesWithSameNodes.get(0), pEdge, pEdgeDirection); } //Otherwise, find the closest edge which conflicts with pEdge Optional closestStoredEdge = closestConflictingVerticalSegment(pEdgeDirection, pEdge); - if (closestStoredEdge.isEmpty()) + if(closestStoredEdge.isEmpty()) { //If no stored edges conflict with pEdge then return the x-coordinate in between the start and end points return pEnd.getX() + ((pStart.getX() - pEnd.getX()) / 2); @@ -581,13 +581,13 @@ private Optional closestConflictingHorizontalSegment(Side pEdgeDirection, List conflictingEdges = storedConflictingEdges(pEdgeDirection.mirrored(), pEdge.end(), pEdge); //also consider edges which are connected to pEdge.getStart() which are in the way of pEdge conflictingEdges.addAll(storedConflictingEdges(pEdgeDirection, pEdge.start(), pEdge)); - if (conflictingEdges.isEmpty()) + if(conflictingEdges.isEmpty()) { return Optional.empty(); } else { //For Aggregation/Composition edges: return the Edge with the middle segment which is closest to pEdge's start node - if (pEdge instanceof AggregationEdge) + if(pEdge instanceof AggregationEdge) { return conflictingEdges.stream() .min(Comparator.comparing(edge -> verticalDistanceToNode(pEdge.start(), edge, pEdgeDirection))); @@ -618,13 +618,13 @@ private Optional closestConflictingVerticalSegment(Side pEdgeDirection, Ed List conflictingEdges = storedConflictingEdges(pEdgeDirection.mirrored(), pEdge.end(), pEdge); //Also consider edges connected to pEdge's start node which could conflict with pEdge's middle segment conflictingEdges.addAll(storedConflictingEdges(pEdgeDirection, pEdge.start(), pEdge)); - if (conflictingEdges.isEmpty()) + if(conflictingEdges.isEmpty()) { return Optional.empty(); } else { //for AggregationEdges: return the Edge with the middle segment which is closest to pEdge.getStart() - if (pEdge instanceof AggregationEdge) + if(pEdge instanceof AggregationEdge) { return conflictingEdges.stream() .min(Comparator.comparing(edge -> horizontalDistanceToNode(pEdge.start(), edge, pEdgeDirection))); @@ -656,7 +656,7 @@ private int adjacentHorizontalMidLine(Edge pClosestStoredEdge, Edge pEdge, Side Node commonNode = getSharedNode(pClosestStoredEdge, pEdge); if(pEdgeDirection == Side.TOP) { - if (isOutgoingEdge(pEdge, commonNode)) + if(isOutgoingEdge(pEdge, commonNode)) { return getEdgePath(pClosestStoredEdge).getPointByIndex(1).getY() + TEN_PIXELS; } @@ -667,7 +667,7 @@ private int adjacentHorizontalMidLine(Edge pClosestStoredEdge, Edge pEdge, Side } else //Direction is BOTTOM { - if (isOutgoingEdge(pEdge, commonNode)) + if(isOutgoingEdge(pEdge, commonNode)) { return getEdgePath(pClosestStoredEdge).getPointByIndex(1).getY() - TEN_PIXELS; } @@ -698,7 +698,7 @@ private int adjacentVerticalMidLine(Edge pClosestStoredEdge, Edge pEdge, Side pE Node commonNode = getSharedNode(pClosestStoredEdge, pEdge); if(pEdgeDirection == Side.LEFT) { - if (isOutgoingEdge(pEdge, commonNode)) + if(isOutgoingEdge(pEdge, commonNode)) { return getEdgePath(pClosestStoredEdge).getPointByIndex(1).getX() + TEN_PIXELS; } @@ -709,7 +709,7 @@ private int adjacentVerticalMidLine(Edge pClosestStoredEdge, Edge pEdge, Side pE } else //Direction is RIGHT { - if (isOutgoingEdge(pEdge, commonNode)) + if(isOutgoingEdge(pEdge, commonNode)) { return getEdgePath(pClosestStoredEdge).getPointByIndex(1).getX() - TEN_PIXELS; } @@ -732,7 +732,7 @@ private static Node getSharedNode(Edge pEdgeA, Edge pEdgeB) { assert pEdgeA.start() == pEdgeB.start() || pEdgeA.start() == pEdgeB.end() || pEdgeA.end() == pEdgeB.start() || pEdgeA.end() == pEdgeB.end(); - if (pEdgeA.start().equals(pEdgeB.start()) || pEdgeA.start().equals(pEdgeB.end())) + if(pEdgeA.start().equals(pEdgeB.start()) || pEdgeA.start().equals(pEdgeB.end())) { return pEdgeA.start(); } @@ -777,7 +777,7 @@ private Side attachedSideFromStorage(Edge pEdge, Node pNode) assert pEdge.start() == pNode || pEdge.end() == pNode; //Get the connection point of pEdge onto pNode Point connectionPoint = getEdgePath(pEdge).getStartPoint(); - if (!isOutgoingEdge(pEdge, pNode)) + if(!isOutgoingEdge(pEdge, pNode)) { connectionPoint = getEdgePath(pEdge).getEndPoint(); } @@ -854,7 +854,7 @@ else if( pDirection == Side.BOTTOM) return pPoints.stream() .max((p1, p2) -> Integer.compare(p1.getY(), p2.getY())).orElseGet(null); } - else if (pDirection == Side.RIGHT) + else if(pDirection == Side.RIGHT) {//Then return the point with the largest X-coordinate return pPoints.stream() .max((p1, p2)-> Integer.compare(p1.getX() , p2.getX())).orElseGet(null); @@ -876,7 +876,7 @@ else if (pDirection == Side.RIGHT) private static boolean noConflictingStartLabels(Edge pEdge1, Edge pEdge2) { assert pEdge1 !=null && pEdge2 !=null; - if (pEdge1 instanceof ThreeLabelEdge && pEdge2 instanceof ThreeLabelEdge && + if(pEdge1 instanceof ThreeLabelEdge && pEdge2 instanceof ThreeLabelEdge && priorityOf(pEdge1) == priorityOf(pEdge2)) { ThreeLabelEdge labelEdge1 = (ThreeLabelEdge) pEdge1; @@ -899,7 +899,7 @@ private static boolean noConflictingStartLabels(Edge pEdge1, Edge pEdge2) private static boolean noConflictingEndLabels(Edge pEdge1, Edge pEdge2) { assert pEdge1 !=null && pEdge2 !=null; - if (pEdge1 instanceof ThreeLabelEdge && pEdge2 instanceof ThreeLabelEdge && + if(pEdge1 instanceof ThreeLabelEdge && pEdge2 instanceof ThreeLabelEdge && priorityOf(pEdge1) == priorityOf(pEdge2)) { ThreeLabelEdge labelEdge1 = (ThreeLabelEdge) pEdge1; @@ -927,7 +927,7 @@ private boolean noOtherEdgesBetween(Edge pEdge1, Edge pEdge2, Node pNode) assert pEdge1.start() == pNode || pEdge1.end() == pNode; assert pEdge2.start() == pNode || pEdge2.end() == pNode; assert attachedSide(pEdge1, pNode) == attachedSide(pEdge2, pNode); - if (pEdge1.equals(pEdge2)) + if(pEdge1.equals(pEdge2)) { return true; } @@ -996,7 +996,7 @@ private Point getConnectionPoint(Node pNode, Edge pEdge, Side pAttachmentSide) //Get the index sign (either -1 or +1) int indexSign = getIndexSign(pEdge, pNode, pAttachmentSide); //Get the first available connection point, starting at NodeIndex ZERO and moving outwards - for (int offset = 0; offset <= maxIndex; offset++) + for(int offset = 0; offset <= maxIndex; offset++) { int ordinal = 4 + (indexSign * offset); NodeIndex index = NodeIndex.values()[ordinal]; @@ -1025,7 +1025,7 @@ private static Node getOtherNode(Edge pEdge, Node pNode) assert pEdge!=null; assert pNode!=null; assert pEdge.start() == pNode || pEdge.end() == pNode; - if (pEdge.start() == pNode) + if(pEdge.start() == pNode) { return pEdge.end(); } @@ -1056,7 +1056,7 @@ private int getIndexSign(Edge pEdge, Node pNode, Side pSideOfNode) assert pEdge.start() == pNode || pEdge.end() == pNode; //Check whether there are any stored edges which are connected to both pEdge.getStart() and pEdge.getEnd() List edgesWithSameNodes = aEdgeStorage.getEdgesWithSameNodes(pEdge); - if (!edgesWithSameNodes.isEmpty()) + if(!edgesWithSameNodes.isEmpty()) { //For shared-nod edge: index sign on start node should always be same as end node index sign return indexSignOnNode(pEdge, pEdge.end(), pEdge.start(), attachedSide(pEdge, pEdge.end())); } @@ -1083,7 +1083,7 @@ private int indexSignOnNode(Edge pEdge, Node pNode, Node pOtherNode, Side pSideO assert getOtherNode(pEdge, pNode).equals(pOtherNode); if( pSideOfNode.isHorizontal() ) //then compare X-coordinates { - if (getBounds(pNode).getCenter().getX() <= getBounds(pOtherNode).getCenter().getX()) + if(getBounds(pNode).getCenter().getX() <= getBounds(pOtherNode).getCenter().getX()) { return 1; } @@ -1094,7 +1094,7 @@ private int indexSignOnNode(Edge pEdge, Node pNode, Node pOtherNode, Side pSideO } else //Side of node is East/West, so we need to compare Y-coordinates { - if (getBounds(pNode).getCenter().getY() <= getBounds(pOtherNode).getCenter().getY()) + if(getBounds(pNode).getCenter().getY() <= getBounds(pOtherNode).getCenter().getY()) { return 1; } @@ -1135,12 +1135,12 @@ private Side attachedSide(Edge pEdge, Node pNode) stored node onto pNode. (These are referred to as "shared-node edges"). */ List edgesWithSameNodes = aEdgeStorage.getEdgesWithSameNodes(pEdge); - if (!edgesWithSameNodes.isEmpty()) + if(!edgesWithSameNodes.isEmpty()) { return attachedSideFromStorage(edgesWithSameNodes.get(0), pNode); } //AggregationEdges prefer to attach on East/West sides, unless nodes are directly above/below each other - if (pEdge instanceof AggregationEdge) + if(pEdge instanceof AggregationEdge) { startAttachedSide = attachedSidePreferringEastWest(pEdge); } @@ -1150,7 +1150,7 @@ private Side attachedSide(Edge pEdge, Node pNode) startAttachedSide = attachedSidePreferringNorthSouth(pEdge); } //The attached side of pEdge to its end node is always opposite of the attachment side to its start node - if (isOutgoingEdge(pEdge, pNode)) + if(isOutgoingEdge(pEdge, pNode)) { return startAttachedSide; } @@ -1174,7 +1174,7 @@ private Side attachedSidePreferringEastWest(Edge pEdge) Rectangle startNodeBounds = getBounds(pEdge.start()); Rectangle endNodeBounds = getBounds(pEdge.end()); //if the start node is above or below the end node (+- 20 px) then determine whether it belongs on the N or S side - if (startNodeBounds.getMaxX() > endNodeBounds.getX() - (2 * TEN_PIXELS) && + if(startNodeBounds.getMaxX() > endNodeBounds.getX() - (2 * TEN_PIXELS) && startNodeBounds.getX() < endNodeBounds.getMaxX() + (2 * TEN_PIXELS)) { return northSouthSideUnlessTooClose(pEdge); @@ -1197,7 +1197,7 @@ private Side attachedSidePreferringNorthSouth(Edge pEdge) Rectangle startNodeBounds = getBounds(pEdge.start()); Rectangle endNodeBounds = getBounds(pEdge.end()); //if the start node is beside the end node (+- 20 px) then compute whether it belongs on the E or W side - if (startNodeBounds.getMaxY() > endNodeBounds.getY() - (2 * TEN_PIXELS) && + if(startNodeBounds.getMaxY() > endNodeBounds.getY() - (2 * TEN_PIXELS) && startNodeBounds.getY() < endNodeBounds.getMaxY() + (2 * TEN_PIXELS)) { return eastWestSideUnlessTooClose(pEdge); @@ -1261,7 +1261,7 @@ private Side eastWestSideUnlessTooClose(Edge pEdge) private static Side northOrSouthSide(Rectangle pBounds, Rectangle pOtherBounds) { assert pBounds != null && pOtherBounds != null; - if (pOtherBounds.getCenter().getY() < pBounds.getCenter().getY()) + if(pOtherBounds.getCenter().getY() < pBounds.getCenter().getY()) { return Side.TOP; } diff --git a/src/org/jetuml/rendering/EdgePriority.java b/src/org/jetuml/rendering/EdgePriority.java index fa92c7cb4..63f11ce1d 100644 --- a/src/org/jetuml/rendering/EdgePriority.java +++ b/src/org/jetuml/rendering/EdgePriority.java @@ -45,13 +45,13 @@ public enum EdgePriority public static EdgePriority priorityOf(Edge pEdge) { assert pEdge != null; - if (pEdge.start()!= null && pEdge.end() != null && pEdge.start().equals(pEdge.end())) + if(pEdge.start()!= null && pEdge.end() != null && pEdge.start().equals(pEdge.end())) { return EdgePriority.SELF_EDGE; } - else if (pEdge instanceof GeneralizationEdge) + else if(pEdge instanceof GeneralizationEdge) { - if (((GeneralizationEdge) pEdge).getType() == GeneralizationEdge.Type.Inheritance) + if(((GeneralizationEdge) pEdge).getType() == GeneralizationEdge.Type.Inheritance) { return EdgePriority.INHERITANCE; } @@ -60,9 +60,9 @@ else if (pEdge instanceof GeneralizationEdge) return EdgePriority.IMPLEMENTATION; } } - else if (pEdge instanceof AggregationEdge) + else if(pEdge instanceof AggregationEdge) { - if (((AggregationEdge) pEdge).getType() == AggregationEdge.Type.Aggregation) + if(((AggregationEdge) pEdge).getType() == AggregationEdge.Type.Aggregation) { return EdgePriority.AGGREGATION; } @@ -71,11 +71,11 @@ else if (pEdge instanceof AggregationEdge) return EdgePriority.COMPOSITION; } } - else if (pEdge instanceof AssociationEdge) + else if(pEdge instanceof AssociationEdge) { return EdgePriority.ASSOCIATION; } - else if (pEdge instanceof DependencyEdge) + else if(pEdge instanceof DependencyEdge) { return EdgePriority.DEPENDENCY; } @@ -95,7 +95,7 @@ else if (pEdge instanceof DependencyEdge) public static boolean isSegmented(EdgePriority pPriority) { assert pPriority != null; - if (pPriority == EdgePriority.INHERITANCE || pPriority == EdgePriority.IMPLEMENTATION) + if(pPriority == EdgePriority.INHERITANCE || pPriority == EdgePriority.IMPLEMENTATION) { return true; } diff --git a/src/org/jetuml/rendering/NodeCorner.java b/src/org/jetuml/rendering/NodeCorner.java index 683e8fb94..75a436444 100644 --- a/src/org/jetuml/rendering/NodeCorner.java +++ b/src/org/jetuml/rendering/NodeCorner.java @@ -39,7 +39,7 @@ public enum NodeCorner */ public static NodeIndex getHorizontalIndex(NodeCorner pCorner) { - if (pCorner == BOTTOM_RIGHT || pCorner == TOP_RIGHT) + if(pCorner == BOTTOM_RIGHT || pCorner == TOP_RIGHT) { return NodeIndex.PLUS_THREE; } @@ -56,7 +56,7 @@ public static NodeIndex getHorizontalIndex(NodeCorner pCorner) */ public static NodeIndex getVerticalIndex(NodeCorner pCorner) { - if (pCorner == TOP_LEFT || pCorner == TOP_RIGHT) + if(pCorner == TOP_LEFT || pCorner == TOP_RIGHT) { return NodeIndex.MINUS_ONE; } @@ -75,7 +75,7 @@ public static NodeIndex getVerticalIndex(NodeCorner pCorner) public static Direction horizontalSide(NodeCorner pCorner) { assert pCorner != null; - if (pCorner == TOP_RIGHT || pCorner == TOP_LEFT) + if(pCorner == TOP_RIGHT || pCorner == TOP_LEFT) { return Direction.NORTH; } @@ -94,7 +94,7 @@ public static Direction horizontalSide(NodeCorner pCorner) public static Direction verticalSide(NodeCorner pCorner) { assert pCorner != null; - if (pCorner == TOP_RIGHT || pCorner == BOTTOM_RIGHT) + if(pCorner == TOP_RIGHT || pCorner == BOTTOM_RIGHT) { return Direction.EAST; } diff --git a/src/org/jetuml/rendering/SequenceDiagramRenderer.java b/src/org/jetuml/rendering/SequenceDiagramRenderer.java index 58512425d..538c77bce 100644 --- a/src/org/jetuml/rendering/SequenceDiagramRenderer.java +++ b/src/org/jetuml/rendering/SequenceDiagramRenderer.java @@ -398,7 +398,7 @@ private static int getDropDistance() { int shift = NODE_GAP_TESTER.getDimension(TEST_STRING).height() / 3; // Only apply shift if necessary - if ( shift < CALL_DROP ) + if( shift < CALL_DROP ) { return DROP_MIN; } @@ -442,7 +442,7 @@ else if( pEdge.getClass() == ConstructorEdge.class ) { // We delete the start node of pEdge if it does not have any caller and only makes calls to the // object being constructed. - if ( getCaller(pEdge.start()).isEmpty() && + if( getCaller(pEdge.start()).isEmpty() && onlyCallsToASingleImplicitParameterNode(pEdge.start(), pEdge.end().getParent()) ) { return Optional.of(pEdge.start()); diff --git a/src/org/jetuml/rendering/StringRenderer.java b/src/org/jetuml/rendering/StringRenderer.java index c6c5a153f..8a709ed11 100644 --- a/src/org/jetuml/rendering/StringRenderer.java +++ b/src/org/jetuml/rendering/StringRenderer.java @@ -101,7 +101,7 @@ public enum TextDecoration private StringRenderer(Alignment pAlign, EnumSet pDecorations) { - if ( !pDecorations.contains(TextDecoration.PADDED) ) + if( !pDecorations.contains(TextDecoration.PADDED) ) { aHorizontalPadding = 0; aVerticalPadding = 0; @@ -175,10 +175,10 @@ public static String wrapString(String pString, int pWidth) String[] words = pString.split(" "); StringBuilder formattedString = new StringBuilder(); - for ( String word : words ) + for( String word : words ) { // Replace last space with newline (if last space exists) - if ( word.length() > remainingEmptySpace && formattedString.length() > 0 ) + if( word.length() > remainingEmptySpace && formattedString.length() > 0 ) { formattedString.deleteCharAt(formattedString.length() - 1); formattedString.append('\n'); @@ -197,11 +197,11 @@ public static String wrapString(String pString, int pWidth) private TextAlignment getTextAlignment() { - if ( aAlign.isLeft() ) + if( aAlign.isLeft() ) { return TextAlignment.LEFT; } - else if ( aAlign.isHorizontallyCentered() ) + else if( aAlign.isHorizontallyCentered() ) { return TextAlignment.CENTER; } @@ -210,11 +210,11 @@ else if ( aAlign.isHorizontallyCentered() ) private VPos getTextBaseline() { - if ( aAlign.isBottom() ) + if( aAlign.isBottom() ) { return VPos.BASELINE; } - else if ( aAlign.isTop() ) + else if( aAlign.isTop() ) { return VPos.TOP; } @@ -246,7 +246,7 @@ public void draw(String pString, GraphicsContext pGraphics, Rectangle pRectangle textX = aHorizontalPadding; } - if ( aAlign.isVerticallyCentered() ) + if( aAlign.isVerticallyCentered() ) { textY = pRectangle.getHeight()/2; } diff --git a/src/org/jetuml/rendering/ToolGraphics.java b/src/org/jetuml/rendering/ToolGraphics.java index 2544a0fdf..d494928ef 100644 --- a/src/org/jetuml/rendering/ToolGraphics.java +++ b/src/org/jetuml/rendering/ToolGraphics.java @@ -175,7 +175,7 @@ else if(element instanceof LineTo) { pGraphics.lineTo(((int)((LineTo) element).getX()) + 0.5, ((int)((LineTo) element).getY()) + 0.5); } - else if (element instanceof QuadCurveTo) + else if(element instanceof QuadCurveTo) { QuadCurveTo curve = (QuadCurveTo) element; pGraphics.quadraticCurveTo(((int)curve.getControlX())+0.5, ((int)curve.getControlY()) + 0.5, diff --git a/src/org/jetuml/rendering/edges/AbstractEdgeRenderer.java b/src/org/jetuml/rendering/edges/AbstractEdgeRenderer.java index 927edea93..ecf4898d5 100644 --- a/src/org/jetuml/rendering/edges/AbstractEdgeRenderer.java +++ b/src/org/jetuml/rendering/edges/AbstractEdgeRenderer.java @@ -148,7 +148,7 @@ protected String wrapLabel(String pString, int pDistanceInX, int pDistanceInY) int lineLength = MAX_LENGTH_FOR_NORMAL_FONT; double distanceInX = pDistanceInX / singleCharWidth; double distanceInY = pDistanceInY / singleCharHeight; - if (distanceInX > 0) + if(distanceInX > 0) { double angleInDegrees = Math.toDegrees(Math.atan(distanceInY/distanceInX)); lineLength = Math.max(MAX_LENGTH_FOR_NORMAL_FONT, (int)((distanceInX / 4) * (1 - angleInDegrees / DEGREES_180))); diff --git a/src/org/jetuml/rendering/edges/EdgeStorage.java b/src/org/jetuml/rendering/edges/EdgeStorage.java index fdab50853..273e9c91a 100644 --- a/src/org/jetuml/rendering/edges/EdgeStorage.java +++ b/src/org/jetuml/rendering/edges/EdgeStorage.java @@ -119,7 +119,7 @@ public boolean connectionPointIsAvailable(Point pConnectionPoint) assert pConnectionPoint !=null; for( EdgePath path : aEdgePaths.values() ) { - if (path.getStartPoint().equals(pConnectionPoint) || path.getEndPoint().equals(pConnectionPoint)) + if(path.getStartPoint().equals(pConnectionPoint) || path.getEndPoint().equals(pConnectionPoint)) { return false; } diff --git a/src/org/jetuml/rendering/edges/ObjectReferenceEdgeRenderer.java b/src/org/jetuml/rendering/edges/ObjectReferenceEdgeRenderer.java index 336910f48..710dfef47 100644 --- a/src/org/jetuml/rendering/edges/ObjectReferenceEdgeRenderer.java +++ b/src/org/jetuml/rendering/edges/ObjectReferenceEdgeRenderer.java @@ -143,7 +143,7 @@ public void draw(DiagramElement pElement, GraphicsContext pGraphics) public Line getConnectionPoints(Edge pEdge) { Point point = parent().getConnectionPoints(pEdge.start(), Direction.EAST); - if (isSShaped(pEdge)) + if(isSShaped(pEdge)) { return new Line(point, parent().getConnectionPoints(pEdge.end(), Direction.WEST)); } diff --git a/src/org/jetuml/rendering/edges/StateTransitionEdgeRenderer.java b/src/org/jetuml/rendering/edges/StateTransitionEdgeRenderer.java index 74727c4df..235222c93 100644 --- a/src/org/jetuml/rendering/edges/StateTransitionEdgeRenderer.java +++ b/src/org/jetuml/rendering/edges/StateTransitionEdgeRenderer.java @@ -212,7 +212,7 @@ else if( line.getY1() <= line.getY2() ) final double angleUpperBound = 3 * angleLowerBound; double angle = Math.abs(Math.atan2(line.getX2()-line.getX1(), line.getY2()-line.getY1())); double delta = textDimensions.height(); - if ( angleLowerBound <= angle && angle <= angleUpperBound ) + if( angleLowerBound <= angle && angle <= angleUpperBound ) { delta -= angle*RADIANS_TO_PIXELS; } @@ -308,7 +308,7 @@ private Shape getSelfEdgeShape(Edge pEdge) public boolean contains(DiagramElement pElement, Point pPoint) { boolean result = super.contains(pElement, pPoint); - if (getShape((Edge)pElement) instanceof Arc) + if(getShape((Edge)pElement) instanceof Arc) { Arc arc = (Arc) getShape((Edge)pElement); arc.setRadiusX(arc.getRadiusX() + 2 * MAX_DISTANCE); diff --git a/src/org/jetuml/rendering/edges/StoredEdgeRenderer.java b/src/org/jetuml/rendering/edges/StoredEdgeRenderer.java index d177cec4d..0a039c0d0 100644 --- a/src/org/jetuml/rendering/edges/StoredEdgeRenderer.java +++ b/src/org/jetuml/rendering/edges/StoredEdgeRenderer.java @@ -104,10 +104,10 @@ private static LineStyle getLineStyle(Edge pEdge) private static ArrowHead getArrowStart(Edge pEdge) { assert pEdge !=null; - if (pEdge instanceof AggregationEdge) + if(pEdge instanceof AggregationEdge) { AggregationEdge edge = (AggregationEdge) pEdge; - if (edge.getType() == Type.Composition) + if(edge.getType() == Type.Composition) { return ArrowHead.BLACK_DIAMOND; } @@ -116,17 +116,17 @@ private static ArrowHead getArrowStart(Edge pEdge) return ArrowHead.DIAMOND; } } - else if (pEdge instanceof AssociationEdge) + else if(pEdge instanceof AssociationEdge) { - if (((AssociationEdge) pEdge).getDirectionality() == Directionality.Bidirectional) + if(((AssociationEdge) pEdge).getDirectionality() == Directionality.Bidirectional) { return ArrowHead.V; } } - else if (pEdge instanceof DependencyEdge) + else if(pEdge instanceof DependencyEdge) { DependencyEdge edge = (DependencyEdge) pEdge; - if (edge.getDirectionality() == DependencyEdge.Directionality.Bidirectional) + if(edge.getDirectionality() == DependencyEdge.Directionality.Bidirectional) { return ArrowHead.V; } @@ -143,7 +143,7 @@ else if (pEdge instanceof DependencyEdge) private static ArrowHead getArrowEnd(Edge pEdge) { assert pEdge !=null; - if (pEdge instanceof GeneralizationEdge) + if(pEdge instanceof GeneralizationEdge) { return ArrowHead.TRIANGLE; } @@ -151,14 +151,14 @@ else if( pEdge instanceof AggregationEdge) { return ArrowHead.NONE; } - else if (pEdge instanceof DependencyEdge) + else if(pEdge instanceof DependencyEdge) { return ArrowHead.V; } - else if (pEdge instanceof AssociationEdge) + else if(pEdge instanceof AssociationEdge) { AssociationEdge edge = (AssociationEdge) pEdge; - if (edge.getDirectionality() == AssociationEdge.Directionality.Unidirectional || + if(edge.getDirectionality() == AssociationEdge.Directionality.Unidirectional || edge.getDirectionality() == AssociationEdge.Directionality.Bidirectional) { return ArrowHead.V; @@ -180,7 +180,7 @@ private Path getSegmentPath(Edge pEdge) Path shape = new Path(); EdgePath path = getStoredEdgePath(pEdge); shape.getElements().add(new MoveTo(path.getStartPoint().getX(), path.getStartPoint().getY())); - for (int i = 1; i < path.size(); i++) + for(int i = 1; i < path.size(); i++) { Point point = path.getPointByIndex(i); shape.getElements().add(new LineTo(point.getX(), point.getY())); @@ -213,7 +213,7 @@ private boolean isStepUp(Edge pEdge) private static void drawLabel(GraphicsContext pGraphics, Line pSegment, ArrowHead pArrowHead, String pString, boolean pCenter, boolean pIsStepUp) { - if (pString == null || pString.length() == 0) + if(pString == null || pString.length() == 0) { return; } @@ -221,7 +221,7 @@ private static void drawLabel(GraphicsContext pGraphics, Line pSegment, Rectangle bounds = getLabelBounds(pSegment, pArrowHead, label, pCenter, pIsStepUp); if(pCenter) { - if ( pSegment.getY2() >= pSegment.getY1() ) + if( pSegment.getY2() >= pSegment.getY1() ) { TOP_CENTERED_STRING_VIEWER.draw(label, pGraphics, bounds); } @@ -340,7 +340,7 @@ else if(pSegment.isVertical()) private static String getStartLabel(Edge pEdge) { assert pEdge !=null; - if (pEdge instanceof ThreeLabelEdge) + if(pEdge instanceof ThreeLabelEdge) { ThreeLabelEdge threeLabelEdge = (ThreeLabelEdge) pEdge; return threeLabelEdge.getStartLabel(); @@ -360,12 +360,12 @@ private static String getStartLabel(Edge pEdge) private static String getMiddleLabel(Edge pEdge) { assert pEdge !=null; - if (pEdge instanceof ThreeLabelEdge) + if(pEdge instanceof ThreeLabelEdge) { ThreeLabelEdge threeLabelEdge = (ThreeLabelEdge) pEdge; return threeLabelEdge.getMiddleLabel(); } - else if (pEdge instanceof SingleLabelEdge) + else if(pEdge instanceof SingleLabelEdge) { SingleLabelEdge singleLabelEdge = (SingleLabelEdge) pEdge; return singleLabelEdge.getMiddleLabel(); @@ -385,7 +385,7 @@ else if (pEdge instanceof SingleLabelEdge) private static String getEndLabel(Edge pEdge) { assert pEdge !=null; - if (pEdge instanceof ThreeLabelEdge) + if(pEdge instanceof ThreeLabelEdge) { ThreeLabelEdge threeLabelEdge = (ThreeLabelEdge) pEdge; return threeLabelEdge.getEndLabel(); @@ -475,7 +475,7 @@ public Canvas createIcon(DiagramType pDiagramType, DiagramElement pElement) public void drawSelectionHandles(DiagramElement pElement, GraphicsContext pGraphics) { EdgePath path = getStoredEdgePath((Edge)pElement); - if (path != null) + if(path != null) { ToolGraphics.drawHandles(pGraphics, new Line(path.getStartPoint(), path.getEndPoint())); } @@ -486,7 +486,7 @@ public boolean contains(DiagramElement pElement, Point pPoint) { // Purposefully does not include the arrow head and labels, which create large bounds. EdgePath path = getStoredEdgePath((Edge)pElement); - if (path == null) + if(path == null) { return false; } diff --git a/src/org/jetuml/rendering/nodes/NodeStorage.java b/src/org/jetuml/rendering/nodes/NodeStorage.java index bf2415d9a..94cefc6f4 100644 --- a/src/org/jetuml/rendering/nodes/NodeStorage.java +++ b/src/org/jetuml/rendering/nodes/NodeStorage.java @@ -43,11 +43,11 @@ public class NodeStorage */ public Rectangle getBounds(Node pNode, Function pBoundCalculator) { - if (!aIsActivated) + if(!aIsActivated) { return pBoundCalculator.apply(pNode); } - else if (aIsActivated && aNodeBounds.containsKey(pNode)) + else if(aIsActivated && aNodeBounds.containsKey(pNode)) { return aNodeBounds.get(pNode); } diff --git a/style/Style.xml b/style/Style.xml index 1418f622f..7191e02a5 100644 --- a/style/Style.xml +++ b/style/Style.xml @@ -66,7 +66,7 @@ - + diff --git a/test/org/jetuml/diagram/TestProperties.java b/test/org/jetuml/diagram/TestProperties.java index 515edb889..ae60ad402 100644 --- a/test/org/jetuml/diagram/TestProperties.java +++ b/test/org/jetuml/diagram/TestProperties.java @@ -154,7 +154,7 @@ public void testAddAt1of3AndSome() private int size() { int size = 0; - for (Iterator iterator = aProperties.iterator(); iterator.hasNext();) + for(Iterator iterator = aProperties.iterator(); iterator.hasNext();) { iterator.next(); size++; diff --git a/test/org/jetuml/gui/tips/TestTipJsons.java b/test/org/jetuml/gui/tips/TestTipJsons.java index e0b2c4d4c..dd107d59a 100644 --- a/test/org/jetuml/gui/tips/TestTipJsons.java +++ b/test/org/jetuml/gui/tips/TestTipJsons.java @@ -75,14 +75,14 @@ public void testTipJsons_atLeastTwoTips() throws URISyntaxException @Test public void testTipJsons_testAllTipIdsInRangeOpenableAsInputStream() { - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { - try (InputStream inputStream = TestTipJsons.class + try(InputStream inputStream = TestTipJsons.class .getResourceAsStream(String.format(TIP_FILE_PATH_FORMAT, id))) { assertTrue(inputStream != null); } - catch (IOException e) + catch(IOException e) { fail(); } @@ -92,7 +92,7 @@ public void testTipJsons_testAllTipIdsInRangeOpenableAsInputStream() @Test public void testTipJsons_testTipsCanBeOpenedAsJsonObjects() throws IOException { - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { JsonObject tip = loadTipAsJsonObject(id); assertTrue(tip != null); @@ -102,7 +102,7 @@ public void testTipJsons_testTipsCanBeOpenedAsJsonObjects() throws IOException @Test public void testTipJsons_testTipsHaveTwoFieldsOnly() throws IOException { - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { JsonObject jObj = loadTipAsJsonObject(id); assertEquals(jObj.numberOfProperties(), 2); @@ -114,7 +114,7 @@ public void testTipJsons_testTipTitleIsWellFormatted() throws IOException { assertTrue(tipsAllHaveField(TipFieldName.TITLE)); - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { JsonObject jObj = loadTipAsJsonObject(id); Object title = jObj.get(TipFieldName.TITLE.asString()); @@ -127,20 +127,20 @@ public void testTipJsons_testTipContentsAreWellFormatted() throws IOException { assertTrue(tipsAllHaveField(TipFieldName.CONTENT)); - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { JsonObject jObj = loadTipAsJsonObject(id); Object obj = jObj.get(TipFieldName.CONTENT.asString()); assertTrue(obj instanceof JsonArray); JsonArray jArr = (JsonArray) obj; - for (Object contentElement : jArr) + for(Object contentElement : jArr) { assertTrue(contentElement instanceof JsonObject); JsonObject contentElementJsonObj = (JsonObject) contentElement; assertEquals(contentElementJsonObj.numberOfProperties(), 1); - for (Media media : Media.values()) + for(Media media : Media.values()) { - if (contentElementJsonObj.hasProperty(media.name().toLowerCase())) + if(contentElementJsonObj.hasProperty(media.name().toLowerCase())) { return; } @@ -152,7 +152,7 @@ public void testTipJsons_testTipContentsAreWellFormatted() throws IOException private static boolean tipsAllHaveField(TipFieldName pTipFieldName) throws IOException { - for (int id = 1; id <= NUM_TIPS; id++) + for(int id = 1; id <= NUM_TIPS; id++) { JsonObject jObj = loadTipAsJsonObject(id); if (!jObj.hasProperty(pTipFieldName.asString())) diff --git a/test/org/jetuml/rendering/TestLayouter.java b/test/org/jetuml/rendering/TestLayouter.java index debcbabc9..da9f6e3ed 100644 --- a/test/org/jetuml/rendering/TestLayouter.java +++ b/test/org/jetuml/rendering/TestLayouter.java @@ -208,7 +208,7 @@ private void setUpLayoutMergedStartEdges(AggregationEdge.Type pType) aEdgeC = new AggregationEdge(pType); aEdgeD = new GeneralizationEdge(); - for (Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, aNodeE)) + for(Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, aNodeE)) { aDiagram.addRootNode(node); } @@ -217,7 +217,7 @@ private void setUpLayoutMergedStartEdges(AggregationEdge.Type pType) aEdgeB.connect(aNodeD, aNodeB); aEdgeC.connect(aNodeD, aNodeC); aEdgeD.connect(aNodeE, aNodeD); - for (Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) + for(Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) { aDiagram.addEdge(edge); } @@ -247,7 +247,7 @@ private void setUpLayoutMergedEndEdges() aEdgeB = new GeneralizationEdge(Type.Inheritance); aEdgeC = new GeneralizationEdge(Type.Implementation); aEdgeD = new AssociationEdge(); - for (Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD,endNode)) + for(Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD,endNode)) { aDiagram.addRootNode(node); } @@ -256,7 +256,7 @@ private void setUpLayoutMergedEndEdges() aEdgeC.connect(aNodeC, endNode); aEdgeD.connect(aNodeD, endNode); - for (Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) + for(Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) { aDiagram.addEdge(edge); } @@ -280,7 +280,7 @@ private void setUpTestLayout() aEdgeE = new AggregationEdge(AggregationEdge.Type.Aggregation); aEdgeF = new AggregationEdge(AggregationEdge.Type.Composition); aEdgeG = new DependencyEdge(); - for (Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, aNodeE, aNodeF, aNodeG, endNode)) + for(Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, aNodeE, aNodeF, aNodeG, endNode)) { aDiagram.addRootNode(node); } @@ -292,7 +292,7 @@ private void setUpTestLayout() aEdgeF.connect(aNodeF, endNode); aEdgeG.connect(aNodeG, endNode); - for (Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD, aEdgeE, aEdgeF, aEdgeG)) + for(Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD, aEdgeE, aEdgeF, aEdgeG)) { aDiagram.addEdge(edge); } @@ -848,7 +848,7 @@ public void testGetEdgesToMergeEnd() public void testStoredConflictingEdges() { endNode = new ClassNode(); - for (Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, endNode)) + for(Node node : Arrays.asList(aNodeA, aNodeB, aNodeC, aNodeD, endNode)) { aDiagram.addRootNode(node); } @@ -860,7 +860,7 @@ public void testStoredConflictingEdges() aEdgeB.connect(aNodeB, endNode); aEdgeC.connect(aNodeC, endNode); aEdgeD.connect(aNodeD, endNode); - for (Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) + for(Edge edge : Arrays.asList(aEdgeA, aEdgeB, aEdgeC, aEdgeD)) { aDiagram.addEdge(edge); } diff --git a/test/org/jetuml/rendering/nodes/TestPerformance.java b/test/org/jetuml/rendering/nodes/TestPerformance.java index 80919054f..1aa24580e 100644 --- a/test/org/jetuml/rendering/nodes/TestPerformance.java +++ b/test/org/jetuml/rendering/nodes/TestPerformance.java @@ -52,7 +52,7 @@ public static void main(String[] pArgs) throws Exception DiagramRenderer renderer = DiagramType.newRendererInstanceFor(diagram); double avgExecutionTime = 0.0; - for (int i = 0; i < NUMBER_OF_TRIALS+1; i++) + for(int i = 0; i < NUMBER_OF_TRIALS+1; i++) { Instant start = Instant.now(); renderer.draw(graphicContext);