author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:53:37 +0200 | |
changeset 77 | 22c1953e372c |
permissions | -rw-r--r-- |
jtulach@77 | 1 |
package api.classes; |
jtulach@77 | 2 |
|
jtulach@77 | 3 |
import java.util.Iterator; |
jtulach@77 | 4 |
import java.util.Map.Entry; |
jtulach@77 | 5 |
|
jtulach@77 | 6 |
public class Support { |
jtulach@77 | 7 |
private Support() { |
jtulach@77 | 8 |
} |
jtulach@77 | 9 |
|
jtulach@77 | 10 |
public static int searchByName(String name, Compute provider) { |
jtulach@77 | 11 |
Iterator<String> it = provider.getData().iterator(); |
jtulach@77 | 12 |
for (int i = 0; it.hasNext(); i++) { |
jtulach@77 | 13 |
if (name.equals(it.next())) { |
jtulach@77 | 14 |
return i; |
jtulach@77 | 15 |
} |
jtulach@77 | 16 |
} |
jtulach@77 | 17 |
return -1; |
jtulach@77 | 18 |
} |
jtulach@77 | 19 |
|
jtulach@77 | 20 |
/** @since 2.0 */ |
jtulach@77 | 21 |
public static int searchByDescription(String name, Compute provider) { |
jtulach@77 | 22 |
Iterator<Entry<String, String>> it = provider.getDataAndDescription().entrySet().iterator(); |
jtulach@77 | 23 |
for (int i = 0; it.hasNext(); i++) { |
jtulach@77 | 24 |
if (name.equals(it.next().getValue())) { |
jtulach@77 | 25 |
return i; |
jtulach@77 | 26 |
} |
jtulach@77 | 27 |
} |
jtulach@77 | 28 |
return -1; |
jtulach@77 | 29 |
} |
jtulach@77 | 30 |
|
jtulach@77 | 31 |
} |