From 3a17f555710279c6d9fbfd3700ccb1f1d2d63fe9 Mon Sep 17 00:00:00 2001 From: Mikael Capelle Date: Tue, 20 Feb 2018 12:03:18 +0100 Subject: [PATCH] Rename Instance -> Data. --- src/main/org/insa/algo/AbstractAlgorithm.java | 8 ++++---- .../{AbstractInstance.java => AbstractData.java} | 4 ++-- src/main/org/insa/algo/AbstractSolution.java | 8 ++++---- .../StronglyConnectedComponentsAlgorithm.java | 6 +++--- .../StronglyConnectedComponentsData.java | 16 ++++++++++++++++ .../StronglyConnectedComponentsInstance.java | 16 ---------------- .../StronglyConnectedComponentsSolution.java | 4 ++-- .../algo/strongconnectivity/TarjanAlgorithm.java | 2 +- .../WeaklyConnectedComponentsAlgorithm.java | 6 +++--- .../WeaklyConnectedComponentsData.java | 16 ++++++++++++++++ .../WeaklyConnectedComponentsInstance.java | 16 ---------------- .../WeaklyConnectedComponentsSolution.java | 4 ++-- src/main/org/insa/base/MainWindow.java | 10 +++++----- 13 files changed, 58 insertions(+), 58 deletions(-) rename src/main/org/insa/algo/{AbstractInstance.java => AbstractData.java} (74%) create mode 100644 src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsData.java delete mode 100644 src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsInstance.java create mode 100644 src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsData.java delete mode 100644 src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsInstance.java diff --git a/src/main/org/insa/algo/AbstractAlgorithm.java b/src/main/org/insa/algo/AbstractAlgorithm.java index 4f664c0..c487d4e 100644 --- a/src/main/org/insa/algo/AbstractAlgorithm.java +++ b/src/main/org/insa/algo/AbstractAlgorithm.java @@ -6,15 +6,15 @@ import java.util.ArrayList; public abstract class AbstractAlgorithm { - protected AbstractInstance instance; + protected AbstractData instance; protected ArrayList observers; - protected AbstractAlgorithm(AbstractInstance instance) { + protected AbstractAlgorithm(AbstractData instance) { this.instance = instance; this.observers = new ArrayList(); } - protected AbstractAlgorithm(AbstractInstance instance, ArrayList observers) { + protected AbstractAlgorithm(AbstractData instance, ArrayList observers) { this.instance = instance; this.observers = observers;; } @@ -38,7 +38,7 @@ public abstract class AbstractAlgorithm { /** * @return Instance corresponding to this algorithm. */ - public AbstractInstance getInstance() { return instance; } + public AbstractData getInstance() { return instance; } /** * Run the algorithm and update the current solution. diff --git a/src/main/org/insa/algo/AbstractInstance.java b/src/main/org/insa/algo/AbstractData.java similarity index 74% rename from src/main/org/insa/algo/AbstractInstance.java rename to src/main/org/insa/algo/AbstractData.java index 344ad82..0409aed 100644 --- a/src/main/org/insa/algo/AbstractInstance.java +++ b/src/main/org/insa/algo/AbstractData.java @@ -2,7 +2,7 @@ package org.insa.algo; import org.insa.graph.Graph; -public abstract class AbstractInstance { +public abstract class AbstractData { protected Graph graph; @@ -11,7 +11,7 @@ public abstract class AbstractInstance { * * @param graph */ - protected AbstractInstance(Graph graph) { + protected AbstractData(Graph graph) { this.graph = graph; } diff --git a/src/main/org/insa/algo/AbstractSolution.java b/src/main/org/insa/algo/AbstractSolution.java index bb23186..bb5acf3 100644 --- a/src/main/org/insa/algo/AbstractSolution.java +++ b/src/main/org/insa/algo/AbstractSolution.java @@ -22,20 +22,20 @@ public abstract class AbstractSolution { Duration solvingTime; // Original instance of the solution - AbstractInstance instance; + AbstractData instance; /** * Create a new abstract solution with unknown status. * * @param instance */ - protected AbstractSolution(AbstractInstance instance) { + protected AbstractSolution(AbstractData instance) { this.instance = instance; this.solvingTime = Duration.ZERO; this.status = Status.UNKNOWN; } - protected AbstractSolution(AbstractInstance instance, Status status) { + protected AbstractSolution(AbstractData instance, Status status) { this.instance = instance; this.status = status; } @@ -43,7 +43,7 @@ public abstract class AbstractSolution { /** * @return Original instance for this solution. */ - public AbstractInstance getInstance() { return instance; } + public AbstractData getInstance() { return instance; } /** * @return Status of this solution. diff --git a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsAlgorithm.java b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsAlgorithm.java index 183b69f..57d9f37 100644 --- a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsAlgorithm.java +++ b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsAlgorithm.java @@ -9,7 +9,7 @@ public abstract class StronglyConnectedComponentsAlgorithm extends AbstractAlgor * @param instance * @param logOutput */ - public StronglyConnectedComponentsAlgorithm(StronglyConnectedComponentsInstance instance) { + public StronglyConnectedComponentsAlgorithm(StronglyConnectedComponentsData instance) { super(instance); } @@ -19,8 +19,8 @@ public abstract class StronglyConnectedComponentsAlgorithm extends AbstractAlgor } @Override - public StronglyConnectedComponentsInstance getInstance() { - return (StronglyConnectedComponentsInstance)super.getInstance(); + public StronglyConnectedComponentsData getInstance() { + return (StronglyConnectedComponentsData)super.getInstance(); } } diff --git a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsData.java b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsData.java new file mode 100644 index 0000000..3ba899e --- /dev/null +++ b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsData.java @@ -0,0 +1,16 @@ +package org.insa.algo.strongconnectivity; + +import org.insa.algo.AbstractData; +import org.insa.graph.Graph; + +public class StronglyConnectedComponentsData extends AbstractData { + + /** + * + * @param graph + */ + public StronglyConnectedComponentsData(Graph graph) { + super(graph); + } + +} diff --git a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsInstance.java b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsInstance.java deleted file mode 100644 index 41ceceb..0000000 --- a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsInstance.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.insa.algo.strongconnectivity; - -import org.insa.algo.AbstractInstance; -import org.insa.graph.Graph; - -public class StronglyConnectedComponentsInstance extends AbstractInstance { - - /** - * - * @param graph - */ - public StronglyConnectedComponentsInstance(Graph graph) { - super(graph); - } - -} diff --git a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsSolution.java b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsSolution.java index 3503c72..f96297d 100644 --- a/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsSolution.java +++ b/src/main/org/insa/algo/strongconnectivity/StronglyConnectedComponentsSolution.java @@ -10,11 +10,11 @@ public class StronglyConnectedComponentsSolution extends AbstractSolution { // Components private ArrayList> components; - protected StronglyConnectedComponentsSolution(StronglyConnectedComponentsInstance instance) { + protected StronglyConnectedComponentsSolution(StronglyConnectedComponentsData instance) { super(instance); } - protected StronglyConnectedComponentsSolution(StronglyConnectedComponentsInstance instance, + protected StronglyConnectedComponentsSolution(StronglyConnectedComponentsData instance, Status status, ArrayList> components) { super(instance, status); this.components = components; diff --git a/src/main/org/insa/algo/strongconnectivity/TarjanAlgorithm.java b/src/main/org/insa/algo/strongconnectivity/TarjanAlgorithm.java index 0fe7fac..3cd8771 100644 --- a/src/main/org/insa/algo/strongconnectivity/TarjanAlgorithm.java +++ b/src/main/org/insa/algo/strongconnectivity/TarjanAlgorithm.java @@ -27,7 +27,7 @@ public class TarjanAlgorithm extends StronglyConnectedComponentsAlgorithm { // Array of strongly connected components ArrayList> components; - public TarjanAlgorithm(StronglyConnectedComponentsInstance instance) { + public TarjanAlgorithm(StronglyConnectedComponentsData instance) { super(instance); } diff --git a/src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsAlgorithm.java b/src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsAlgorithm.java index 50adb1b..2227e2c 100644 --- a/src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsAlgorithm.java +++ b/src/main/org/insa/algo/weakconnectivity/WeaklyConnectedComponentsAlgorithm.java @@ -19,7 +19,7 @@ public class WeaklyConnectedComponentsAlgorithm extends AbstractAlgorithm> components; - protected WeaklyConnectedComponentsSolution(WeaklyConnectedComponentsInstance instance) { + protected WeaklyConnectedComponentsSolution(WeaklyConnectedComponentsData instance) { super(instance); } - protected WeaklyConnectedComponentsSolution(WeaklyConnectedComponentsInstance instance, + protected WeaklyConnectedComponentsSolution(WeaklyConnectedComponentsData instance, Status status, ArrayList> components) { super(instance, status); this.components = components; diff --git a/src/main/org/insa/base/MainWindow.java b/src/main/org/insa/base/MainWindow.java index d9e9cc9..a589c55 100644 --- a/src/main/org/insa/base/MainWindow.java +++ b/src/main/org/insa/base/MainWindow.java @@ -41,12 +41,12 @@ import javax.swing.filechooser.FileNameExtensionFilter; import org.insa.algo.shortestpath.BellmanFordAlgorithm; import org.insa.algo.shortestpath.ShortestPathAlgorithm; import org.insa.algo.shortestpath.ShortestPathGraphicObserver; -import org.insa.algo.shortestpath.ShortestPathInstance; -import org.insa.algo.shortestpath.ShortestPathInstance.Mode; +import org.insa.algo.shortestpath.ShortestPathData; +import org.insa.algo.shortestpath.ShortestPathData.Mode; import org.insa.algo.shortestpath.ShortestPathSolution; import org.insa.algo.weakconnectivity.WeaklyConnectedComponentGraphicObserver; import org.insa.algo.weakconnectivity.WeaklyConnectedComponentsAlgorithm; -import org.insa.algo.weakconnectivity.WeaklyConnectedComponentsInstance; +import org.insa.algo.weakconnectivity.WeaklyConnectedComponentsData; import org.insa.drawing.Drawing; import org.insa.drawing.graph.BlackAndWhiteGraphPalette; import org.insa.drawing.graph.GraphDrawing; @@ -456,7 +456,7 @@ public class MainWindow extends JFrame { wccItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - WeaklyConnectedComponentsInstance instance = new WeaklyConnectedComponentsInstance(graph); + WeaklyConnectedComponentsData instance = new WeaklyConnectedComponentsData(graph); WeaklyConnectedComponentsAlgorithm algo = new WeaklyConnectedComponentsAlgorithm(instance); algo.addObserver(new WeaklyConnectedComponentGraphicObserver(drawing)); // algo.addObserver(new WeaklyConnectedComponentTextObserver(printStream)); @@ -485,7 +485,7 @@ public class MainWindow extends JFrame { @Override public void call(ArrayList nodes) { launchShortestPathThread(new BellmanFordAlgorithm( - new ShortestPathInstance(graph, nodes.get(0), nodes.get(1), mode))); + new ShortestPathData(graph, nodes.get(0), nodes.get(1), mode))); } }); }