01: package demo.value.idl;
02:
03: import java.util.*;
04:
05: public class ValueServerImpl extends ValueServerPOA {
06: public String receive_long(boxedLong p1, boxedLong p2) {
07: if (p1 == null || p2 == null)
08: return "one or two null values";
09: else if (p1 == p2)
10: return "shared long: " + p1.value;
11: else
12: return "two longs: " + p1.value + ", " + p2.value;
13: }
14:
15: public String receive_string(String s1, String s2) {
16: if (s1 == null || s2 == null)
17: return "one or two null values";
18: else if (s1 == s2)
19: return "shared string: " + s1;
20: else
21: return "two strings: `" + s1 + "', `" + s2 + "'";
22: }
23:
24: public String receive_list(Node n) {
25: List l = new ArrayList();
26: Node x = n;
27:
28: while (x != null && !l.contains(x)) {
29: l.add(x);
30: x = x.next;
31: }
32:
33: StringBuffer result = new StringBuffer("list of length: "
34: + l.size() + " -- ");
35: for (Iterator i = l.iterator(); i.hasNext();) {
36: Node q = (Node) i.next();
37: result.append(q.id);
38: if (i.hasNext())
39: result.append(" ");
40: }
41: return result.toString();
42: }
43:
44: }
|