From 0063cf285696951e336b9cec1da8881997b286ce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 18 Nov 2014 10:01:21 +0200 Subject: java: make fields final where possible found by PMD Change-Id: I87780366119c141cd2dafe6ca1bf2d9798b10aec --- .../Calc/NLPSolver/BaseEvolutionarySolver.java | 20 +++++++++--------- .../star/comp/Calc/NLPSolver/DEPSSolverImpl.java | 14 ++++++------- .../dialogs/EvolutionarySolverStatusUno.java | 24 +++++++++++----------- 3 files changed, 29 insertions(+), 29 deletions(-) (limited to 'nlpsolver/src/com') diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java index 9d779afe7225..2d93dca6e4bf 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java @@ -61,8 +61,8 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { } private class Variable { - private CellMap CellMap; - private int OriginalVariable; + private final CellMap CellMap; + private final int OriginalVariable; private double MinValue; private double MaxValue; private double Granularity; @@ -78,8 +78,8 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { private class CalcProblemEncoder extends ProblemEncoder { - private ArrayList m_variables; - private ArrayList m_constraints; + private final ArrayList m_variables; + private final ArrayList m_constraints; private CalcProblemEncoder(ArrayList variables, ArrayList constraints) throws Exception { @@ -152,19 +152,19 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { protected double m_toleratedMin; protected double m_toleratedMax; - private ArrayList m_variables = new ArrayList(); + private final ArrayList m_variables = new ArrayList(); //properties protected PropertyInfo m_swarmSize = new PropertyInfo("SwarmSize", 70, "Size of Swam"); protected PropertyInfo m_librarySize = new PropertyInfo("LibrarySize", 210, "Size of Library"); protected PropertyInfo m_learningCycles = new PropertyInfo("LearningCycles", 2000, "Learning Cycles"); - private PropertyInfo m_guessVariableRange = new PropertyInfo("GuessVariableRange", true, "Variable Bounds Guessing"); - private PropertyInfo m_variableRangeThreshold = new PropertyInfo("VariableRangeThreshold", 3.0, "Variable Bounds Threshold (when guessing)"); //to approximate the variable bounds - private PropertyInfo m_useACRComperator = new PropertyInfo("UseACRComparator", false, "Use ACR Comparator (instead of BCH)"); - private PropertyInfo m_useRandomStartingPoint = new PropertyInfo("UseRandomStartingPoint", false, "Use Random starting point"); + private final PropertyInfo m_guessVariableRange = new PropertyInfo("GuessVariableRange", true, "Variable Bounds Guessing"); + private final PropertyInfo m_variableRangeThreshold = new PropertyInfo("VariableRangeThreshold", 3.0, "Variable Bounds Threshold (when guessing)"); //to approximate the variable bounds + private final PropertyInfo m_useACRComperator = new PropertyInfo("UseACRComparator", false, "Use ACR Comparator (instead of BCH)"); + private final PropertyInfo m_useRandomStartingPoint = new PropertyInfo("UseRandomStartingPoint", false, "Use Random starting point"); protected PropertyInfo m_required = new PropertyInfo("StagnationLimit", 70, "Stagnation Limit"); protected PropertyInfo m_tolerance = new PropertyInfo("Tolerance", 1e-6, "Stagnation Tolerance"); - private PropertyInfo m_enhancedSolverStatus = new PropertyInfo("EnhancedSolverStatus", true, "Show enhanced solver status"); + private final PropertyInfo m_enhancedSolverStatus = new PropertyInfo("EnhancedSolverStatus", true, "Show enhanced solver status"); protected IEvolutionarySolverStatusDialog m_solverStatusDialog; diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java index f7fc741fc6bf..716a79b79438 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java @@ -100,15 +100,15 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver return m_serviceNames; } - private PropertyInfo m_agentSwitchRate = new PropertyInfo("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)"); + private final PropertyInfo m_agentSwitchRate = new PropertyInfo("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)"); // --DE - private PropertyInfo m_factor = new PropertyInfo("DEFactor", 0.5, "DE: Scaling Factor (0-1.2)"); - private PropertyInfo m_CR = new PropertyInfo("DECR", 0.9, "DE: Crossover Probability (0-1)"); + private final PropertyInfo m_factor = new PropertyInfo("DEFactor", 0.5, "DE: Scaling Factor (0-1.2)"); + private final PropertyInfo m_CR = new PropertyInfo("DECR", 0.9, "DE: Crossover Probability (0-1)"); // --PS - private PropertyInfo m_c1 = new PropertyInfo("PSC1", 1.494, "PS: Cognitive Constant"); - private PropertyInfo m_c2 = new PropertyInfo("PSC2", 1.494, "PS: Social Constant"); - private PropertyInfo m_weight = new PropertyInfo("PSWeight", 0.729, "PS: Constriction Coefficient"); - private PropertyInfo m_CL = new PropertyInfo("PSCL", 0.0, "PS: Mutation Probability (0-0.005)"); + private final PropertyInfo m_c1 = new PropertyInfo("PSC1", 1.494, "PS: Cognitive Constant"); + private final PropertyInfo m_c2 = new PropertyInfo("PSC2", 1.494, "PS: Social Constant"); + private final PropertyInfo m_weight = new PropertyInfo("PSWeight", 0.729, "PS: Constriction Coefficient"); + private final PropertyInfo m_CL = new PropertyInfo("PSCL", 0.0, "PS: Mutation Probability (0-0.005)"); public void solve() { try { diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java index cd3dc0c3c7cb..da8dbb22e997 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java @@ -45,18 +45,18 @@ public class EvolutionarySolverStatusUno extends BaseDialog XActionListener { private int userState; - private Label lblSolutionValue; - private Label lblIteration; - private ProgressBar pbIteration; - private Label lblIterationValue; - private Label lblStagnation; - private ProgressBar pbStagnation; - private Label lblStagnationValue; - private Label lblRuntimeValue; - private Button btnStop; - private Button btnOK; - private Button btnContinue; - private int defaultTextColor; + private final Label lblSolutionValue; + private final Label lblIteration; + private final ProgressBar pbIteration; + private final Label lblIterationValue; + private final Label lblStagnation; + private final ProgressBar pbStagnation; + private final Label lblStagnationValue; + private final Label lblRuntimeValue; + private final Button btnStop; + private final Button btnOK; + private final Button btnContinue; + private final int defaultTextColor; private int maxIterations; private int maxStagnation; -- cgit