Commit e4462426 authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Some JavaDoc additions / CyRest, some cleanup

parent 485106e9
......@@ -53,7 +53,6 @@ public class LocalizationManager {
locales.put("deDE", german);
locales.put("hrHR", serbocroatianLatin);
locales.put("elEL", modernGreek);
}
......@@ -104,7 +103,7 @@ public class LocalizationManager {
}
public static void switchLanguage(String key) {
System.out.println("DEBUG: SWITCHING TO: "+key);
//System.out.println("DEBUG: SWITCHING TO: "+key);
currentLocale = locales.get(key);
updateBundle();
}
......
package de.hhu.ba.yoshikoWrapper.core;
/**
* Simple Exception that should be thrown when the CyNetwork combined with the given parameters can not be parsed in a meaningful WCE instance
* @author Philipp Spohr, Dec 12, 2017
*
*/
@SuppressWarnings("serial")
public class NetworkParsingException extends Exception {
......
package de.hhu.ba.yoshikoWrapper.core;
import java.io.IOException;
import org.cytoscape.model.CyColumn;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.TunableValidator;
public class ParameterSet {
public class ParameterSet implements TunableValidator
{
@Tunable(description="Time Limit for the ILP mode", context="nogui")
public int timeLimit = -1;
......@@ -21,7 +25,7 @@ public class ParameterSet {
@Tunable(description="The default deletion cost that is to be used for edges without an associated weight",context="nogui")
public double defaultDeletionCost = 1;
@Tunable(description="A bitmask representing which reduction rules should be used",context="nogui") //TODO: Filter bad bitmasks
@Tunable(description="A bitmask representing which reduction rules should be used",context="nogui")
public String reductionRulesBitMask = "000000";
@Tunable(description="A value controlling the resolution of the SNR reduction rule. Higher values mean a longer running time but possibly better reduction.",context="nogui")
public double snrMultFactor = 1.0;
......@@ -44,4 +48,35 @@ public class ParameterSet {
/**Describes whether auto configuration of the reduction rules is to be used. Overrides the bit mask.**/
public boolean suggestReduction = true;
@Override
public ValidationState getValidationState(Appendable errMsg) {
if (!checkBitmask(reductionRulesBitMask)) {
try {
errMsg.append("The Bitmask provided is invalid! Needs to be six bit binary (example: 011001)");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ValidationState.INVALID;
}
return ValidationState.OK;
}
/**
* Helper function that verifies a String and checks if it represents a 6-bit bitmask
* @param mask
* @return
*/
private boolean checkBitmask(String mask) {
if (mask.length() != 6) {
return false;
}
for (byte c : mask.getBytes()) {
if (((char)c)!='0'&&((char)c)!='0') {
return false;
}
}
return true;
}
}
......@@ -21,7 +21,6 @@
******************************************************************************/
package de.hhu.ba.yoshikoWrapper.graphModel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
......@@ -67,7 +66,6 @@ public class YoshikoResult{
return flags;
}
public void addSolution(YoshikoSolution solution) {
solutions.put(solution.getId(),solution);
}
......
......@@ -34,11 +34,23 @@ import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
/**
* Represents a solution found by the Yoshiko algorithm.
* @author Philipp Spohr, Dec 12, 2017
*
*/
public class YoshikoSolution {
/**A reference to the result (and thus the Yoshiko run) to which this solution belongs
* TODO: I hate this codestyle wise maybe replace in the long run
*/
private final YoshikoResult result;
/**
* The CyNetwork representing the meta-graph for this solution if such a graph exists.
*/
private CyNetwork metaGraph;
private HashMap<YoshikoCluster, CyNode> metaGraphMap;
......
......@@ -26,12 +26,27 @@ import java.text.NumberFormat;
import javax.swing.text.NumberFormatter;
/**
* Serves as a Factory for various formatters that might be helpful for restricted input fields.
* @author Philipp Spohr, Dec 12, 2017
*
*/
public class FormatHelper {
/**Returns a basic integer input formatter accepting only positive integers
* Equivalent to getIntegerFormatter(0,Integer.MAX_VALUE)
* @return The NumberFormatter object
*/
public static NumberFormatter getIntegerFormatter() {
return getIntegerFormatter(0, Integer.MAX_VALUE);
}
/**
* Returns a basic integer input formatter accepting only integers in the given range
* @param minValue The smallest, accepted integer
* @param maxValue The largest, accepted integer
* @return A NumberFormatter object accepting only integers in the given range
*/
public static NumberFormatter getIntegerFormatter(int minValue, int maxValue) {
NumberFormat format = NumberFormat.getInstance();
NumberFormatter formatter = new NumberFormatter(format);
......
......@@ -43,6 +43,9 @@ public class GraphicsLoader {
private static BufferedImage infoIcon;
private static BufferedImage infoIcon_highlighted;
/**
* The fixed Yoshiko styled color, for quick reference
*/
public final static Color yoshikoGreen = new Color(0,128,0);
private final static ClassLoader classLoader = GraphicsLoader.class.getClassLoader();
......
......@@ -26,7 +26,13 @@ import java.text.DecimalFormat;
import javax.swing.JComponent;
/**
* Contains some basic convenience functions for working with Swing that have no other place (as of now)
* @author Philipp Spohr, Dec 12, 2017
*
*/
public class SwingUtil {
public static void addAll(Container container, JComponent ... components) {
for (JComponent c: components) {
container.add(c);
......
......@@ -24,6 +24,8 @@ package de.hhu.ba.yoshikoWrapper.tasks;
import java.awt.Window;
import java.util.Properties;
import javax.swing.SwingUtilities;
import org.cytoscape.application.swing.CytoPanel;
import org.cytoscape.application.swing.CytoPanelComponent;
import org.cytoscape.application.swing.CytoPanelName;
......@@ -243,6 +245,16 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask {
eastPanel.setSelectedIndex(eastPanel.indexOfComponent(resultPanel));
//Show (might be invisible)
eastPanel.setState(CytoPanelState.DOCK);
//Blackest magic, attempts to scale the result panel to a good size
SwingUtilities.invokeLater(
new Runnable() {
@Override
public void run() {
eastPanel.getThisComponent().setMinimumSize(eastPanel.getThisComponent().getPreferredSize());
eastPanel.getThisComponent().revalidate();
}
}
);
//eastPanel.getThisComponent().revalidate();
}
......
......@@ -29,7 +29,6 @@ public class GetSolutionsTask implements ObservableTask {
@Override
public void cancel() {
// TODO Auto-generated method stub
}
@SuppressWarnings("unchecked")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment