diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed /nlpsolver | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
Diffstat (limited to 'nlpsolver')
11 files changed, 23 insertions, 177 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java index 383e9c2ed202..39413006ab13 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java @@ -64,21 +64,7 @@ public class BasicBound { return value; } - public static BasicBound getBound(double[] data) { - BasicBound bound = new BasicBound(); - if(data!=null) { - if(data.length>0) { - bound.minValue = data[0]; - bound.maxValue = data[0]; - for(int i=1; i<data.length; i++) { - bound.minValue = Math.min(bound.minValue, data[i]); - bound.maxValue = Math.max(bound.maxValue, data[i]); - } - } - } - return bound; - } public double randomAdjust (double value){ if(value > maxValue || value < minValue) { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java index 1721b240217c..8cbfaa158747 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java @@ -26,19 +26,5 @@ public class GlobalCompare { return CompareValue.EQUAL_TO; } -/* check the magnitude of two array, the frontial is more important - **/ - public static int compareArray(double[] fit1, double[] fit2) { - if (fit1.length!=fit2.length) { - return CompareValue.INVALID; //error - } - for (int i=0; i<fit1.length; i++) { - if (fit1[i]>fit2[i]) { - return CompareValue.LARGER_THAN; //Large than - } else if (fit1[i]<fit2[i]){ - return CompareValue.LESS_THAN; //Less than - } - } - return CompareValue.EQUAL_TO; //same - } + } diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java index 78f08e5dc213..bb7bf8d8dfe8 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java @@ -45,13 +45,9 @@ public class GlobalString { return v.toArray(new String[v.size()]); } - public static String[] getMeaningfulLines(String srcStr) throws Exception { - return getMeaningfulLines(srcStr, NEGLECT_TAG); - } - public static String getMeaningfulLine(BufferedReader outReader) throws Exception { - return getMeaningfulLine(outReader, NEGLECT_TAG); - } + + private static int getCharLoc(char data, String str) { for(int i=0; i<str.length(); i++) { @@ -126,18 +122,8 @@ public class GlobalString { return nObj.toString(); } - static public int toInteger(Object oVal) throws Exception { - if(oVal==null) throw new Exception("Null string"); - return Integer.parseInt(oVal.toString()); - } - static public double toDouble(Object oVal) throws Exception { - if(oVal==null) throw new Exception("Null string"); - return Double.parseDouble(oVal.toString()); - } - public static Object toObject(String key) throws Exception{ - Class cls = Class.forName(key); - return cls.newInstance(); - } + + }
\ No newline at end of file diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java index b2177b8dfdb8..666a8a0bd758 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java @@ -28,18 +28,7 @@ public class OutputMethods { public OutputMethods() { } - public static String outputVectorAsStr(double[] vector){ - if(vector==null) return "NULL"; - String totalStr = ""; - for(int i=0;i<vector.length;i++){ - totalStr += vector[i]; - if(i!=vector.length-1) { - totalStr += "\t"; - } - } - totalStr+="\r\n"; - return totalStr; - } + public static void outputVector(double[] vector){ for(int i=0;i<vector.length;i++){ diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java index 5a3f44612592..48d3b6d799e5 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java @@ -45,49 +45,13 @@ public static double doubleRangeRandom(double lowLimit,double upLimit){ return(num); } -/**This function returns true or false with a random probability. - * @return int return value - */ - public static boolean booleanRandom(){ - boolean value = true; - double temp=Math.random(); - if (temp<0.5) value=false; - return value; - } - public static int[] randomSelection(boolean[] types, int times) { - int validNum = 0; - for(int i=0; i<types.length; i++) { - if(!types[i]) { - validNum++; - } - } - int[] totalIndices = new int[validNum]; - validNum = 0; - for(int i=0; i<types.length; i++) { - if(!types[i]) { - totalIndices[validNum] = i; - validNum++; - if(validNum==totalIndices.length) break; - } - } - return randomSelection(totalIndices, times); - } - public static int[] randomSelection(int low, int up, int times){ - int[] totalIndices = new int[up-low]; - for (int i=low; i<up; i++) { - totalIndices[i] = i; - } - return randomSelection(totalIndices, times); - } - public static int getRealV(double randTypeV) { - if(randTypeV<=0) return 0; - int realV = (int)Math.ceil(randTypeV); - if(Math.random()<(randTypeV-realV)) realV++; - return realV; - } + + + + private static int[] randomSelection(int[] totalIndices, int times) { if (times>=totalIndices.length) { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java index c33d6490b4be..6fee1b7367e4 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java @@ -68,10 +68,5 @@ public class SearchPoint extends BasicPoint implements IEncodeEngine { return encodeInfo[0] == 0; //no constraint violations } - public void outputSelf() { - System.out.println("#--> Location:"); - OutputMethods.outputVector(getLocation()); - System.out.println("#--> (CON & OPTIM):"); - OutputMethods.outputVector(getEncodeInfo()); - } + }
\ No newline at end of file diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java index 5bbd88a26a45..98c6824b73d6 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java @@ -65,11 +65,7 @@ public abstract class ProblemEncoder { designSpace.setElemAt(dd, i); } - protected void setDefaultXAt(int i, double min, double max) { - DesignDim dd = new DesignDim(); - dd.paramBound = new BasicBound(min, max); - designSpace.setElemAt(dd, i); - } + //set the default information for evaluation each response protected void setDefaultYAt(int i, double min, double max) { @@ -78,12 +74,7 @@ public abstract class ProblemEncoder { evalStruct.setElemAt(ee, i); } - protected void setDefaultYAt(int i, double min, double max, double weight) { - EvalElement ee = new EvalElement(); - ee.targetBound = new BasicBound(min, max); - ee.weight = weight; - evalStruct.setElemAt(ee, i); - } + //get a fresh point public SearchPoint getFreshSearchPoint() { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java index aa9988c1b3a9..2ddbf1b891a8 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java @@ -29,10 +29,7 @@ public class DesignDim { public BasicBound paramBound = new BasicBound(); //the range of a parameter - public void importData(DesignDim ipr) { - this.grain = ipr.grain; - this.paramBound = ipr.paramBound; - } + public boolean isDiscrete() { return grain!=0; diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java index bd620fa5bb9c..0b98752acb80 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java @@ -35,9 +35,7 @@ public class DesignSpace { dimProps = new DesignDim[dim]; } - public DesignDim getDimAt(int index) { - return dimProps[index]; - } + public void setElemAt(DesignDim elem, int index) { dimProps[index] = elem; @@ -60,56 +58,26 @@ public class DesignSpace { } } - public void randomAdjust (double[] location){ - for (int i=0; i<getDimension(); i++) { - location[i] = dimProps[i].paramBound.randomAdjust(location[i]); - } - } - public boolean satisfyCondition(double[] location){ - for (int i=0; i<getDimension(); i++) { - if (!dimProps[i].paramBound.isSatisfyCondition(location[i])) { - return false; - } - } - /*If the limits are not violated, return TRUE*/ - return(true); - } + + public void mutationAt(double[] location, int i){ location[i] = dimProps[i].paramBound.getRandomValue(); } - public double mutationUniformAtPointAsCenter (double pointX, int i){ - double length = this.getMagnitudeIn(i)/2; - pointX += RandomGenerator.doubleRangeRandom(-1*length, length); - return pointX; - } - public double getUpValueAt(int dimensionIndex) { - return dimProps[dimensionIndex].paramBound.maxValue; - } - public double getLowValueAt(int dimensionIndex) { - return dimProps[dimensionIndex].paramBound.minValue; - } + + public double getMagnitudeIn(int dimensionIndex) { return dimProps[dimensionIndex].paramBound.getLength(); } - public boolean initilizeGeneAtPointAsCenter(double[] tempX){ - if (tempX.length!=this.getDimension()) { - return false; - } - for(int i=0;i<tempX.length;i++) { - double length = this.getMagnitudeIn(i)/2; - tempX[i]+=RandomGenerator.doubleRangeRandom(-1*length, length); - } - return true; - } + public void initializeGene(double[] tempX){ for(int i=0;i<tempX.length;i++) tempX[i] = dimProps[i].paramBound.getRandomValue(); //Global.RandomGenerator.doubleRangeRandom(9.8, 10); @@ -129,11 +97,5 @@ public class DesignSpace { } } - public double[] getRealLoc(double[] imageLoc) { - double[] realLoc = new double[imageLoc.length]; - System.arraycopy(imageLoc, 0, realLoc, 0, imageLoc.length); - annulusAdjust(realLoc); - return realLoc; - } } diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java index 7401af7eda0c..8a85b5ad2d87 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java @@ -360,10 +360,7 @@ public abstract class BaseNLPSolver extends WeakBase return null; } - protected XCellRangeData getCellRangeData(CellRangeAddress cellRangeAddress) { - return getCellRangeData(cellRangeAddress.Sheet, cellRangeAddress.StartColumn, - cellRangeAddress.StartRow, cellRangeAddress.EndColumn, cellRangeAddress.EndRow); - } + private XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) { try { diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java index 2aaa534ddff2..6c76260a62d3 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java @@ -142,16 +142,9 @@ public abstract class BaseDialog extends BaseControl { super.finalize(); } - public ModalState showModal() { - xWindow.setVisible(true); - xDialog.execute(); - return modalState; - } - public void close() { - xDialog.endExecute(); - xWindow.setVisible(false); - } + + public void setCloseable(boolean closeable) { setProperty("Closeable", new Boolean(closeable)); |