fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / nlpsolver / ThirdParty / EvolutionarySolver / src / net / adaptivebox / global / GlobalCompare.java
blob3f11dc59f98d5eea30837502b783c3157aa75501
1 /**
2 * Description: Global package for comparison.
4 * @ Author Create/Modi Note
5 * Xiaofeng Xie Jun 15, 2002 xiaofengxie@tsinghua.org.cn
8 * @version 1.0
9 * @Since MAOS1.0
13 package net.adaptivebox.global;
15 public class GlobalCompare {
17 /* compare the data1 and data2, if data1=data2, return 0
18 * if data1 < data2, return LESS_THAN, else if data1 > data2, LARGER_THAN
19 **/
20 static public int compare(double data1, double data2) {
21 if (data1 < data2)
22 return CompareValue.LESS_THAN;
23 else if (data1 > data2)
24 return CompareValue.LARGER_THAN;
25 else
26 return CompareValue.EQUAL_TO;
29 /* check the magnitude of two array, the frontial is more important
30 **/
31 public static int compareArray(double[] fit1, double[] fit2) {
32 if (fit1.length!=fit2.length) {
33 return CompareValue.INVALID; //error
35 for (int i=0; i<fit1.length; i++) {
36 if (fit1[i]>fit2[i]) {
37 return CompareValue.LARGER_THAN; //Large than
38 } else if (fit1[i]<fit2[i]){
39 return CompareValue.LESS_THAN; //Less than
42 return CompareValue.EQUAL_TO; //same