/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) { //throws SQLException { java.lang.ClassLoader callerClassLoader = java.lang.Runtime.getRuntime().getClass().getClassLoader(); // Basties note: sometime do the same as VM.callerClassLoader(); lock (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ java.util.Iterator <Driver> theIterator = theDrivers.iterator(); while (theIterator.hasNext()) { Driver theDriver = theIterator.next(); if (theDriver.acceptsURL(url) && DriverManager.isClassFromClassLoader(theDriver, callerClassLoader)) { return(theDriver); } } } // If no drivers understand the URL, throw an SQLException // sql.6=No suitable driver // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); //$NON-NLS-1$ //$NON-NLS-2$ }
public WordCollection(Synset synset, SpeechTypes type) { _synset = synset; _words = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)type + _synset.ID); if (_words == null) { _words = new java.util.ArrayList(); } _it = _words.iterator(); }
static void Main() { java.util.ArrayList <int> primeNumbers = new java.util.ArrayList <int>(); primeNumbers.add(1); primeNumbers.add(2); primeNumbers.add(3); primeNumbers.add(5); primeNumbers.add(7); java.lang.SystemJ.outJ.println("Work with all collection elements"); java.lang.SystemJ.outJ.println("Using collection with for loop"); for (int i = 0; i < primeNumbers.size(); i++) { java.lang.SystemJ.outJ.println(primeNumbers.get(i)); } java.lang.SystemJ.outJ.println("Using collection with iterator while loop"); java.util.Iterator <int> it = primeNumbers.iterator(); while (it.hasNext()) { java.lang.SystemJ.outJ.println(it.next()); } java.lang.SystemJ.outJ.println("Using Java collection with .NET foreach loop"); foreach (int prime in primeNumbers) { java.lang.SystemJ.outJ.println(prime); } java.lang.SystemJ.outJ.print(""); }
public WordCollection(Synset synset) { _synset = synset; _words = new java.util.ArrayList(); java.util.ArrayList nouns = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Noun + _synset.ID); java.util.ArrayList verbs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Verb + _synset.ID); java.util.ArrayList adjs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adjective + _synset.ID); java.util.ArrayList advs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adverb + _synset.ID); if (nouns != null) { _words.addAll(nouns); } if (verbs != null) { _words.addAll(verbs); } if (adjs != null) { _words.addAll(adjs); } if (advs != null) { _words.addAll(advs); } _it = _words.iterator(); }
public SynsetCollection() { _synsets = new java.util.ArrayList(); _synsets.addAll(SUMO.WordNet.Intern.nounSUMOHash.keySet()); java.util.Iterator it = SUMO.WordNet.Intern.verbSUMOHash.keySet().iterator(); while(it.hasNext()) { string s = it.next().ToString(); if(_synsets.contains(s)) continue; _synsets.add(s); } it = SUMO.WordNet.Intern.adjectiveSUMOHash.keySet().iterator(); while(it.hasNext()) { string s = it.next().ToString(); if(_synsets.contains(s)) continue; _synsets.add(s); } it = SUMO.WordNet.Intern.adverbSUMOHash.keySet().iterator(); while(it.hasNext()) { string s = it.next().ToString(); if(_synsets.contains(s)) continue; _synsets.add(s); } _it = _synsets.iterator(); }
static void Main() { java.util.ArrayList<int> primeNumbers = new java.util.ArrayList<int>(); primeNumbers.add(1); primeNumbers.add(2); primeNumbers.add(3); primeNumbers.add(5); primeNumbers.add(7); java.lang.SystemJ.outJ.println("Work with all collection elements"); java.lang.SystemJ.outJ.println("Using collection with for loop"); for (int i = 0; i < primeNumbers.size(); i++) java.lang.SystemJ.outJ.println(primeNumbers.get(i)); java.lang.SystemJ.outJ.println("Using collection with iterator while loop"); java.util.Iterator<int> it = primeNumbers.iterator(); while (it.hasNext()) java.lang.SystemJ.outJ.println(it.next()); java.lang.SystemJ.outJ.println("Using Java collection with .NET foreach loop"); foreach (int prime in primeNumbers) java.lang.SystemJ.outJ.println(prime); java.lang.SystemJ.outJ.print(""); }
/* * * Updates services hashtable for all registered providers * */ public static void updateServiceInfo() { services.clear(); for (java.util.Iterator <java.security.Provider> it = providers.iterator(); it.hasNext();) { initServiceInfo(it.next()); } needRefresh = false; }
/* * Answers an iterator over the list of available charsets. * * @return available charsets. */ public override java.util.Iterator <java.nio.charset.Charset> charsets() { java.util.ArrayList <java.nio.charset.Charset> charset = new java.util.ArrayList <java.nio.charset.Charset>(); EncodingInfo [] ei = Encoding.GetEncodings(); foreach (EncodingInfo info in ei) { CharsetImpl ci = new CharsetImpl(info.GetEncoding()); charset.add(ci); } return(charset.iterator()); }
/** * Answers an iterator over the list of available charsets. * * @return available charsets. */ public override java.util.Iterator<java.nio.charset.Charset> charsets() { java.util.ArrayList<java.nio.charset.Charset> charset = new java.util.ArrayList<java.nio.charset.Charset>(); EncodingInfo [] ei = Encoding.GetEncodings(); foreach (EncodingInfo info in ei) { CharsetImpl ci = new CharsetImpl(info.GetEncoding()); charset.add(ci); } return charset.iterator(); }
/** * Gets iterator for user listeners. * * @return iterator for user listeners. */ public java.util.Iterator <T> getUserIterator() { lock (this) { if (userList == null) { java.util.List <T> emptyList = java.util.Collections <T> .emptyList(); return(emptyList.iterator()); } return(new ReadOnlyIterator <T>(userList.iterator())); } }
public WordCollection(Synset synset) { _synset = synset; _words = new java.util.ArrayList(); java.util.ArrayList nouns = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Noun + _synset.ID); java.util.ArrayList verbs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Verb + _synset.ID); java.util.ArrayList adjs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adjective + _synset.ID); java.util.ArrayList advs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adverb + _synset.ID); if(nouns != null) _words.addAll(nouns); if(verbs != null) _words.addAll(verbs); if(adjs != null) _words.addAll(adjs); if(advs != null) _words.addAll(advs); _it = _words.iterator(); }
public static ArrayList ToArrayList(java.util.ArrayList jalist) { if (jalist == null) { return(null); } ArrayList alist = new ArrayList(); java.util.Iterator it = jalist.iterator(); while (it.hasNext()) { alist.Add(it.next()); } return(alist); }
public ArrayList Ask(int argNum1, string term1, int argNum2, string term2) { ArrayList result = new ArrayList(); java.util.ArrayList jres = _kb.askWithRestriction(argNum1, term1, argNum2, term2); if (jres == null) { return(result); } java.util.Iterator it = jres.iterator(); while (it.hasNext()) { com.articulate.sigma.Formula jform = (com.articulate.sigma.Formula)it.next(); Formula f = new Formula(jform); result.Add(f); } return(result); }
private static java.util.ArrayList <Object> getOnlySerializable(java.util.ArrayList <T> list) { if (list == null) { return(null); } java.util.ArrayList <Object> result = new java.util.ArrayList <Object>(); for (java.util.Iterator <T> it = list.iterator(); it.hasNext();) { Object obj = it.next(); if (obj is java.io.Serializable) { result.add(obj); } } return((result.size() != 0) ? result : null); }
public void Test_ForEach_ArrayList() { java.lang.SystemJ.outJ.println("ArrayList foreach test"); java.util.ArrayList <String> testArray = new java.util.ArrayList <String>(); testArray.add("VampireAPI"); testArray.add("supports"); testArray.add("foreach statements"); testArray.add("! Yeah!!!"); // for count loop java.lang.SystemJ.outJ.println("for count loop: "); for (int i = 0; i < testArray.size(); i++) { java.lang.SystemJ.outJ.print(testArray.get(i)); java.lang.SystemJ.outJ.print(" "); } java.lang.SystemJ.outJ.println(); // for iterator loop java.lang.SystemJ.outJ.println("for iterator loop: "); for (java.util.Iterator <String> it = testArray.iterator(); it.hasNext();) { java.lang.SystemJ.outJ.print(it.next()); java.lang.SystemJ.outJ.print(" "); } java.lang.SystemJ.outJ.println(); // foreach loop java.lang.SystemJ.outJ.println("foreach loop: "); foreach (String text in testArray) { java.lang.SystemJ.outJ.print(text); java.lang.SystemJ.outJ.print(" "); } java.lang.SystemJ.outJ.println(); Assert.True(true, "compiler OK"); }
public SynsetCollection() { _synsets = new java.util.ArrayList(); _synsets.addAll(SUMO.WordNet.Intern.nounSUMOHash.keySet()); java.util.Iterator it = SUMO.WordNet.Intern.verbSUMOHash.keySet().iterator(); while (it.hasNext()) { string s = it.next().ToString(); if (_synsets.contains(s)) { continue; } _synsets.add(s); } it = SUMO.WordNet.Intern.adjectiveSUMOHash.keySet().iterator(); while (it.hasNext()) { string s = it.next().ToString(); if (_synsets.contains(s)) { continue; } _synsets.add(s); } it = SUMO.WordNet.Intern.adverbSUMOHash.keySet().iterator(); while (it.hasNext()) { string s = it.next().ToString(); if (_synsets.contains(s)) { continue; } _synsets.add(s); } _it = _synsets.iterator(); }
public void Reset() { _it = _synsets.iterator(); }
/** * Gets iterator for system listeners. * * @return iterator for system listeners. */ public java.util.Iterator <T> getSystemIterator() { return(systemList.iterator()); }