diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java b/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java index cb54e9179257c3e961a92fb7a51d6d50a27b2a7e..dbf57cc9c3fbca33b63de4bdcad3f8b655cbafa3 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java @@ -55,8 +55,8 @@ import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.NetChangeListener; import de.hhu.ba.yoshikoWrapper.core.YoshUtil; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; -import de.hhu.ba.yoshikoWrapper.gui.HintManager; -import de.hhu.ba.yoshikoWrapper.gui.MainPanel; +import de.hhu.ba.yoshikoWrapper.swing.HintManager; +import de.hhu.ba.yoshikoWrapper.swing.components.MainPanel; /** * Entry point for the application as required by the Cytoscape API diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java index 58ec22117215531a4dc0af61245007d8fe470329..dbdfd41503c6efacdc3be5c018aae111fa73814a 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java @@ -1,16 +1,16 @@ /******************************************************************************* * Copyright (C) 2017 Philipp Spohr - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,8 +24,6 @@ package de.hhu.ba.yoshikoWrapper.core; import java.awt.Window; import java.util.Properties; -import javax.swing.JOptionPane; - import org.cytoscape.application.swing.CytoPanel; import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelName; @@ -39,19 +37,18 @@ import org.slf4j.Logger; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoResult; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; -import de.hhu.ba.yoshikoWrapper.gui.ResultPanel; import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; import de.hhu.ba.yoshikoWrapper.swig.ClusterEditingSolutions; import de.hhu.ba.yoshikoWrapper.swig.CoreAlgorithm; -import de.hhu.ba.yoshikoWrapper.swig.CplexInformer; import de.hhu.ba.yoshikoWrapper.swig.IntVector; import de.hhu.ba.yoshikoWrapper.swig.LibraryInput; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; +import de.hhu.ba.yoshikoWrapper.swing.components.ResultPanel; public class AlgorithmTask extends AbstractTask { - - + + //Symbolic links private static Logger logger = YoshikoLogger.getInstance().getLogger(); private Window statusWindow; @@ -59,19 +56,19 @@ public class AlgorithmTask extends AbstractTask { //Parameters private final ParameterSet parameterSet; private final CyNetwork net; - + //Temps, need to be freed in C++ private LibraryInput input; private ClusterEditingSolutions result; private CoreAlgorithm ca; - - private ResultPanel resultPanel; + + private ResultPanel resultPanel; public AlgorithmTask(// <<< Too many variables here, some should be grouped later TODO: Window statusWindow, CyNetwork net, ParameterSet parameterSet - ) + ) { this.statusWindow = statusWindow; this.net = net; @@ -84,13 +81,13 @@ public class AlgorithmTask extends AbstractTask { taskMonitor.setTitle(LocalizationManager.get("yoshTask")); taskMonitor.setProgress(0.0); - + //Get current network if (net == null) { logger.warn("CoreAlgorithm called on a net that is NULL!"); throw new Exception("CoreAlgorithm called on a net that is NULL!"); } - + //Set time limit LibraryInterface.setTimeLimit(parameterSet.timeLimit); if (parameterSet.disableMultiThreading) { @@ -109,7 +106,7 @@ public class AlgorithmTask extends AbstractTask { net, nodeMap, parameterSet.weightColumn, - parameterSet.permanentColumn, + parameterSet.permanentColumn, parameterSet.forbiddenColumn, parameterSet.defaultDeletionCost ); @@ -117,93 +114,66 @@ public class AlgorithmTask extends AbstractTask { //Set the default value for insertion cost input.setDefaultInsertionCost(parameterSet.defaultInsertionCost); - + //Call Yoshiko <<< Algorithm is performed here - ca = LibraryInterface.getRun(input, + ca = LibraryInterface.getRun(input, parameterSet.solCount, parameterSet.reductionRulesBitMask, - parameterSet.snrMultFactor, + parameterSet.snrMultFactor, parameterSet.usePartitionCuts, parameterSet.useTriangleCuts, parameterSet.useHeuristic ); - class CallbackHandler extends CplexInformer{ - - @Override - public boolean continueOnTimeout() { - try { - int result = JOptionPane.showConfirmDialog( - statusWindow, - LocalizationManager.get("continueTimeout"), - LocalizationManager.get("timeoutTitle"), - JOptionPane.YES_NO_OPTION, - JOptionPane.INFORMATION_MESSAGE - ); - if (result == JOptionPane.YES_OPTION) { - return true; - } - return false; - } - catch(Exception e) { - e.printStackTrace(); - return false; - } - } - - @Override - public void updateGap(double gap) { - taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+YoshUtil.twoDecimals.format(gap)+"%"); - } - } - - ca.registerCplexInformer(new CallbackHandler()); - + + + ca.registerCplexInformer(new StatusInformer(statusWindow,taskMonitor)); + result = ca.run(); - + taskMonitor.setProgress(0.9); - + checkForInvalidSolutions(result); long numberOfSolutions = result.getNumberOfSolutions(); - + taskMonitor.setStatusMessage("Found: "+numberOfSolutions+" solutions!"); //TODO localize - + YoshikoResult yoshikoResult = new YoshikoResult(); yoshikoResult.flags = result.getFlags(); - + System.out.print("ILP FLAG: "+yoshikoResult.flags.getIlpGenerated()); - + //Loop over (multiple) solutions for (long i=0;i<numberOfSolutions;i++) { - + taskMonitor.setStatusMessage("Processing solution "+(i+1)+" of "+numberOfSolutions); YoshikoSolution solution = new YoshikoSolution(net); String columnName = "YOSHIKO_SOLUTION_"+(i+1); - + net.getDefaultNodeTable().deleteColumn(columnName); net.getDefaultNodeTable().createColumn(columnName, String.class, false); - + //Fetch number of clusters in the solution long numberOfClusters = result.getNumberOfClusters(i); - + //Loop over cluster for (long k=0;k<numberOfClusters;k++) { //Create java instance YoshikoCluster cluster = new YoshikoCluster(k,net); - + taskMonitor.setStatusMessage("Processing cluster "+(k+1)+" of "+numberOfClusters); - + IntVector clusterVector = result.getCluster(i, k); - + long sizeOfCluster = clusterVector.size(); for (int l=0;l<sizeOfCluster;l++) { //Unsafe mismatch int long taskMonitor.setStatusMessage("Processing entry "+(l+1)+ " of "+sizeOfCluster); int nodeID = clusterVector.get(l); CyNode node = nodeMap.indexOf(nodeID); //<<< Another int/long conversion cluster.addNode(node); - + net.getRow(node).set(columnName, ""+(k+1)); //Add Cluster ID in table (Remove in final version?) } cluster.getSubNetwork(); @@ -217,7 +187,7 @@ public class AlgorithmTask extends AbstractTask { ca.delete(); input.delete(); result.delete(); - + //Generate solutionsPanel resultPanel = new ResultPanel(yoshikoResult); @@ -230,13 +200,13 @@ public class AlgorithmTask extends AbstractTask { eastPanel.setState(CytoPanelState.DOCK); } - + private void checkForInvalidSolutions(ClusterEditingSolutions result) throws Exception { if (result == null) { //There was no result object generated at all throw new Exception(LocalizationManager.get("noFeasible")); } - + if (result.getNumberOfSolutions() == 0) { //The result object is empty throw new Exception(LocalizationManager.get("noFeasible")); @@ -247,7 +217,7 @@ public class AlgorithmTask extends AbstractTask { throw new Exception(LocalizationManager.get("noFeasible")); } } - + } @Override diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetChangeListener.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetChangeListener.java index 1ada0eafb38400c7b783570d991156c6255d6cee..8ab86ea60035262519110fac6637573507c70f54 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetChangeListener.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetChangeListener.java @@ -34,7 +34,7 @@ import org.cytoscape.model.events.RemovedEdgesListener; import org.cytoscape.session.events.SessionLoadedEvent; import org.cytoscape.session.events.SessionLoadedListener; -import de.hhu.ba.yoshikoWrapper.gui.ColumnMapper; +import de.hhu.ba.yoshikoWrapper.swing.components.ColumnMapper; public class NetChangeListener implements //everything diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/StatusInformer.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/StatusInformer.java new file mode 100644 index 0000000000000000000000000000000000000000..b4b054e358cc517fe1f6312b96ebffce60fb0992 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/StatusInformer.java @@ -0,0 +1,78 @@ +package de.hhu.ba.yoshikoWrapper.core; + +import java.awt.Window; + +import javax.swing.JOptionPane; + +import org.cytoscape.work.TaskMonitor; + +import de.hhu.ba.yoshikoWrapper.swig.CplexInformer; +import de.hhu.ba.yoshikoWrapper.swig.YoshikoState; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; + +public class StatusInformer extends CplexInformer { + + private final Window statusWindow; + private final TaskMonitor taskMonitor; + + public StatusInformer(Window statusWindow, TaskMonitor taskMonitor) { + this.statusWindow = statusWindow; + this.taskMonitor = taskMonitor; + }; + + @Override + public boolean continueOnTimeout() { + try { + int result = JOptionPane.showConfirmDialog( + statusWindow, + LocalizationManager.get("continueTimeout"), + LocalizationManager.get("timeoutTitle"), + JOptionPane.YES_NO_OPTION, + JOptionPane.INFORMATION_MESSAGE + ); + if (result == JOptionPane.YES_OPTION) { + return true; + } + return false; + } + catch(Exception e) { + e.printStackTrace(); + return false; + } + } + + @Override + public void updateStatus(YoshikoState state, double value) { + if (state == YoshikoState.SOLVING_ILP){ + taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+SwingUtil.twoDecimals.format(value)+"%"); + } + } + + @Override + public void updateStatus(YoshikoState state) { + //TODO: Might improve performance via HashMap but probably irrelevant + if (state == YoshikoState.REDUCTION_AC) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionAC")); + } + else if (state == YoshikoState.REDUCTION_CC) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionCC")); + } + else if (state == YoshikoState.REDUCTION_CR) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionCR")); + } + else if (state == YoshikoState.REDUCTION_HE) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionHE")); + } + else if (state == YoshikoState.REDUCTION_MR) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionMR")); + } + else if (state == YoshikoState.REDUCTION_PD) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionPD")); + } + else if (state == YoshikoState.REDUCTION_SN) { + taskMonitor.setStatusMessage(LocalizationManager.get("status_reductionSN")); + } + } + + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshUtil.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshUtil.java index 9f195d07159f260d2c62a63f9b88e53264d3434a..1dee005777ccb195f646d7880b0288cc1930c15f 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshUtil.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshUtil.java @@ -1,10 +1,7 @@ package de.hhu.ba.yoshikoWrapper.core; -import java.text.DecimalFormat; - import org.osgi.framework.Version; public class YoshUtil { - final static DecimalFormat twoDecimals =new DecimalFormat("0.00"); public static Version version; } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/StyleManager.java b/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/StyleManager.java index 509926c0f20fbd0d0220cb05d6ab8a186d5d235d..b5eccc11a43f51ec3f43564f8703caa8f044c3eb 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/StyleManager.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/StyleManager.java @@ -22,19 +22,18 @@ public class StyleManager { public static final double MAX_NODE_SIZE = 30.0; - private static void apply (CyNetworkView view, VisualStyle style) { + + public static void style(CyNetworkView view, VisualStyle style) { CyCore.visualMappingManager.setVisualStyle(style,view); style.apply(view); view.updateView(); } - public static void style(CyNetworkView view, VisualStyle style) { - apply(view,style); - } - public static void styleWithMapping(CyNetworkView view, VisualStyle style) { style = CyCore.visualStyleFactory.createVisualStyle(style); + CyCore.visualMappingManager.setVisualStyle(style,view); + //Define style for solution ContinuousMapping<Integer, Double> contMapNodes = (ContinuousMapping<Integer, Double>)CyCore.continuousMappingFactory.createVisualMappingFunction( @@ -81,7 +80,9 @@ public class StyleManager { style.addVisualMappingFunction(contMapNodes); style.addVisualMappingFunction(contMapEdges); - apply(view,style); + + style.apply(view); + view.updateView(); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java index 69e330a354e85c43267d23ef07d955f1a9e440d0..63e208af500eddd9c62d90a8dd1d64f18821276c 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java @@ -138,12 +138,12 @@ public class YoshikoCluster { public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setStatusMessage("Generating cluster view for C:"+id); - StyleManager.style(view, CyCore.visualMappingManager.getCurrentVisualStyle()); view.setVisualProperty(NETWORK_WIDTH, new Double(width)); view.setVisualProperty(NETWORK_HEIGHT, new Double(height)); view.fitContent(); - view.updateView(); + + StyleManager.style(view, CyCore.visualMappingManager.getCurrentVisualStyle()); RenderingEngine<CyNetwork> renderingEngine = CyCore.renderingEngineFactory.createRenderingEngine(label, view); SwingUtilities.invokeLater(new Runnable() { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoSolution.java b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoSolution.java index 62081dbf1a57029e9c4d4e30ccef5f0872bb0a77..bd705af8c5f56118a560ff77295127622dcaea19 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoSolution.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoSolution.java @@ -32,6 +32,9 @@ import org.cytoscape.model.CyEdge.Type; import org.cytoscape.model.subnetwork.CySubNetwork; import org.cytoscape.view.layout.CyLayoutAlgorithm; import org.cytoscape.view.model.CyNetworkView; +import org.cytoscape.work.Task; +import org.cytoscape.work.TaskIterator; +import org.cytoscape.work.TaskMonitor; import de.hhu.ba.yoshikoWrapper.core.CyCore; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; @@ -83,7 +86,6 @@ public class YoshikoSolution { CyCore.networkManager.addNetwork(subnet); //Create network view and register it CyNetworkView subnetView = CyCore.networkViewFactory.createNetworkView(subnet); - CyCore.networkViewManager.addNetworkView(subnetView); //layout cluster CyCore.dialogTaskManager.execute( layout.createTaskIterator( @@ -96,6 +98,8 @@ public class YoshikoSolution { StyleManager.style(subnetView,CyCore.visualMappingManager.getCurrentVisualStyle()); + CyCore.networkViewManager.addNetworkView(subnetView); + clusterNode.setNetworkPointer(subnet); //Set node attributes metaGraph.getRow(clusterNode).set("name", LocalizationManager.get("cluster")+" "+c.getID()); @@ -132,24 +136,38 @@ public class YoshikoSolution { } CyNetworkView view = CyCore.networkViewFactory.createNetworkView(metaGraph); - //layout solution - CyCore.dialogTaskManager.execute( - layout.createTaskIterator( - view, - layout.getDefaultLayoutContext(), - CyLayoutAlgorithm.ALL_NODE_VIEWS, - null - ) + + //Layout and style solution + + TaskIterator it = layout.createTaskIterator( + view, + layout.getDefaultLayoutContext(), + CyLayoutAlgorithm.ALL_NODE_VIEWS, + null ); + it.append(new Task() { + @Override + public void run(TaskMonitor taskMonitor) throws Exception { + StyleManager.styleWithMapping(view, CyCore.visualMappingManager.getCurrentVisualStyle()); + } + + @Override + public void cancel() {} + + }); + + CyCore.dialogTaskManager.execute( + it + ); CyCore.networkManager.addNetwork(metaGraph); CyCore.networkViewManager.addNetworkView( view ); - StyleManager.styleWithMapping(view, CyCore.visualMappingManager.getCurrentVisualStyle()); + view.updateView(); CyCore.cy.setCurrentNetworkView(view); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java index cd73d0adafae758eebe24039851dca1ce490ac80..7ffd96f118b38a343fc4eb8a365160e48793dd8b 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java @@ -4,7 +4,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; -import de.hhu.ba.yoshikoWrapper.gui.EditCostPanel; +import de.hhu.ba.yoshikoWrapper.swing.components.EditCostPanel; public final class HelpLinks { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java index 818781d0e92f90f75eefff93b8db6c92e6915dbd..f9feb9b44ea8207324f4271c2e5d22141709b1e0 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java @@ -50,8 +50,12 @@ public class CplexInformer { LibraryInterfaceJNI.CplexInformer_change_ownership(this, swigCPtr, true); } - public void updateGap(double gap) { - if (getClass() == CplexInformer.class) LibraryInterfaceJNI.CplexInformer_updateGap(swigCPtr, this, gap); else LibraryInterfaceJNI.CplexInformer_updateGapSwigExplicitCplexInformer(swigCPtr, this, gap); + public void updateStatus(YoshikoState state) { + if (getClass() == CplexInformer.class) LibraryInterfaceJNI.CplexInformer_updateStatus__SWIG_0(swigCPtr, this, state.swigValue()); else LibraryInterfaceJNI.CplexInformer_updateStatusSwigExplicitCplexInformer__SWIG_0(swigCPtr, this, state.swigValue()); + } + + public void updateStatus(YoshikoState state, double value) { + if (getClass() == CplexInformer.class) LibraryInterfaceJNI.CplexInformer_updateStatus__SWIG_1(swigCPtr, this, state.swigValue(), value); else LibraryInterfaceJNI.CplexInformer_updateStatusSwigExplicitCplexInformer__SWIG_1(swigCPtr, this, state.swigValue(), value); } public boolean continueOnTimeout() { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java index 7048875c1a01367e1e6bcb58af2f9aa8599c18ed..d8ca6b3480f17f78f152ba932a33280599946bb2 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java @@ -57,8 +57,10 @@ public class LibraryInterfaceJNI { public final static native void LibraryInput_addEdge__SWIG_1(long jarg1, LibraryInput jarg1_, long jarg2, long jarg3, double jarg4, boolean jarg5, boolean jarg6); public final static native void LibraryInput_setSize(long jarg1, LibraryInput jarg1_, long jarg2); public final static native void LibraryInput_setDefaultInsertionCost(long jarg1, LibraryInput jarg1_, double jarg2); - public final static native void CplexInformer_updateGap(long jarg1, CplexInformer jarg1_, double jarg2); - public final static native void CplexInformer_updateGapSwigExplicitCplexInformer(long jarg1, CplexInformer jarg1_, double jarg2); + public final static native void CplexInformer_updateStatus__SWIG_0(long jarg1, CplexInformer jarg1_, int jarg2); + public final static native void CplexInformer_updateStatusSwigExplicitCplexInformer__SWIG_0(long jarg1, CplexInformer jarg1_, int jarg2); + public final static native void CplexInformer_updateStatus__SWIG_1(long jarg1, CplexInformer jarg1_, int jarg2, double jarg3); + public final static native void CplexInformer_updateStatusSwigExplicitCplexInformer__SWIG_1(long jarg1, CplexInformer jarg1_, int jarg2, double jarg3); public final static native boolean CplexInformer_continueOnTimeout(long jarg1, CplexInformer jarg1_); public final static native boolean CplexInformer_continueOnTimeoutSwigExplicitCplexInformer(long jarg1, CplexInformer jarg1_); public final static native void delete_CplexInformer(long jarg1); @@ -75,8 +77,11 @@ public class LibraryInterfaceJNI { public final static native void setVerbosity(int jarg1); public final static native long getRun(long jarg1, LibraryInput jarg1_, int jarg2, String jarg3, double jarg4, boolean jarg5, boolean jarg6, boolean jarg7); - public static void SwigDirector_CplexInformer_updateGap(CplexInformer jself, double gap) { - jself.updateGap(gap); + public static void SwigDirector_CplexInformer_updateStatus__SWIG_0(CplexInformer jself, int state) { + jself.updateStatus(YoshikoState.swigToEnum(state)); + } + public static void SwigDirector_CplexInformer_updateStatus__SWIG_1(CplexInformer jself, int state, double value) { + jself.updateStatus(YoshikoState.swigToEnum(state), value); } public static boolean SwigDirector_CplexInformer_continueOnTimeout(CplexInformer jself) { return jself.continueOnTimeout(); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/YoshikoState.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/YoshikoState.java new file mode 100644 index 0000000000000000000000000000000000000000..b588da06abdab6a93a0eab2cd3ac276c51617c0b --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/YoshikoState.java @@ -0,0 +1,63 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.8 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package de.hhu.ba.yoshikoWrapper.swig; + +public final class YoshikoState { + public final static YoshikoState PARSING_INPUT = new YoshikoState("PARSING_INPUT", 0); + public final static YoshikoState REDUCTION_AC = new YoshikoState("REDUCTION_AC", 1); + public final static YoshikoState REDUCTION_CR = new YoshikoState("REDUCTION_CR", 2); + public final static YoshikoState REDUCTION_CC = new YoshikoState("REDUCTION_CC", 3); + public final static YoshikoState REDUCTION_PD = new YoshikoState("REDUCTION_PD", 4); + public final static YoshikoState REDUCTION_HE = new YoshikoState("REDUCTION_HE", 5); + public final static YoshikoState REDUCTION_MR = new YoshikoState("REDUCTION_MR", 6); + public final static YoshikoState REDUCTION_SN = new YoshikoState("REDUCTION_SN", 7); + public final static YoshikoState SOLVING_HEURISTIC = new YoshikoState("SOLVING_HEURISTIC", 8); + public final static YoshikoState SOLVING_ILP = new YoshikoState("SOLVING_ILP", 9); + public final static YoshikoState PROCESS_SOLUTION = new YoshikoState("PROCESS_SOLUTION", 10); + + public final int swigValue() { + return swigValue; + } + + public String toString() { + return swigName; + } + + public static YoshikoState swigToEnum(int swigValue) { + if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) + return swigValues[swigValue]; + for (int i = 0; i < swigValues.length; i++) + if (swigValues[i].swigValue == swigValue) + return swigValues[i]; + throw new IllegalArgumentException("No enum " + YoshikoState.class + " with value " + swigValue); + } + + private YoshikoState(String swigName) { + this.swigName = swigName; + this.swigValue = swigNext++; + } + + private YoshikoState(String swigName, int swigValue) { + this.swigName = swigName; + this.swigValue = swigValue; + swigNext = swigValue+1; + } + + private YoshikoState(String swigName, YoshikoState swigEnum) { + this.swigName = swigName; + this.swigValue = swigEnum.swigValue; + swigNext = this.swigValue+1; + } + + private static YoshikoState[] swigValues = { PARSING_INPUT, REDUCTION_AC, REDUCTION_CR, REDUCTION_CC, REDUCTION_PD, REDUCTION_HE, REDUCTION_MR, REDUCTION_SN, SOLVING_HEURISTIC, SOLVING_ILP, PROCESS_SOLUTION }; + private static int swigNext = 0; + private final int swigValue; + private final String swigName; +} + diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/AboutDialog.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/AboutDialogFactory.java similarity index 90% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/AboutDialog.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/AboutDialogFactory.java index 4c3c3be57e29de6df5105ec98b24d4aa7c962f18..915093c4f50779a988c24cf7c5060e97cec784af 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/AboutDialog.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/AboutDialogFactory.java @@ -1,4 +1,4 @@ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; @@ -8,11 +8,12 @@ import javax.swing.JPanel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.YoshUtil; +import de.hhu.ba.yoshikoWrapper.swing.components.YoshikoHeader; /**Factory for a simple About-Dialog that provides some basic info about the software * */ -public class AboutDialog{ +public class AboutDialogFactory{ private static JPanel getDialogPanel() { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EnableWhenSelectedListener.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/EnableWhenSelectedListener.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/EnableWhenSelectedListener.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/EnableWhenSelectedListener.java index e021d4d2fab29ece3ce285f14d81634101b09fb0..1c88a7a3766c47d619b105dacc4cd9ae329c246f 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EnableWhenSelectedListener.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/EnableWhenSelectedListener.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/FormatHelper.java similarity index 98% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/FormatHelper.java index 3d3733f6a86ec5f1fe49b3330b5ee04aac88232d..faa161f9e27e14f73989bd24d293a9139e490836 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/FormatHelper.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import java.text.DecimalFormat; import java.text.NumberFormat; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HintManager.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/HintManager.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/HintManager.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/HintManager.java index 09296f68d42fcc5afc5fb96eb38d08fd466c73be..d34d98737ece6da220b9ecf28879a0a94cfcd547 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HintManager.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/HintManager.java @@ -1,4 +1,4 @@ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import java.util.Collections; import java.util.HashMap; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcherPanelFactory.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/LanguageSwitcherPanelFactory.java similarity index 94% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcherPanelFactory.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/LanguageSwitcherPanelFactory.java index 3c1c3666897995ae0f8475b62db4cb4d644f09da..0d408884c60bdd98e28eb9a5f0046d3931a530ab 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcherPanelFactory.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/LanguageSwitcherPanelFactory.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import javax.swing.BoxLayout; @@ -27,6 +27,7 @@ import javax.swing.BoxLayout; import org.cytoscape.util.swing.BasicCollapsiblePanel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.components.LanguageSwitcher; public class LanguageSwitcherPanelFactory{ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/LibraryPanelFactory.java similarity index 96% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/LibraryPanelFactory.java index 5e631f265e8673ac211ddc911472e66fe3d25f55..6c7714c533db78a0a0f624c04d8ca7af2e934b64 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibraryPanelFactory.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/LibraryPanelFactory.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import java.awt.Desktop; import java.awt.event.ActionEvent; @@ -39,6 +39,8 @@ import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; +import de.hhu.ba.yoshikoWrapper.swing.components.LibStatusPanel; +import de.hhu.ba.yoshikoWrapper.swing.components.YLibChooser; public class LibraryPanelFactory{ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SwingUtil.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/SwingUtil.java similarity index 85% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/SwingUtil.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/SwingUtil.java index e2d3fa88c3c2bc6eaa7ce0ac7bed68125335bb13..b190b5a375f7332e3cd60781d6578608ee844950 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SwingUtil.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/SwingUtil.java @@ -1,16 +1,16 @@ /******************************************************************************* * Copyright (C) 2017 Philipp Spohr - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,16 +19,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; import java.awt.Container; +import java.text.DecimalFormat; import javax.swing.JComponent; public class SwingUtil { - static void addAll(Container container, JComponent ... components) { + public static void addAll(Container container, JComponent ... components) { for (JComponent c: components) { container.add(c); } } + + public final static DecimalFormat twoDecimals =new DecimalFormat("0.00"); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ClusterView.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ClusterView.java index 91ff58290531f0253b7f47d65a1be1555dc7c6ad..5ae0d703c74b66ad45c9072093ec65cfcb467dbe 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ClusterView.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ClusterView.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Color; import java.awt.event.MouseEvent; @@ -38,6 +38,7 @@ import org.cytoscape.util.swing.BasicCollapsiblePanel; import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") public class ClusterView extends JPanel { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ColumnMapper.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ColumnMapper.java index 84b9f9bd0714e9274a0ed21bd6175d2e25685e33..6878cdff42fa3c0c7036e72e7000eec3b701a1d5 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ColumnMapper.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.GroupLayout; import javax.swing.JCheckBox; @@ -31,6 +31,8 @@ import org.cytoscape.model.CyColumn; import org.cytoscape.model.CyNetwork; import de.hhu.ba.yoshikoWrapper.core.CyCore; +import de.hhu.ba.yoshikoWrapper.swing.EnableWhenSelectedListener; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") //will never be serialized public class ColumnMapper extends JPanel{ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/DoubleInputField.java similarity index 94% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/DoubleInputField.java index 1c3f1b19f9b3ae8b5fdc0b3ba364885702bcf91d..24a031bbc5de788dc78197f29f49ddace1a2de53 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/DoubleInputField.java @@ -19,10 +19,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.JFormattedTextField; +import de.hhu.ba.yoshikoWrapper.swing.FormatHelper; + /** * Provides a more strict input field that only accepts double */ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java index 1d67f7a5bfef0c14bd6e90ab5a8bb9f86204e1f3..2ee951a40ec47fb72e35de0dfb8d5f3263197868 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.GroupLayout; @@ -30,6 +30,7 @@ import javax.swing.GroupLayout.Alignment; import org.cytoscape.model.CyColumn; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") //Will never be serialized public class EditCostPanel extends JPanel { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java similarity index 94% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java index 19b00f789b66d8d714dd00f4da58e94c09daeb6f..af91028102125b43aabee9f046ab51283cf5573f 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java @@ -1,4 +1,4 @@ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Insets; import java.awt.event.ActionEvent; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/IntegerInputField.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/IntegerInputField.java similarity index 94% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/IntegerInputField.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/IntegerInputField.java index c9edadcfaa3769b13ea428050ea5ae210b8faeff..04ffa2f772d4fb3a85a799cceddcdbff4399b690 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/IntegerInputField.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/IntegerInputField.java @@ -19,11 +19,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.JFormattedTextField; import javax.swing.text.NumberFormatter; +import de.hhu.ba.yoshikoWrapper.swing.FormatHelper; + /** * Provides a more strict input field that only accepts integers */ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageRenderer.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java similarity index 94% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageRenderer.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java index 118e2b78dcce06d6e27bab28fe0f0326392378f5..3cabc956e19accbedc56bc36d3fab494cbaf41e1 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageRenderer.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java @@ -1,4 +1,4 @@ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Component; import java.util.Locale; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcher.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageSwitcher.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcher.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageSwitcher.java index 3086a1ace248006d6e11697f21d1e32f7142500f..0fa132bf8893e582d70895c50f7a64899ff9e3bb 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LanguageSwitcher.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageSwitcher.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibStatusPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LibStatusPanel.java similarity index 86% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibStatusPanel.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LibStatusPanel.java index f1690c032b4f76587bd79a0584219e33fe736e90..212cde9752b630d8d801e891263c72c44bff3958 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/LibStatusPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LibStatusPanel.java @@ -1,16 +1,16 @@ /******************************************************************************* * Copyright (C) 2017 Philipp Spohr - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,21 +19,22 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Color; import javax.swing.JLabel; import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader; - +/** + * Simple JLabel visually representing whether or not the Yoshiko Lib is loaded + * + */ +@SuppressWarnings("serial") public class LibStatusPanel extends JLabel { - /** - * + * Adjusts the style accordingly by changing its color and updating its text */ - private static final long serialVersionUID = 6178348169993497344L; - public void setStyle(boolean libraryLoaded) { if(libraryLoaded) { this.setText("YOSHIKO LIBRARY READY!"); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/MainPanel.java similarity index 96% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/MainPanel.java index 3a97ea88cf03566b1ae68809433631c457a77fe0..3c34e3a2b15740ab2243d8c78b0db52f7cbe5c9c 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/MainPanel.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import static javax.swing.GroupLayout.DEFAULT_SIZE; import static javax.swing.GroupLayout.PREFERRED_SIZE; @@ -57,6 +57,11 @@ import de.hhu.ba.yoshikoWrapper.core.Hint; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.ParameterSet; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; +import de.hhu.ba.yoshikoWrapper.swing.AboutDialogFactory; +import de.hhu.ba.yoshikoWrapper.swing.HintManager; +import de.hhu.ba.yoshikoWrapper.swing.LanguageSwitcherPanelFactory; +import de.hhu.ba.yoshikoWrapper.swing.LibraryPanelFactory; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; /**This class describes the Swing Panel that the user interacts with in cytoscape * @@ -101,7 +106,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { @Override public void actionPerformed(ActionEvent e) { - AboutDialog.showDialog(); + AboutDialogFactory.showDialog(); } }); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/OperationModePanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/OperationModePanel.java similarity index 98% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/OperationModePanel.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/OperationModePanel.java index a92ee23345bc2e52fdbec7544a614b23e550e08b..6fa6d0ee625ec693de1430c0483a80a114f18aa3 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/OperationModePanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/OperationModePanel.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -33,6 +33,7 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; import javax.swing.GroupLayout.Alignment; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ReductionRulesChooser.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ReductionRulesChooser.java similarity index 98% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/ReductionRulesChooser.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ReductionRulesChooser.java index c24ead35395a43b8baf0c1b054cdc097fe89b6c3..cd7a02a091363e6f65a7623bde842944442905b3 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ReductionRulesChooser.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ReductionRulesChooser.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import static javax.swing.GroupLayout.DEFAULT_SIZE; @@ -34,6 +34,7 @@ import javax.swing.JPanel; import javax.swing.GroupLayout.Alignment; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") public class ReductionRulesChooser extends JPanel{ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java similarity index 98% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java index 0f551cfce2e807028443d3f512843e08e905689f..226f87a6d3bbbfefc42856bc03d38ba428e7aac5 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Color; import java.awt.Component; @@ -44,6 +44,7 @@ import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoResult; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; /**Swing component that contains ALL solutions that are found during one run. * Conforms to CY 3.5 by being a CytoPanelComponent which is the norm for "result" panels diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionNumberChooser.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionNumberChooser.java similarity index 95% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionNumberChooser.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionNumberChooser.java index 6f7e860354b2e5f70495b1b35271b4a8722cee46..32436d7b8cd33a51bbaa087f37320764c73a4d60 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionNumberChooser.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionNumberChooser.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.JLabel; import javax.swing.JPanel; @@ -27,6 +27,7 @@ import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") public class SolutionNumberChooser extends JPanel { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java similarity index 96% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java index 4ef005df628b5db3f7fb74ebb19fecc15ac6f6db..ecc1bd984f281a42316d799d186d9557ed9e3e34 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/SolutionTab.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -35,6 +35,7 @@ import javax.swing.JScrollPane; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") public class SolutionTab extends JPanel { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/TimeLimitSetter.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java similarity index 96% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/TimeLimitSetter.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java index 41d9f0a827be5623f44bf4308651af1f53a8c7e0..0c8ce0ef037eae15a5c944c47c74252fff8dbced 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/TimeLimitSetter.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -29,6 +29,7 @@ import javax.swing.JCheckBox; import javax.swing.JPanel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") public class TimeLimitSetter extends JPanel{ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YLibChooser.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YLibChooser.java similarity index 93% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/YLibChooser.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YLibChooser.java index 3beb2bd295be1dd0276239a4bb84701e1cc88090..c5e8ae72a8a8e960d7482e215ce84434f7b3c717 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YLibChooser.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YLibChooser.java @@ -1,16 +1,16 @@ /******************************************************************************* * Copyright (C) 2017 Philipp Spohr - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import java.io.File; @@ -31,11 +31,8 @@ import javax.swing.filechooser.FileFilter; * @author Philipp Spohr, Aug 6, 2017 * */ +@SuppressWarnings("serial") public class YLibChooser extends JFileChooser { - /** - * - */ - private static final long serialVersionUID = -2528894543739757962L; /** * Default constructor @@ -54,7 +51,7 @@ public class YLibChooser extends JFileChooser { public String getDescription() { return "Compiled Yoshiko-Libraries"; } - + }); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHeader.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YoshikoHeader.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHeader.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YoshikoHeader.java index 46846446a3c1c4f6d663c15c812132a2db3dff28..f484334629eddc377215704e5c5fa0c9fab70e5c 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHeader.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/YoshikoHeader.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing.components; import javax.swing.Box; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/package-info.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..732e8db897c3b06b782bbc06376da49500c6b207 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author Philipp Spohr, Sep 9, 2017 + * + */ +package de.hhu.ba.yoshikoWrapper.swing.components; \ No newline at end of file diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/package-info.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/package-info.java similarity index 97% rename from src/main/java/de/hhu/ba/yoshikoWrapper/gui/package-info.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/swing/package-info.java index e0d4d454fb10c0039e2f7c7a05ef3d05fa625854..c8f8b807c1cdb28a7a2568881296bf25fb3c3564 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/package-info.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/package-info.java @@ -23,4 +23,4 @@ /**This package contains all Swing extensions and components (frontend) * */ -package de.hhu.ba.yoshikoWrapper.gui; +package de.hhu.ba.yoshikoWrapper.swing; diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index 7f746036358937dd8a529e6a8d648efed5ac39bb..2ad94d1f5426f26dbc1d6b371805a8ade0f022e2 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -62,6 +62,16 @@ resultsPanelTitle = Yoshiko Results run = Perform Algorithm showAdvanced = Show advanced options solution = Solution + +status_reductionAC = Applying "Almost-Clique" reduction rule +status_reductionCR = Applying "Clique" reduction rule +status_reductionCC = Applying "Critical-Clique" reduction rule +status_reductionHE = Applying "Heavy-Edge 3 in 1" reduction rule +status_reductionMR = Applying "Merging" reduction rule +status_reductionPD = Applying "Parameter-Dependent" reduction rule +status_reductionSN = Applying "Similar-Neighborhood" reduction rule + + switchLanguage = Plugin language timeLimitILP = Use time limit for ILP (s): timedOutMessage = The ILP exceeded the time-limit! diff --git a/thesis/tex/Chapter/dm_impl.tex b/thesis/tex/Chapter/dm_impl.tex index 5fd0654cd52f3c916d93f332a881268995497bcf..f190adc56c8192ba2d36578b5a5381dc8677294d 100644 --- a/thesis/tex/Chapter/dm_impl.tex +++ b/thesis/tex/Chapter/dm_impl.tex @@ -1 +1,20 @@ The Yoshiko Wrapper provides a clean and simple interface to generate the model. +\subparagraph{Mapping edge costs} +The user has the possibility to use a numeric Cytoscape column of the node table as a source for the edge-cost function $C$. +\subparagraph{Insertion and deletion cost} +The default values $C_I$ and $C_D$ can be set by the user and default to $C_I=-1$ and $C_D=1$. +It should be noted, that the insertion cost value is not normalized or in any way adjusted when a mapping is used. This means that the user needs to adjust this value wisely to fit the data. +As an example the user might have mapped the edge costs to a column containing values in the range of $10^6-10^7$. +The default insertion cost of $-1$ will be irrelevant in comparison and the algorithm will most likely insert all missing edges and generate one big cluster as a solution. +Overall the ratio $R = \frac{|C_I|}{C_D}$ should give you a rough idea how the algorithm will operate.\\ +$R > 1$ means, that the algorithm is more likely to delete edges to generate cliques, a value of $R<1$ means insertions are more likely. +\subparagraph{Mapping permanent or forbidden edges} +The Yoshiko app has additional convenience functions: +The user can map edges to a boolean Cytoscape column to mark them as either +\textbf{forbidden} (meaning that those edges will never be part of the solution) or +\textbf{permanent} (meaning that those edges will always be part of the solution). +Marking an edge e as forbidden is equivalent to $C(e)=-\infty$, +marking an edge e as permanent is equivalent to $C(e)=\infty$. +This way the user is able to apply expert knowledge about the input instance to increase the quality of the solution. + + diff --git a/thesis/tex/Chapter/dm_theory.tex b/thesis/tex/Chapter/dm_theory.tex index 3b59bff440bb91783a42f4ee0f7903a8bb883483..7e6d4a1b3a6cade379f6f53559c1833885c4bd35 100644 --- a/thesis/tex/Chapter/dm_theory.tex +++ b/thesis/tex/Chapter/dm_theory.tex @@ -1,3 +1,4 @@ + The Yoshiko algorithm models the data as a complete graph $G=(V,E)$ with an associated edge-cost function @@ -6,4 +7,5 @@ $C: E \rightarrow \mathbb{R} \cup \lbrace \infty \rbrace $. As many input instances do not describe a full graph, missing edges and costs need to be modeled. This is achieved by using default values for insertion or deletion. -A default insertion cost is used whenever the input instance does not contain an edge. \ No newline at end of file +A default insertion cost $C_I \in [-\infty,0]$ is used as $C(e)$ whenever the input instance does not contain an edge $e$. +A default deletion cost $C_D \in [0,\infty ]$ is used as $C(e)$ whenever the input instance does contain an edge $e$ that has no cost associated yet. \ No newline at end of file diff --git a/thesis/tex/Thesis.pdf b/thesis/tex/Thesis.pdf index ec03507e8e31722c79eae799cbd08b26f839bc39..5bedb831aec3862fe4aaaf5bcfe99681ba19e901 100644 Binary files a/thesis/tex/Thesis.pdf and b/thesis/tex/Thesis.pdf differ