diff options
8 files changed, 179 insertions, 189 deletions
diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java index bc79835dc67c..515c8e496f87 100644 --- a/bridges/test/java_uno/equals/TestEquals.java +++ b/bridges/test/java_uno/equals/TestEquals.java @@ -115,7 +115,7 @@ public final class TestEquals { } } - private final HashMap map = new HashMap(); + private final HashMap<String,Object> map = new HashMap<String,Object>(); } private final class Done implements XDone { @@ -160,7 +160,7 @@ public final class TestEquals { UnoRuntime.queryInterface( XDerived.class, test2Aa); - Hashtable params = new Hashtable(); + Hashtable<String,String> params = new Hashtable<String,String>(); params.put("UNO_TYPES", unoTypes); params.put("UNO_SERVICES", unoServices); XComponentContext context = Bootstrap. diff --git a/extensions/qa/integration/extensions/MethodHandler.java b/extensions/qa/integration/extensions/MethodHandler.java index 8508dca8fbda..b6259e9b790e 100644 --- a/extensions/qa/integration/extensions/MethodHandler.java +++ b/extensions/qa/integration/extensions/MethodHandler.java @@ -31,13 +31,13 @@ public class MethodHandler implements XPropertyHandler private XIntrospectionAccess m_introspectionAccess; private XIdlClass m_idlClass; private XIdlMethod[] m_methods; - private java.util.HashMap m_methodsHash; + private java.util.HashMap<String,XIdlMethod> m_methodsHash; /** Creates a new instance of MethodHandler */ public MethodHandler( XComponentContext _context ) { m_context = _context; - m_methodsHash = new java.util.HashMap(); + m_methodsHash = new java.util.HashMap<String,XIdlMethod>(); try { @@ -169,7 +169,7 @@ public class MethodHandler implements XPropertyHandler m_introspectionAccess = null; m_methods = null; - m_methodsHash = new java.util.HashMap(); + m_methodsHash = new java.util.HashMap<String,XIdlMethod>(); m_introspectionAccess = m_introspection.inspect( _component ); if ( m_introspectionAccess == null ) @@ -217,7 +217,7 @@ public class MethodHandler implements XPropertyHandler */ private XIdlMethod impl_getMethod( String _methodName ) throws UnknownPropertyException { - XIdlMethod method = (XIdlMethod)m_methodsHash.get( _methodName ); + XIdlMethod method = m_methodsHash.get( _methodName ); if ( method == null ) throw new com.sun.star.beans.UnknownPropertyException(); diff --git a/forms/qa/integration/forms/TableCellTextBinding.java b/forms/qa/integration/forms/TableCellTextBinding.java index 40a5d698617b..8a1d1fb8ce18 100644 --- a/forms/qa/integration/forms/TableCellTextBinding.java +++ b/forms/qa/integration/forms/TableCellTextBinding.java @@ -48,7 +48,7 @@ public class TableCellTextBinding private String m_newCellText; private String m_lastKnownCellText; private boolean m_haveNewCellText; - private java.util.List m_listeners; + private java.util.List<com.sun.star.util.XModifyListener> m_listeners; /** Creates a new instance of TableCellTextBinding */ public TableCellTextBinding( XCell cell ) @@ -56,7 +56,7 @@ public class TableCellTextBinding m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell ); m_newCellText = new String(); - m_listeners = new java.util.LinkedList(); + m_listeners = new java.util.LinkedList<com.sun.star.util.XModifyListener>(); start(); } diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java index 7ca0e2973c66..80d1f97e28a7 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java @@ -1,149 +1,148 @@ -/**
- * Description: operations for the a text string.
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie Feb 22, 2001
- * Xiaofeng Xie May 12, 2004
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Please acknowledge the author(s) if you use this code in any way.
- *
- * @version 1.0
- * @Since MAOS1.0
- */
-
-package net.adaptivebox.global;
-
-import java.io.*;
-import java.util.*;
-
-public class GlobalString {
- public static final String NEGLECT_TAG = "#$@";
- public static final String EQUAL_TAG = "=";
-
-/**
- * Tokenize a String with given key.
- * @param input the String to be tokenized.
- * @param tokenKey the delimiters.
- * @return a String array that include the elements of input string that
- * divided by the tokenKey.
- */
- public static String[] tokenize(String input , String tokenKey) {
- Vector v = new Vector();
- StringTokenizer t = new StringTokenizer(input, tokenKey);
- String cmd[];
- while (t.hasMoreTokens())
- v.addElement(t.nextToken());
- cmd = new String[v.size()];
- for (int i = 0; i < cmd.length; i++)
- cmd[i] = (String) v.elementAt(i);
- return cmd;
- }
-
- 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);
- }
-
- public static int getCharLoc(char data, String str) {
- for(int i=0; i<str.length(); i++) {
- if(str.charAt(i)==data) return i;
- }
- return -1;
- }
- public static String trim(String origStr, String discardStr) {
- String str = origStr;
- do {
- if(str.length()==0) return str;
- if(getCharLoc(str.charAt(0), discardStr)!=-1) str = str.substring(1);
- else if(getCharLoc(str.charAt(str.length()-1), discardStr)!=-1) str = str.substring(0, str.length()-1);
- else {return str;}
- } while(true);
- }
-
- public static boolean getFirstCharExist(String str, String chars) throws Exception {
- int neglectFirstCharLength = chars.length();
- for(int i=0; i<neglectFirstCharLength; i++) {
- if(str.startsWith(chars.substring(i, i+1))) {
- return true;
- }
- }
- return false;
- }
-
- public static String getMeaningfulLine(BufferedReader outReader, String neglectFirstChars) throws Exception {
- String str;
- boolean isNeglect = true;
- int i = 0;
- do {
- str = outReader.readLine();
- if (str==null) {
- return null;
- }
- str = trim(str, " \t");
- if(str.length()>0) {
- isNeglect = getFirstCharExist(str, neglectFirstChars);
- }
- } while (isNeglect);
- return str;
- }
-
- public static String[] getMeaningfulLines(String srcStr, String neglectFirstChars) throws Exception {
- StringReader outStringReader = new StringReader(srcStr);
- BufferedReader outReader = new BufferedReader(outStringReader);
- Vector origData = new Vector();
- String str = null;
- while(true) {
- str = getMeaningfulLine(outReader, neglectFirstChars);
- if (str==null) {
- break;
- }
- origData.add(str);
- }
- return convert1DVectorToStringArray(origData);
- }
-
- /**
- * convert vector to 1D String array
- */
- public static String[] convert1DVectorToStringArray(Vector toToConvert) {
- if (toToConvert==null) return null;
- String[] objs = new String[toToConvert.size()];
- for (int i=0; i<toToConvert.size(); i++) {
- objs[i] =getObjString(toToConvert.elementAt(i));
- }
- return(objs);
- }
-
- public static String getObjString(Object nObj) {
- if(nObj instanceof String) return (String)nObj;
- return nObj.toString();
- }
-
- static public int toInteger(Object oVal) throws Exception {
- if(oVal==null) throw new Exception("Null string");
- return new Integer(oVal.toString()).intValue();
- }
-
- static public double toDouble(Object oVal) throws Exception {
- if(oVal==null) throw new Exception("Null string");
- return new Double(oVal.toString()).doubleValue();
- }
-
- public static Object toObject(String key) throws Exception{
- Class cls = Class.forName(key);
- return cls.newInstance();
- }
+/** + * Description: operations for the a text string. + * + * @ Author Create/Modi Note + * Xiaofeng Xie Feb 22, 2001 + * Xiaofeng Xie May 12, 2004 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Please acknowledge the author(s) if you use this code in any way. + * + * @version 1.0 + * @Since MAOS1.0 + */ + +package net.adaptivebox.global; + +import java.io.*; +import java.util.*; + +public class GlobalString { + public static final String NEGLECT_TAG = "#$@"; + public static final String EQUAL_TAG = "="; + +/** + * Tokenize a String with given key. + * @param input the String to be tokenized. + * @param tokenKey the delimiters. + * @return a String array that include the elements of input string that + * divided by the tokenKey. + */ + public static String[] tokenize(String input , String tokenKey) { + Vector v = new Vector(); + StringTokenizer t = new StringTokenizer(input, tokenKey); + String cmd[]; + while (t.hasMoreTokens()) + v.addElement(t.nextToken()); + cmd = new String[v.size()]; + for (int i = 0; i < cmd.length; i++) + cmd[i] = (String) v.elementAt(i); + return cmd; + } + + 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); + } + + public static int getCharLoc(char data, String str) { + for(int i=0; i<str.length(); i++) { + if(str.charAt(i)==data) return i; + } + return -1; + } + public static String trim(String origStr, String discardStr) { + String str = origStr; + do { + if(str.length()==0) return str; + if(getCharLoc(str.charAt(0), discardStr)!=-1) str = str.substring(1); + else if(getCharLoc(str.charAt(str.length()-1), discardStr)!=-1) str = str.substring(0, str.length()-1); + else {return str;} + } while(true); + } + + public static boolean getFirstCharExist(String str, String chars) throws Exception { + int neglectFirstCharLength = chars.length(); + for(int i=0; i<neglectFirstCharLength; i++) { + if(str.startsWith(chars.substring(i, i+1))) { + return true; + } + } + return false; + } + + public static String getMeaningfulLine(BufferedReader outReader, String neglectFirstChars) throws Exception { + String str; + boolean isNeglect = true; + int i = 0; + do { + str = outReader.readLine(); + if (str==null) { + return null; + } + str = trim(str, " \t"); + if(str.length()>0) { + isNeglect = getFirstCharExist(str, neglectFirstChars); + } + } while (isNeglect); + return str; + } + + public static String[] getMeaningfulLines(String srcStr, String neglectFirstChars) throws Exception { + StringReader outStringReader = new StringReader(srcStr); + BufferedReader outReader = new BufferedReader(outStringReader); + ArrayList<String> origData = new ArrayList<String>(); + while(true) { + String str = getMeaningfulLine(outReader, neglectFirstChars); + if (str==null) { + break; + } + origData.add(str); + } + return convert1DVectorToStringArray(origData); + } + + /** + * convert vector to 1D String array + */ + public static String[] convert1DVectorToStringArray(ArrayList<String> toToConvert) { + if (toToConvert==null) return null; + String[] objs = new String[toToConvert.size()]; + for (int i=0; i<toToConvert.size(); i++) { + objs[i] = getObjString(toToConvert.get(i)); + } + return(objs); + } + + public static String getObjString(Object nObj) { + if(nObj instanceof String) return (String)nObj; + return nObj.toString(); + } + + static public int toInteger(Object oVal) throws Exception { + if(oVal==null) throw new Exception("Null string"); + return new Integer(oVal.toString()).intValue(); + } + + static public double toDouble(Object oVal) throws Exception { + if(oVal==null) throw new Exception("Null string"); + return new Double(oVal.toString()).doubleValue(); + } + + 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/odk/examples/DevelopersGuide/Text/TextDocuments.java b/odk/examples/DevelopersGuide/Text/TextDocuments.java index 4914251b07ca..0762a47a3ef4 100644 --- a/odk/examples/DevelopersGuide/Text/TextDocuments.java +++ b/odk/examples/DevelopersGuide/Text/TextDocuments.java @@ -32,47 +32,49 @@ * *************************************************************************/ +import java.util.HashMap; +import java.util.Iterator; +import java.util.Random; + import com.sun.star.awt.Point; import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XEnumeration; +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XIndexReplace; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.container.XNamed; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XIndexReplace; -import com.sun.star.container.XEnumeration; -import com.sun.star.container.XEnumerationAccess; - +import com.sun.star.drawing.XDrawPageSupplier; import com.sun.star.drawing.XShape; import com.sun.star.drawing.XShapes; -import com.sun.star.drawing.XDrawPageSupplier; - -import com.sun.star.frame.XDesktop; import com.sun.star.frame.XComponentLoader; -import com.sun.star.frame.XModel; import com.sun.star.frame.XController; - +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XModel; +import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; - import com.sun.star.style.NumberingType; import com.sun.star.style.XStyle; import com.sun.star.style.XStyleFamiliesSupplier; - import com.sun.star.text.ControlCharacter; -import com.sun.star.text.ReferenceFieldSource; import com.sun.star.text.ReferenceFieldPart; +import com.sun.star.text.ReferenceFieldSource; import com.sun.star.text.TextColumn; import com.sun.star.text.TextContentAnchorType; -import com.sun.star.text.XAutoTextGroup; import com.sun.star.text.XAutoTextEntry; +import com.sun.star.text.XAutoTextGroup; +import com.sun.star.text.XBookmarksSupplier; import com.sun.star.text.XDependentTextField; import com.sun.star.text.XDocumentIndex; import com.sun.star.text.XFootnote; import com.sun.star.text.XFootnotesSupplier; +import com.sun.star.text.XPageCursor; import com.sun.star.text.XParagraphCursor; import com.sun.star.text.XReferenceMarksSupplier; import com.sun.star.text.XRelativeTextContentInsert; @@ -84,30 +86,20 @@ import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextField; +import com.sun.star.text.XTextFieldsSupplier; import com.sun.star.text.XTextFrame; import com.sun.star.text.XTextRange; import com.sun.star.text.XTextTable; import com.sun.star.text.XTextTableCursor; import com.sun.star.text.XTextTablesSupplier; -import com.sun.star.text.XTextFieldsSupplier; -import com.sun.star.text.XBookmarksSupplier; -import com.sun.star.text.XTextViewCursorSupplier; import com.sun.star.text.XTextViewCursor; -import com.sun.star.text.XPageCursor; - +import com.sun.star.text.XTextViewCursorSupplier; import com.sun.star.text.XWordCursor; - import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.XRefreshable; - -import com.sun.star.frame.XStorable; import com.sun.star.view.XPrintable; -import java.lang.Math; -import java.util.Random; -import java.util.Hashtable; - /* * TextDocuments.java * @@ -170,7 +162,7 @@ public class TextDocuments { */ protected void templateExample() throws java.lang.Exception { // create a small hashtable that simulates a rowset - Hashtable recipient = new Hashtable(); + HashMap<String,String> recipient = new HashMap<String,String>(); recipient.put("Company", "Manatee Books"); recipient.put("Contact", "Rod Martin"); recipient.put("ZIP", "34567"); @@ -195,10 +187,9 @@ public class TextDocuments { XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields(); // iterate over hashtable and insert values into field masters - java.util.Enumeration keys = recipient.keys(); - while(keys.hasMoreElements()) { + for(Iterator<String> iter = recipient.keySet().iterator(); iter.hasNext(); ) { // get column name - String key = (String)keys.nextElement(); + String key = iter.next(); // access corresponding field master Object fieldMaster = xNamedFieldMasters.getByName( diff --git a/scripting/workben/ifc/scripting/_XScriptInvocation.java b/scripting/workben/ifc/scripting/_XScriptInvocation.java index a9b9b72c8255..38863de54397 100644 --- a/scripting/workben/ifc/scripting/_XScriptInvocation.java +++ b/scripting/workben/ifc/scripting/_XScriptInvocation.java @@ -88,7 +88,7 @@ public class _XScriptInvocation extends MultiMethodTest { if (!context.equals("null")) ctx = loadDocument(context); - HashMap map = new HashMap(); + HashMap<String,Object> map = new HashMap<String,Object>(); map.put("SCRIPTING_DOC_STORAGE_ID", new Integer(storageId)); map.put("SCRIPTING_DOC_URI", "hahaha"); if (ctx != null) diff --git a/scripting/workben/ifc/scripting/_XScriptNameResolver.java b/scripting/workben/ifc/scripting/_XScriptNameResolver.java index 95601ca95666..fcee4802c5d4 100644 --- a/scripting/workben/ifc/scripting/_XScriptNameResolver.java +++ b/scripting/workben/ifc/scripting/_XScriptNameResolver.java @@ -81,7 +81,7 @@ public class _XScriptNameResolver extends MultiMethodTest { log.println(description + ": " + logicalname); - HashMap map = new HashMap(); + HashMap<String,Object> map = new HashMap<String,Object>(); map.put("SCRIPTING_DOC_STORAGE_ID", new Integer(storageId)); map.put("SCRIPTING_DOC_URI", util.utils.getFullTestURL(location)); diff --git a/scripting/workben/mod/_scripting/TestDataLoader.java b/scripting/workben/mod/_scripting/TestDataLoader.java index 530b8f2d7a07..c76d4351aad5 100644 --- a/scripting/workben/mod/_scripting/TestDataLoader.java +++ b/scripting/workben/mod/_scripting/TestDataLoader.java @@ -84,7 +84,7 @@ public class TestDataLoader { private static Parameters getParameters(StringTokenizer st) { String separator = "="; - HashMap map = new HashMap(5); + HashMap<String,Object> map = new HashMap<String,Object>(5); while (st.hasMoreTokens()) { String pair = st.nextToken(); |