summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/common/JavaTools.java
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/common/JavaTools.java')
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java519
1 files changed, 334 insertions, 185 deletions
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index a99fe97fd6bf..f8a85037c84a 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import com.sun.star.lang.XMultiServiceFactory;
@@ -44,104 +43,126 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-
-
/**
*
* @author bc93774
*/
-public class JavaTools {
+public class JavaTools
+{
/** Creates a new instance of JavaTools */
- public JavaTools() {
+ public JavaTools()
+ {
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String sPath = "";
DateTime oDateTime = null;
long n;
String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- if(xLocMSF != null){
- System.out.println("Connected to "+ ConnectStr);
+ if (xLocMSF != null)
+ {
+ System.out.println("Connected to " + ConnectStr);
oDateTime = getDateTime(9500000);
sPath = convertfromURLNotation("file:///E:/trash/Web%20Wizard.xcu");
n = getMillis(oDateTime);
int a = 1;
}
}
- catch(Exception exception){
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
- }}
-
-
+ }
+ }
- public static String[] copyStringArray(String[] FirstArray) {
- if (FirstArray != null) {
+ public static String[] copyStringArray(String[] FirstArray)
+ {
+ if (FirstArray != null)
+ {
String[] SecondArray = new String[FirstArray.length];
- for (int i = 0; i < FirstArray.length; i++) {
+ for (int i = 0; i < FirstArray.length; i++)
+ {
SecondArray[i] = FirstArray[i];
}
return SecondArray;
- } else
+ }
+ else
+ {
return null;
+ }
}
-
- public static Object[] initializeArray(Object[] olist, Object ovalue){
+ public static Object[] initializeArray(Object[] olist, Object ovalue)
+ {
for (int i = 0; i < olist.length; i++)
+ {
olist[i] = ovalue;
+ }
return olist;
}
-
- public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue){
+ public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue)
+ {
for (int i = 0; i < olist.length; i++)
+ {
olist[i] = ovalue;
+ }
return olist;
}
-
- public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index){
+ public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index)
+ {
String[] sRetArray = null;
- if (_sMultiDimArray != null){
+ if (_sMultiDimArray != null)
+ {
sRetArray = new String[_sMultiDimArray.length];
- for (int i = 0; i < _sMultiDimArray.length; i++){
+ for (int i = 0; i < _sMultiDimArray.length; i++)
+ {
sRetArray[i] = _sMultiDimArray[i][_index];
}
}
return sRetArray;
}
-
- public static int[] initializeintArray(int FieldCount, int nValue) {
+ public static int[] initializeintArray(int FieldCount, int nValue)
+ {
int[] LocintArray = new int[FieldCount];
for (int i = 0; i < LocintArray.length; i++)
+ {
LocintArray[i] = nValue;
+ }
return LocintArray;
}
-
/**converts a list of Integer values included in an Integer vector to a list of int values
*
*
* @param _aIntegerVector
* @return
*/
- public static int[] IntegerTointList(Vector _aIntegerVector){
- try {
+ public static int[] IntegerTointList(Vector _aIntegerVector)
+ {
+ try
+ {
Integer[] nIntegerValues = new Integer[_aIntegerVector.size()];
int[] nintValues = new int[_aIntegerVector.size()];
_aIntegerVector.toArray(nIntegerValues);
for (int i = 0; i < nIntegerValues.length; i++)
+ {
nintValues[i] = nIntegerValues[i].intValue();
+ }
return nintValues;
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
e.printStackTrace(System.out);
return null;
- }}
-
+ }
+ }
/**converts a list of Boolean values included in a Boolean vector to a list of boolean values
*
@@ -149,39 +170,50 @@ public class JavaTools {
* @param _aBooleanVector
* @return
*/
- public static boolean[] BooleanTobooleanList(Vector _aBooleanVector){
- try {
- Boolean[] bBooleanValues = new Boolean[_aBooleanVector.size()];
- boolean[] bbooleanValues = new boolean[_aBooleanVector.size()];
- _aBooleanVector.toArray(bBooleanValues);
- for (int i = 0; i < bBooleanValues.length; i++)
- bbooleanValues[i] = bBooleanValues[i].booleanValue();
- return bbooleanValues;
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
- return null;
- }}
-
-
-
+ public static boolean[] BooleanTobooleanList(Vector _aBooleanVector)
+ {
+ try
+ {
+ Boolean[] bBooleanValues = new Boolean[_aBooleanVector.size()];
+ boolean[] bbooleanValues = new boolean[_aBooleanVector.size()];
+ _aBooleanVector.toArray(bBooleanValues);
+ for (int i = 0; i < bBooleanValues.length; i++)
+ {
+ bbooleanValues[i] = bBooleanValues[i].booleanValue();
+ }
+ return bbooleanValues;
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
- public static String[] multiDimListToArray(String[][] multidimlist) {
- String[] retlist = new String[] {};
+ public static String[] multiDimListToArray(String[][] multidimlist)
+ {
+ String[] retlist = new String[]
+ {
+ };
retlist = new String[multidimlist.length];
- for (int i = 0; i < multidimlist.length; i++) {
+ for (int i = 0; i < multidimlist.length; i++)
+ {
retlist[i] = multidimlist[i][0];
}
return retlist;
}
- public static String getlongestArrayItem(String[] StringArray) {
+ public static String getlongestArrayItem(String[] StringArray)
+ {
String sLongestItem = "";
int FieldCount = StringArray.length;
int iOldLength = 0;
int iCurLength = 0;
- for (int i = 0; i < FieldCount; i++) {
+ for (int i = 0; i < FieldCount; i++)
+ {
iCurLength = StringArray[i].length();
- if (iCurLength > iOldLength) {
+ if (iCurLength > iOldLength)
+ {
iOldLength = iCurLength;
sLongestItem = StringArray[i];
}
@@ -189,13 +221,17 @@ public class JavaTools {
return sLongestItem;
}
- public static String ArraytoString(String[] LocArray) {
+ public static String ArraytoString(String[] LocArray)
+ {
String ResultString = "";
int iLen = LocArray.length;
- for (int i = 0; i < iLen; i++) {
+ for (int i = 0; i < iLen; i++)
+ {
ResultString += LocArray[i];
if (i < iLen - 1)
+ {
ResultString += ";";
+ }
}
return ResultString;
}
@@ -207,11 +243,14 @@ public class JavaTools {
* @return the index of the field that contains the string 'SearchString' or '-1' if not it is
* not contained within the array
*/
- public static int FieldInList(String[] SearchList, String SearchString) {
+ public static int FieldInList(String[] SearchList, String SearchString)
+ {
int FieldLen = SearchList.length;
int retvalue = -1;
- for (int i = 0; i < FieldLen; i++) {
- if (SearchList[i].compareTo(SearchString) == 0) {
+ for (int i = 0; i < FieldLen; i++)
+ {
+ if (SearchList[i].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
@@ -219,12 +258,16 @@ public class JavaTools {
return retvalue;
}
- public static int FieldInList(String[] SearchList, String SearchString, int StartIndex) {
+ public static int FieldInList(String[] SearchList, String SearchString, int StartIndex)
+ {
int FieldLen = SearchList.length;
int retvalue = -1;
- if (StartIndex < FieldLen) {
- for (int i = StartIndex; i < FieldLen; i++) {
- if (SearchList[i].compareTo(SearchString) == 0) {
+ if (StartIndex < FieldLen)
+ {
+ for (int i = StartIndex; i < FieldLen; i++)
+ {
+ if (SearchList[i].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
@@ -233,28 +276,39 @@ public class JavaTools {
return retvalue;
}
- public static int FieldInTable(String[][] SearchList, String SearchString) {
+ public static int FieldInTable(String[][] SearchList, String SearchString)
+ {
int retvalue;
- if (SearchList.length > 0) {
+ if (SearchList.length > 0)
+ {
int FieldLen = SearchList.length;
retvalue = -1;
- for (int i = 0; i < FieldLen; i++) {
- if (SearchList[i][0] != null) {
- if (SearchList[i][0].compareTo(SearchString) == 0) {
+ for (int i = 0; i < FieldLen; i++)
+ {
+ if (SearchList[i][0] != null)
+ {
+ if (SearchList[i][0].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
}
}
- } else
+ }
+ else
+ {
retvalue = -1;
+ }
return retvalue;
}
- public static int FieldInIntTable(int[][] SearchList, int SearchValue) {
+ public static int FieldInIntTable(int[][] SearchList, int SearchValue)
+ {
int retvalue = -1;
- for (int i = 0; i < SearchList.length; i++) {
- if (SearchList[i][0] == SearchValue) {
+ for (int i = 0; i < SearchList.length; i++)
+ {
+ if (SearchList[i][0] == SearchValue)
+ {
retvalue = i;
break;
}
@@ -262,11 +316,13 @@ public class JavaTools {
return retvalue;
}
-
- public static int FieldInIntTable(int[] SearchList, int SearchValue, int _startindex) {
+ public static int FieldInIntTable(int[] SearchList, int SearchValue, int _startindex)
+ {
int retvalue = -1;
- for (int i = _startindex; i < SearchList.length; i++) {
- if (SearchList[i] == SearchValue) {
+ for (int i = _startindex; i < SearchList.length; i++)
+ {
+ if (SearchList[i] == SearchValue)
+ {
retvalue = i;
break;
}
@@ -274,17 +330,18 @@ public class JavaTools {
return retvalue;
}
-
- public static int FieldInIntTable(int[] SearchList, int SearchValue) {
+ public static int FieldInIntTable(int[] SearchList, int SearchValue)
+ {
return FieldInIntTable(SearchList, SearchValue, 0);
}
-
-
- public static int getArraylength(Object[] MyArray) {
+ public static int getArraylength(Object[] MyArray)
+ {
int FieldCount = 0;
if (MyArray != null)
+ {
FieldCount = MyArray.length;
+ }
return FieldCount;
}
@@ -294,14 +351,19 @@ public class JavaTools {
* The default sorting order is the first dimension
* Only if sort2ndValue is True the second dimension is the relevant for the sorting order
*/
- public static String[][] bubblesortList(String[][] SortList) {
+ public static String[][] bubblesortList(String[][] SortList)
+ {
String DisplayDummy;
int SortCount = SortList[0].length;
int DimCount = SortList.length;
- for (int s = 0; s < SortCount; s++) {
- for (int t = 0; t < SortCount - s - 1; t++) {
- if (SortList[0][t].compareTo(SortList[0][t + 1]) > 0) {
- for (int k = 0; k < DimCount; k++) {
+ for (int s = 0; s < SortCount; s++)
+ {
+ for (int t = 0; t < SortCount - s - 1; t++)
+ {
+ if (SortList[0][t].compareTo(SortList[0][t + 1]) > 0)
+ {
+ for (int k = 0; k < DimCount; k++)
+ {
DisplayDummy = SortList[k][t];
SortList[k][t] = SortList[k][t + 1];
SortList[k][t + 1] = DisplayDummy;
@@ -317,83 +379,105 @@ public class JavaTools {
* @param Token
* @return
*/
- public static String[] ArrayoutofString(String MainString, String Token) {
+ public static String[] ArrayoutofString(String MainString, String Token)
+ {
String[] StringArray;
- if (MainString.equals("") == false) {
+ if (MainString.equals("") == false)
+ {
Vector StringVector = new Vector();
String LocString = null;
int iIndex;
- do {
+ do
+ {
iIndex = MainString.indexOf(Token);
if (iIndex < 0)
+ {
StringVector.addElement(MainString);
- else {
+ }
+ else
+ {
StringVector.addElement(MainString.substring(0, iIndex));
MainString = MainString.substring(iIndex + 1, MainString.length());
}
- } while (iIndex >= 0);
+ }
+ while (iIndex >= 0);
int FieldCount = StringVector.size();
StringArray = new String[FieldCount];
StringVector.copyInto(StringArray);
- } else
+ }
+ else
+ {
StringArray = new String[0];
+ }
return StringArray;
}
- public static String replaceSubString(String MainString, String NewSubString, String OldSubString) {
- try {
+ public static String replaceSubString(String MainString, String NewSubString, String OldSubString)
+ {
+ try
+ {
int NewIndex = 0;
int OldIndex = 0;
int NewSubLen = NewSubString.length();
int OldSubLen = OldSubString.length();
- while (NewIndex != -1) {
+ while (NewIndex != -1)
+ {
NewIndex = MainString.indexOf(OldSubString, OldIndex);
- if (NewIndex != -1) {
+ if (NewIndex != -1)
+ {
MainString = MainString.substring(0, NewIndex) + NewSubString + MainString.substring(NewIndex + OldSubLen);
OldIndex = NewIndex + NewSubLen;
}
}
return MainString;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
-
- public static String getFilenameOutOfPath(String sPath){
+ public static String getFilenameOutOfPath(String sPath)
+ {
String[] Hierarchy = ArrayoutofString(sPath, "/");
return Hierarchy[Hierarchy.length - 1];
}
-
- public static String getFileDescription(String sPath){
+ public static String getFileDescription(String sPath)
+ {
String sFilename = getFilenameOutOfPath(sPath);
String[] FilenameList = ArrayoutofString(sFilename, ".");
String FileDescription = "";
- for (int i = 0; i < FilenameList.length - 1; i++) {
+ for (int i = 0; i < FilenameList.length - 1; i++)
+ {
FileDescription += FilenameList[i];
}
return FileDescription;
}
-
-
- public static String convertfromURLNotation(String _sURLPath) {
- String sPath = "";
- try {
- URL oJavaURL = new URL(_sURLPath);
- File oFile = UrlToFileMapper.mapUrlToFile(oJavaURL);
- sPath = oFile.getAbsolutePath();
- } catch (MalformedURLException e) {
- e.printStackTrace(System.out);
- } catch (IOException e) {
- e.printStackTrace(System.out);
- }
- return sPath;
+ public static String convertfromURLNotation(String _sURLPath)
+ {
+ String sPath = "";
+ try
+ {
+ URL oJavaURL = new URL(_sURLPath);
+ File oFile = UrlToFileMapper.mapUrlToFile(oJavaURL);
+ sPath = oFile.getAbsolutePath();
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sPath;
}
- public static DateTime getDateTime(long timeMillis) {
+ public static DateTime getDateTime(long timeMillis)
+ {
java.util.Calendar cal = java.util.Calendar.getInstance();
setTimeInMillis(cal, timeMillis);
DateTime dt = new DateTime();
@@ -407,57 +491,71 @@ public class JavaTools {
return dt;
}
-
- public static long getTimeInMillis(Calendar _calendar){
+ public static long getTimeInMillis(Calendar _calendar)
+ {
java.util.Date dDate = _calendar.getTime();
return dDate.getTime();
}
-
- public static void setTimeInMillis(Calendar _calendar, long _timemillis){
+ public static void setTimeInMillis(Calendar _calendar, long _timemillis)
+ {
java.util.Date dDate = new java.util.Date();
dDate.setTime(_timemillis);
_calendar.setTime(dDate);
}
-
- public static long getMillis(DateTime time) {
+ public static long getMillis(DateTime time)
+ {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(time.Year, time.Month, time.Day, time.Hours, time.Minutes, time.Seconds);
return getTimeInMillis(cal);
}
-
- public static String[] removeOutdatedFields(String[] baselist, String[] _complist) {
- String[] retarray = new String[] {};
- if ((baselist != null) && (_complist != null)) {
+ public static String[] removeOutdatedFields(String[] baselist, String[] _complist)
+ {
+ String[] retarray = new String[]
+ {
+ };
+ if ((baselist != null) && (_complist != null))
+ {
Vector retvector = new Vector();
// String[] orderedcomplist = new String[_complist.length];
// System.arraycopy(_complist, 0, orderedcomplist, 0, _complist.length);
for (int i = 0; i < baselist.length; i++)
// if (Arrays.binarySearch(orderedcomplist, baselist[i]) != -1)
+ {
if (FieldInList(_complist, baselist[i]) > -1)
+ {
retvector.add(baselist[i]);
- // else
- // here you could call the method of a defined interface to notify the calling method
- // }
+ // else
+ // here you could call the method of a defined interface to notify the calling method
+ // }
+ }
+ }
retarray = new String[retvector.size()];
retvector.toArray(retarray);
}
return (retarray);
}
-
- public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex) {
- String[][] retarray = new String[][] {};
- if ((baselist != null) && (_complist != null)) {
- if (baselist.length > 0) {
+ public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex)
+ {
+ String[][] retarray = new String[][]
+ {
+ };
+ if ((baselist != null) && (_complist != null))
+ {
+ if (baselist.length > 0)
+ {
Vector retvector = new Vector();
- for (int i = 0; i < baselist.length; i++) {
+ for (int i = 0; i < baselist.length; i++)
+ {
if (FieldInList(_complist, baselist[i][_compindex]) != -1)
+ {
retvector.add(baselist[i]);
// else
// here you could call the method of a defined interface to notify the calling method
+ }
}
retarray = new String[retvector.size()][2];
retvector.toArray(retarray);
@@ -466,28 +564,35 @@ public class JavaTools {
return (retarray);
}
-
- public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist) {
+ public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist)
+ {
return removeOutdatedFields(baselist, _complist, 0);
}
- public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist) {
- PropertyValue[][] retarray = new PropertyValue[][] {
+ public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist)
+ {
+ PropertyValue[][] retarray = new PropertyValue[][]
+ {
};
- if ((baselist != null) && (_complist != null)) {
+ if ((baselist != null) && (_complist != null))
+ {
Vector firstdimvector = new Vector();
int b = 0;
- for (int n = 0; n < baselist.length; n++) {
+ for (int n = 0; n < baselist.length; n++)
+ {
Vector secdimvector = new Vector();
PropertyValue[] internalArray;
int a = 0;
- for (int m = 0; m < baselist[n].length; m++) {
- if (FieldInList(_complist, baselist[n][m].Name) > -1) {
+ for (int m = 0; m < baselist[n].length; m++)
+ {
+ if (FieldInList(_complist, baselist[n][m].Name) > -1)
+ {
secdimvector.add(baselist[n][m]);
a++;
}
}
- if (a > 0) {
+ if (a > 0)
+ {
internalArray = new PropertyValue[a];
secdimvector.toArray(internalArray);
firstdimvector.add(internalArray);
@@ -500,7 +605,6 @@ public class JavaTools {
return (retarray);
}
-
/**
* searches a multidimensional array for duplicate fields. According to the following example
* SlaveFieldName1 ;SlaveFieldName2; SlaveFieldName3
@@ -510,15 +614,21 @@ public class JavaTools {
* @param _scomplist
* @return
*/
- public static int getDuplicateFieldIndex(String[][] _scomplist){
+ public static int getDuplicateFieldIndex(String[][] _scomplist)
+ {
int retvalue = -1;
- if (_scomplist.length > 0){
+ if (_scomplist.length > 0)
+ {
int fieldcount = _scomplist[0].length;
String[] sDescList = new String[fieldcount];
- for (int m = 0; m < fieldcount; m++){
- for (int n = 0; n < _scomplist.length; n++){
+ for (int m = 0; m < fieldcount; m++)
+ {
+ for (int n = 0; n < _scomplist.length; n++)
+ {
if (n == 0)
+ {
sDescList[m] = new String();
+ }
sDescList[m] += _scomplist[n][m];
}
}
@@ -532,26 +642,35 @@ public class JavaTools {
* @param scomplist
* @return
*/
- public static int getDuplicateFieldIndex(String[] scomplist) {
- for (int n = 0; n < scomplist.length; n++) {
+ public static int getDuplicateFieldIndex(String[] scomplist)
+ {
+ for (int n = 0; n < scomplist.length; n++)
+ {
String scurvalue = scomplist[n];
- for (int m = n; m < scomplist.length; m++) {
- if (m != n){
+ for (int m = n; m < scomplist.length; m++)
+ {
+ if (m != n)
+ {
if (scurvalue.equals(scomplist[m]))
+ {
return m;
+ }
}
}
}
return -1;
}
-
- public static int getDuplicateFieldIndex(String[] _scomplist, String _fieldname) {
+ public static int getDuplicateFieldIndex(String[] _scomplist, String _fieldname)
+ {
int iduplicate = 0;
- for (int n = 0; n < _scomplist.length; n++) {
- if (_scomplist[n].equals(_fieldname)){
+ for (int n = 0; n < _scomplist.length; n++)
+ {
+ if (_scomplist[n].equals(_fieldname))
+ {
iduplicate++;
- if (iduplicate == 2){
+ if (iduplicate == 2)
+ {
return n;
}
}
@@ -559,84 +678,114 @@ public class JavaTools {
return -1;
}
-
-
- public static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue) {
+ public static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue)
+ {
if (!firstPropValue.Name.equals(secPropValue.Name))
+ {
return false;
//TODO replace 'equals' with AnyConverter.getType(firstpropValue).equals(secPropValue) to check content and Type
-
+ }
if (!firstPropValue.Value.equals(secPropValue.Value))
+ {
return false;
+ }
return (firstPropValue.Handle == secPropValue.Handle);
}
-
- public static int[] getDuplicateFieldIndex(PropertyValue[][] ocomplist) {
- for (int n = 0; n < ocomplist.length; n++) {
+ public static int[] getDuplicateFieldIndex(PropertyValue[][] ocomplist)
+ {
+ for (int n = 0; n < ocomplist.length; n++)
+ {
PropertyValue[] ocurValue = ocomplist[n];
- for (int m = n; m < ocurValue.length; m++) {
+ for (int m = n; m < ocurValue.length; m++)
+ {
PropertyValue odetValue = ocurValue[m];
- for (int s = 0; s < ocurValue.length; s++) {
- if (s != m) {
+ for (int s = 0; s < ocurValue.length; s++)
+ {
+ if (s != m)
+ {
if (isEqual(odetValue, ocurValue[s]))
- return new int[] { n, s };
+ {
+ return new int[]
+ {
+ n, s
+ };
+ }
}
}
}
}
- return new int[] { -1, -1 };
+ return new int[]
+ {
+ -1, -1
+ };
}
-
- public static String getSuffixNumber(String _sbasestring){
+ public static String getSuffixNumber(String _sbasestring)
+ {
int suffixcharcount = 0;
- for (int i = _sbasestring.length()-1 ;i >= 0 ; i--){
+ for (int i = _sbasestring.length() - 1; i >= 0; i--)
+ {
char b = _sbasestring.charAt(i);
if ((b >= '0') && (b <= '9'))
+ {
suffixcharcount++;
+ }
else
+ {
break;
+ }
}
int istart = _sbasestring.length() - suffixcharcount;
- return _sbasestring.substring(istart,_sbasestring.length());
+ return _sbasestring.substring(istart, _sbasestring.length());
}
-
- public static String[] removefromList(String[] _sbaselist, String[] _sdellist){
+ public static String[] removefromList(String[] _sbaselist, String[] _sdellist)
+ {
Vector tempbaselist = new Vector();
- for (int i = 0; i < _sbaselist.length; i++){
+ for (int i = 0; i < _sbaselist.length; i++)
+ {
if (FieldInList(_sdellist, _sbaselist[i]) == -1)
+ {
tempbaselist.add(_sbaselist[i]);
+ }
}
String[] sretlist = new String[tempbaselist.size()];
tempbaselist.toArray(sretlist);
return sretlist;
}
-
/**
* compares two strings. If one of them is empty and the other one is null it also returns true
* @param sFirstString
* @param sSecondString
* @return
*/
- public static boolean isSame(String sFirstString, String sSecondString){
+ public static boolean isSame(String sFirstString, String sSecondString)
+ {
boolean bissame = false;
- if (sFirstString == null){
+ if (sFirstString == null)
+ {
if (sSecondString != null)
+ {
bissame = sSecondString.equals("");
+ }
else
+ {
bissame = (sSecondString == null);
+ }
}
- else{
+ else
+ {
if (sFirstString.equals(""))
+ {
bissame = (sSecondString == null);
+ }
else if (sSecondString != null)
+ {
bissame = sFirstString.equals(sSecondString);
+ }
}
return bissame;
}
-
-
}