Skip to content

Commit

Permalink
Rename algorithm to VertiFlex
Browse files Browse the repository at this point in the history
refactors all qualified names and references to the new name
  • Loading branch information
Eddykasp committed Oct 13, 2023
1 parent ec0d332 commit a48f53d
Show file tree
Hide file tree
Showing 26 changed files with 82 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.elk.alg.yconstree</name>
<name>org.eclipse.elk.alg.vertiflex</name>
<comment></comment>
<projects>
</projects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.elk.alg.yconstree
Bundle-ManifestVersion: 2
Bundle-Name: ELK Y Constraint Tree Layout Algorithm
Bundle-SymbolicName: org.eclipse.elk.alg.yconstree;singleton:=true
Bundle-SymbolicName: org.eclipse.elk.alg.vertiflex;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Vendor: Eclipse Modeling Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.google.guava,
org.eclipse.elk.alg.common,
org.eclipse.elk.core,
org.eclipse.elk.graph
Export-Package: org.eclipse.elk.alg.yconstree
Export-Package: org.eclipse.elk.alg.vertiflex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.yconstree</artifactId>
<artifactId>org.eclipse.elk.alg.vertiflex</artifactId>
<name>ELK Y Constraint Tree Layout Algorithm</name>
<version>0.9.0-SNAPSHOT</version>
<description>Tree drawing algorithm with y-level constraints.</description>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.elk.alg.vertiflex.options.VertiFlexMetaDataProvider
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree;
package org.eclipse.elk.alg.vertiflex;

/**
* Strategies for routing edges in the tree layout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree;
package org.eclipse.elk.alg.vertiflex;

import org.eclipse.elk.alg.yconstree.p3relative.OutlineNode;
import org.eclipse.elk.alg.vertiflex.p3relative.OutlineNode;
import org.eclipse.elk.core.options.CoreOptions;
import org.eclipse.elk.core.options.PortConstraints;
import org.eclipse.elk.graph.ElkNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree
package org.eclipse.elk.alg.vertiflex

import org.eclipse.elk.alg.yconstree.EdgeRoutingStrategy
import org.eclipse.elk.alg.yconstree.YconstreeLayoutProvider
import org.eclipse.elk.alg.vertiflex.EdgeRoutingStrategy
import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutProvider
import org.eclipse.elk.core.math.ElkPadding

/**
* Declarations for the ELK Y Constraint Tree layout algorithm.
* Declarations for the ELK VertiFlex tree layout algorithm.
*/
bundle {
metadataClass options.YconstreeMetaDataProvider
idPrefix org.eclipse.elk.yconstree
metadataClass options.VertiFlexMetaDataProvider
idPrefix org.eclipse.elk.vertiflex
}

