author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:53:38 +0200 | |
changeset 78 | af48bccb02cb |
permissions | -rw-r--r-- |
jtulach@78 | 1 |
package api.request.response; |
jtulach@78 | 2 |
|
jtulach@78 | 3 |
import java.util.ArrayList; |
jtulach@78 | 4 |
import java.util.Iterator; |
jtulach@78 | 5 |
import java.util.List; |
jtulach@78 | 6 |
|
jtulach@78 | 7 |
public class Support { |
jtulach@78 | 8 |
private Support() { |
jtulach@78 | 9 |
} |
jtulach@78 | 10 |
|
jtulach@78 | 11 |
public static int searchByName(String name, Compute provider) { |
jtulach@78 | 12 |
List<String> result = new ArrayList<String>(); |
jtulach@78 | 13 |
Compute.Request request = new Compute.Request(); |
jtulach@78 | 14 |
Compute.Response response = new Compute.Response(result); |
jtulach@78 | 15 |
|
jtulach@78 | 16 |
provider.computeData(request, response); |
jtulach@78 | 17 |
|
jtulach@78 | 18 |
Iterator<String> it = result.iterator(); |
jtulach@78 | 19 |
for (int i = 0; it.hasNext(); i++) { |
jtulach@78 | 20 |
if (name.equals(it.next())) { |
jtulach@78 | 21 |
return i; |
jtulach@78 | 22 |
} |
jtulach@78 | 23 |
} |
jtulach@78 | 24 |
return -1; |
jtulach@78 | 25 |
} |
jtulach@78 | 26 |
|
jtulach@78 | 27 |
} |