From ce124184fb8632bc8ff13265f6a87f845752f4d0 Mon Sep 17 00:00:00 2001 From: Philipp Spohr <spohr.philipp@web.de> Date: Mon, 5 Mar 2018 14:22:19 +0100 Subject: [PATCH] minor stuff, codestyle --- .../hhu/ba/yoshikoWrapper/core/ParameterSet.java | 15 +++++++++++---- .../swing/components/EditCostPanel.java | 15 +++++++++------ .../swing/components/TimeLimitSetter.java | 5 +++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/ParameterSet.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/ParameterSet.java index b027e29..c057902 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/ParameterSet.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/ParameterSet.java @@ -35,11 +35,18 @@ import org.cytoscape.work.util.ListSingleSelection; public class ParameterSet implements TunableValidator { + //GLOBAL ACCESSIBLE DEFAULT VALUES FOR REFERENCE + public static final int DEFAULT_VALUE_TIME_LIMIT = -1; + public static final int DEFAULT_VALUE_TIME_LIMIT_IF_USED = 30; + public static final double DEFAULT_INSERTION_COST = -1.0; + public static final double DEFAULT_DELETION_COST = 1.0; + + @Tunable(description="Network to analyze for clusters", context="nogui") public CyNetwork net = CyCore.cy.getCurrentNetwork(); @Tunable(description="Time Limit for the ILP mode", context="nogui") - public int timeLimit = -1; + public int timeLimit = DEFAULT_VALUE_TIME_LIMIT; //COLUMN-MAPPINGS @@ -51,9 +58,9 @@ public class ParameterSet implements TunableValidator public ListSingleSelection<CyColumn> forbiddenColumn = null; @Tunable(description="The default insertion cost that is to be used for non-existing edges",context="nogui") - public double defaultInsertionCost = -1; + public double defaultInsertionCost = DEFAULT_INSERTION_COST; @Tunable(description="The default deletion cost that is to be used for edges without an associated weight",context="nogui") - public double defaultDeletionCost = 1; + public double defaultDeletionCost = DEFAULT_DELETION_COST; @Tunable(description="A bitmask representing which reduction rules should be used",context="nogui") public String reductionRulesBitMask = "000000"; @@ -72,7 +79,7 @@ public class ParameterSet implements TunableValidator public int solCount = 1; @Tunable(description="Disable multithreading to keep the system responsive",context="nogui") - public boolean disableMultiThreading; + public boolean disableMultiThreading = false; @Tunable(description="Automatically choose an appopriate set of reduction rules (overrides a given bitmask)",context="nogui") /**Describes whether auto configuration of the reduction rules is to be used. Overrides the bit mask.**/ diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java index 257ff59..2ccb579 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/EditCostPanel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2017 Philipp Spohr + * Copyright (C) 2018 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 @@ -32,10 +32,13 @@ import org.cytoscape.model.CyColumn; import javax.swing.GroupLayout.Alignment; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.core.ParameterSet; import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") //Will never be serialized public class EditCostPanel extends JPanel { + + private static final int GAP_SIZE_EC_PANEL = 4; //SWING COMPONENTS private final ColumnMapper columnMapper; @@ -60,9 +63,9 @@ public class EditCostPanel extends JPanel { icField = new DoubleInputField(Double.NEGATIVE_INFINITY,0); dcField = new DoubleInputField(0,Double.POSITIVE_INFINITY); - icField.setText("-1.0"); + icField.setText(""+ParameterSet.DEFAULT_INSERTION_COST); icField.setToolTipText(LocalizationManager.get("icTooltip")); - dcField.setText("1.0"); + dcField.setText(""+ParameterSet.DEFAULT_DELETION_COST); separator = new JSeparator(JSeparator.HORIZONTAL); @@ -87,7 +90,7 @@ public class EditCostPanel extends JPanel { .addComponent(icLabel) .addComponent(dcLabel) ) - .addGap(4) + .addGap(GAP_SIZE_EC_PANEL) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(icField) .addComponent(dcField) @@ -101,12 +104,12 @@ public class EditCostPanel extends JPanel { .addComponent(separator) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(icLabel) - .addGap(4) + .addGap(GAP_SIZE_EC_PANEL) .addComponent(icField) ) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(dcLabel) - .addGap(4) + .addGap(GAP_SIZE_EC_PANEL) .addComponent(dcField) ) ); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java index 0c8ce0e..e7e5b2b 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/TimeLimitSetter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) 2017 Philipp Spohr + * Copyright (C) 2018 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 @@ -29,6 +29,7 @@ import javax.swing.JCheckBox; import javax.swing.JPanel; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.core.ParameterSet; import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; @SuppressWarnings("serial") @@ -41,7 +42,7 @@ public class TimeLimitSetter extends JPanel{ this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS)); checkBox = new JCheckBox(LocalizationManager.get("timeLimitILP")); numberField = new IntegerInputField(); - numberField.setText("30"); + numberField.setText(""+ParameterSet.DEFAULT_VALUE_TIME_LIMIT_IF_USED); checkBox.addActionListener( new ActionListener() { -- GitLab