algorithm yconstree(YconstreeLayoutProvider) {
label "ELK Y Constraint Tree"
algorithm vertiflex(VertiFlexLayoutProvider) {
label "ELK VertiFlex"
description
"Tree layout algorithm that allows defining set vertical positions for nodes
rather than automatically placing nodes on levels according to their topology."
metadataClass options.YconstreeOptions
metadataClass options.VertiFlexOptions
category org.eclipse.elk.tree
features multi_edges, edge_labels
supports org.eclipse.elk.spacing.nodeNode = 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree;
package org.eclipse.elk.alg.vertiflex;

/**
* This algorithm's layout phases. Each phase has its own strategy factory.
*/
public enum YconstreeLayoutPhases {
public enum VertiFlexLayoutPhases {

/** Phase 1. Vertical placement of nodes.*/
P1_NODE_Y_PLACEMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree;
package org.eclipse.elk.alg.vertiflex;

import java.util.List;

import org.eclipse.elk.alg.yconstree.p2yplacement.NodeYPlacerStrategy;
import org.eclipse.elk.alg.yconstree.p3relative.RelativeXPlacerStrategy;
import org.eclipse.elk.alg.yconstree.p4absolute.AbsoluteXPlacerStrategy;
import org.eclipse.elk.alg.yconstree.p5edgerouting.EdgerouterStrategy;
import org.eclipse.elk.alg.vertiflex.p2yplacement.NodeYPlacerStrategy;
import org.eclipse.elk.alg.vertiflex.p3relative.RelativeXPlacerStrategy;
import org.eclipse.elk.alg.vertiflex.p4absolute.AbsoluteXPlacerStrategy;
import org.eclipse.elk.alg.vertiflex.p5edgerouting.EdgerouterStrategy;
import org.eclipse.elk.core.AbstractLayoutProvider;
import org.eclipse.elk.core.UnsupportedConfigurationException;
import org.eclipse.elk.core.alg.AlgorithmAssembler;
Expand All @@ -25,11 +25,11 @@
/**
* Layout provider for the y constraint tree layout algorithms.
*/
public final class YconstreeLayoutProvider extends AbstractLayoutProvider {
public final class VertiFlexLayoutProvider extends AbstractLayoutProvider {


private final AlgorithmAssembler<YconstreeLayoutPhases, ElkNode> algorithmAssembler =
AlgorithmAssembler.<YconstreeLayoutPhases, ElkNode>create(YconstreeLayoutPhases.class);
private final AlgorithmAssembler<VertiFlexLayoutPhases, ElkNode> algorithmAssembler =
AlgorithmAssembler.<VertiFlexLayoutPhases, ElkNode>create(VertiFlexLayoutPhases.class);

@Override
public void layout(final ElkNode graph, final IElkProgressMonitor progressMonitor) {
Expand All @@ -38,7 +38,7 @@ public void layout(final ElkNode graph, final IElkProgressMonitor progressMonito
progressMonitor.begin("Tree layout", algorithm.size());

// pre calculate the root node and save it
ElkNode root = YconstreeUtil.findRoot(graph);
ElkNode root = VertiFlexUtil.findRoot(graph);
graph.setProperty(InternalProperties.ROOT_NODE, root);
if (root == null) {
throw new UnsupportedConfigurationException("The given graph is not a tree!");
Expand Down Expand Up @@ -69,13 +69,13 @@ public List<ILayoutProcessor<ElkNode>> assembleAlgorithm(final ElkNode graph) {
algorithmAssembler.reset();

// Configure phases
algorithmAssembler.setPhase(YconstreeLayoutPhases.P1_NODE_Y_PLACEMENT,
algorithmAssembler.setPhase(VertiFlexLayoutPhases.P1_NODE_Y_PLACEMENT,
NodeYPlacerStrategy.SIMPLE_YPLACING);
algorithmAssembler.setPhase(YconstreeLayoutPhases.P2_NODE_RELATIVE_PLACEMENT,
algorithmAssembler.setPhase(VertiFlexLayoutPhases.P2_NODE_RELATIVE_PLACEMENT,
RelativeXPlacerStrategy.SIMPLE_XPLACING);
algorithmAssembler.setPhase(YconstreeLayoutPhases.P3_NODE_ABSOLUTE_PLACEMENT,
algorithmAssembler.setPhase(VertiFlexLayoutPhases.P3_NODE_ABSOLUTE_PLACEMENT,
AbsoluteXPlacerStrategy.ABSOLUTE_XPLACING);
algorithmAssembler.setPhase(YconstreeLayoutPhases.P4_EDGE_ROUTING,
algorithmAssembler.setPhase(VertiFlexLayoutPhases.P4_EDGE_ROUTING,
EdgerouterStrategy.DIRECT_ROUTING);

// Assemble the algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree;
package org.eclipse.elk.alg.vertiflex;

import org.eclipse.elk.graph.ElkEdge;
import org.eclipse.elk.graph.ElkNode;
import org.eclipse.elk.graph.util.ElkGraphUtil;

/** A class for smaller, independent calculation units. */
public final class YconstreeUtil {
public final class VertiFlexUtil {

/**
* Private constructor to prevent initilization.
*/
private YconstreeUtil() { }
private VertiFlexUtil() { }

/**
* Computes the root node of a graph.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p2yplacement;
package org.eclipse.elk.alg.vertiflex.p2yplacement;

import org.eclipse.elk.alg.yconstree.InternalProperties;
import org.eclipse.elk.alg.yconstree.YconstreeLayoutPhases;
import org.eclipse.elk.alg.yconstree.options.YconstreeOptions;
import org.eclipse.elk.alg.vertiflex.InternalProperties;
import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutPhases;
import org.eclipse.elk.alg.vertiflex.options.VertiFlexOptions;
import org.eclipse.elk.core.alg.ILayoutPhase;
import org.eclipse.elk.core.alg.LayoutProcessorConfiguration;
import org.eclipse.elk.core.util.IElkProgressMonitor;
Expand All @@ -22,7 +22,7 @@
* constraint and other nodes are positioned automatically according to their position in the tree.
*
*/
public class NodeYPlacer implements ILayoutPhase<YconstreeLayoutPhases, ElkNode> {
public class NodeYPlacer implements ILayoutPhase<VertiFlexLayoutPhases, ElkNode> {

private double layerDistance;
private IElkProgressMonitor myProgressMonitor;
Expand All @@ -33,7 +33,7 @@ public void process(final ElkNode graph, final IElkProgressMonitor progressMonit
myProgressMonitor = progressMonitor;
myProgressMonitor.begin("YPlacer", 1);

layerDistance = graph.getProperty(YconstreeOptions.LAYER_DISTANCE);
layerDistance = graph.getProperty(VertiFlexOptions.LAYER_DISTANCE);

if (!graph.getChildren().isEmpty()) {
ElkNode parent = graph.getProperty(InternalProperties.ROOT_NODE);
Expand All @@ -50,8 +50,8 @@ public void process(final ElkNode graph, final IElkProgressMonitor progressMonit
* @param minHeight: Node gets minimum this height.
*/
private void setYLevels(final ElkNode node, double minHeight) {
if (node.hasProperty(YconstreeOptions.VERTICAL_CONSTRAINT)) {
minHeight = node.getProperty(YconstreeOptions.VERTICAL_CONSTRAINT);
if (node.hasProperty(VertiFlexOptions.VERTICAL_CONSTRAINT)) {
minHeight = node.getProperty(VertiFlexOptions.VERTICAL_CONSTRAINT);
}
node.setY(minHeight);
double newMinHeight = minHeight + layerDistance + node.getHeight();
Expand All @@ -62,7 +62,7 @@ private void setYLevels(final ElkNode node, double minHeight) {
}

@Override
public LayoutProcessorConfiguration<YconstreeLayoutPhases, ElkNode>
public LayoutProcessorConfiguration<VertiFlexLayoutPhases, ElkNode>
getLayoutProcessorConfiguration(final ElkNode graph) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p2yplacement;
package org.eclipse.elk.alg.vertiflex.p2yplacement;

import org.eclipse.elk.alg.yconstree.YconstreeLayoutPhases;
import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutPhases;
import org.eclipse.elk.core.alg.ILayoutPhase;
import org.eclipse.elk.core.alg.ILayoutPhaseFactory;
import org.eclipse.elk.graph.ElkNode;
Expand All @@ -18,7 +18,7 @@
* Vertical node placement strategies.
*
*/
public enum NodeYPlacerStrategy implements ILayoutPhaseFactory<YconstreeLayoutPhases, ElkNode> {
public enum NodeYPlacerStrategy implements ILayoutPhaseFactory<VertiFlexLayoutPhases, ElkNode> {

/**
* Simple strategy for setting y coordinates of nodes. Vertical constraints are considered and if none are defined
Expand All @@ -27,7 +27,7 @@ public enum NodeYPlacerStrategy implements ILayoutPhaseFactory<YconstreeLayoutPh
SIMPLE_YPLACING;

@Override
public ILayoutPhase<YconstreeLayoutPhases, ElkNode> create() {
public ILayoutPhase<VertiFlexLayoutPhases, ElkNode> create() {
switch (this) {
case SIMPLE_YPLACING:
return new NodeYPlacer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p3relative;
package org.eclipse.elk.alg.vertiflex.p3relative;

import org.eclipse.elk.graph.ElkNode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p3relative;
package org.eclipse.elk.alg.vertiflex.p3relative;

/**
* An outline node is the basic building block of outline. It has a position and a reference to the next outline node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p3relative;
package org.eclipse.elk.alg.vertiflex.p3relative;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.elk.alg.yconstree.InternalProperties;
import org.eclipse.elk.alg.yconstree.YconstreeLayoutPhases;
import org.eclipse.elk.alg.yconstree.options.YconstreeOptions;
import org.eclipse.elk.alg.vertiflex.InternalProperties;
import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutPhases;
import org.eclipse.elk.alg.vertiflex.options.VertiFlexOptions;
import org.eclipse.elk.core.alg.ILayoutPhase;
import org.eclipse.elk.core.alg.LayoutProcessorConfiguration;
import org.eclipse.elk.core.math.ElkMargin;
Expand All @@ -27,14 +27,14 @@
* Node placer that positions nodes horizontally using coordinates that are relative to parent nodes.
*
*/
public class RelativeXPlacer implements ILayoutPhase<YconstreeLayoutPhases, ElkNode> {
public class RelativeXPlacer implements ILayoutPhase<VertiFlexLayoutPhases, ElkNode> {


private IElkProgressMonitor myProgressMonitor;
private double spacingNodeNode;

// a constant for moving every Outline to a minimal y-pos
private final static double MINIMAL_Y = -100.0;
private static final double MINIMAL_Y = -100.0;

@Override
public void process(final ElkNode graph, final IElkProgressMonitor progressMonitor) {
Expand All @@ -46,7 +46,7 @@ public void process(final ElkNode graph, final IElkProgressMonitor progressMonit
if (!graph.getChildren().isEmpty()) {
ElkNode parent = graph.getProperty(InternalProperties.ROOT_NODE);

switch (graph.getProperty(YconstreeOptions.LAYOUT_STRATEGY)) {
switch (graph.getProperty(VertiFlexOptions.LAYOUT_STRATEGY)) {
case STRAIGHT:
yConsTreeStep(parent);
break;
Expand Down Expand Up @@ -513,7 +513,7 @@ private void bundleChildren(final ElkNode leftSubtree, final ElkNode a, final El
}

@Override
public LayoutProcessorConfiguration<YconstreeLayoutPhases, ElkNode>
public LayoutProcessorConfiguration<VertiFlexLayoutPhases, ElkNode>
getLayoutProcessorConfiguration(final ElkNode graph) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.elk.alg.yconstree.p3relative;
package org.eclipse.elk.alg.vertiflex.p3relative;

import org.eclipse.elk.alg.yconstree.YconstreeLayoutPhases;
import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutPhases;
import org.eclipse.elk.core.alg.ILayoutPhase;
import org.eclipse.elk.core.alg.ILayoutPhaseFactory;
import org.eclipse.elk.graph.ElkNode;
Expand All @@ -18,7 +18,7 @@
* Horizontal node placement strategies.
*
*/
public enum RelativeXPlacerStrategy implements ILayoutPhaseFactory<YconstreeLayoutPhases, ElkNode> {
public enum RelativeXPlacerStrategy implements ILayoutPhaseFactory<VertiFlexLayoutPhases, ElkNode> {

/**
* Simple strategy for setting the horizontal positions of nodes. These positions are relative to their parents
Expand All @@ -27,7 +27,7 @@ public enum RelativeXPlacerStrategy implements ILayoutPhaseFactory<YconstreeLayo
SIMPLE_XPLACING;

@Override
public ILayoutPhase<YconstreeLayoutPhases, ElkNode> create() {
public ILayoutPhase<VertiFlexLayoutPhases, ElkNode> create() {
switch (this) {
case SIMPLE_XPLACING:
return new RelativeXPlacer();
Expand Down
Loading

0 comments on commit a48f53d

Please sign in to comment.