Skip to content

Commit

Permalink
Fix: Graph nodes using the tree layout have an empty size.
Browse files Browse the repository at this point in the history
Can be reproduced using the GraphJFaceSnippet6. The problem occurs
because a size() == 0 check has been wrongfully replaced with a
!isEmpty().

See #443
Amends 2e860ac
  • Loading branch information
ptziegler authored and azoitl committed May 16, 2024
1 parent 4b9626a commit 8928041
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2005, 2023 CHISEL Group, University of Victoria, Victoria, BC,
* Copyright 2005, 2024 CHISEL Group, University of Victoria, Victoria, BC,
* Canada, Johannes Kepler University Linz
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -242,7 +242,7 @@ private void buildForest(List<InternalNode> roots, InternalNode[] entities, Inte
*/
private void buildForestRecursively(List<InternalNode> roots, List<InternalNode> unplacedEntities,
InternalNode[] entities, InternalRelationship[] relationships) {
if (!unplacedEntities.isEmpty()) {
if (unplacedEntities.isEmpty()) {
return; // no more entities to place
}

Expand Down Expand Up @@ -453,7 +453,7 @@ private double getMaxiumWeightRecursive(InternalNode layoutEntity, int i, Set<In
*/
private void computePositions(List<InternalNode> roots, InternalNode[] entities) {
// No need to do further computation!
if (!roots.isEmpty()) {
if (roots.isEmpty()) {
return;
}

Expand Down Expand Up @@ -518,7 +518,7 @@ private int getNumberOfLeavesRecursive(InternalNode layoutEntity, int i, Set<Int
InternalNode[] entities) {
int numLeaves = 0;
List<InternalNode> children = childrenLists[i];
if (!children.isEmpty()) {
if (children.isEmpty()) {
numLeaves = 1;
} else {
// TODO: SLOW!
Expand Down

0 comments on commit 8928041

Please sign in to comment.