Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / interop-tests / wchar / WCharReference.java
bloba496bfeb0d3933861f8b7101ee698cf161d3945d
1 package interop.wchar;
4 /**
5 * Client.java
7 * Java implemention of the reference wchar data supplied to both
8 * clients and servers. This is independently maintained in parallel
9 * with the c++ version, wchar_reference.cpp
11 * @author Phil Mesnier
12 * @version
15 public class WCharReference
17 private char ref_wchar[] = {1234};
18 private String ref_wstring[] = {"have a nice day"};
19 private char ref_warray[][] =
20 { {'a','A','!','1','4','[','?','%','X','E'} };
21 private String ref_except[] = {"TEST EXCEPTION"};
23 private boolean verbose = false;
25 public WCharReference ()
29 public WCharReference (boolean v)
31 verbose = v;
34 public void set_verbose (boolean v)
36 verbose = v;
39 public char get_wchar (int key) {
40 return ref_wchar[key];
43 public String get_wstring (int key) {
44 return ref_wstring[key];
47 public char[] get_warray (int key) {
48 return ref_warray[key];
51 public String get_except (int key) {
52 return ref_except[key];
55 public boolean match_wchar (short key, char test)
57 if (verbose)
58 System.out.println ("match_wchar: expecting " +
59 ref_wchar[key] + " got " +
60 test + " for key " + key);
61 return ref_wchar[key] == test;
64 public boolean match_wstring (short key, String test)
66 if (key == -1) {
67 if (verbose)
68 System.out.println ("match_wstring: expcting nul string, " +
69 "got string length " + test.length());
70 return test.length() == 0;
72 if (verbose)
73 System.out.println ("match_wstring: expecting " +
74 ref_wstring[key] + " got " +
75 test + " for key " + key);
76 return test.equals(ref_wstring[key]);
79 public boolean match_warray (short key, char test[])
81 if (verbose)
82 System.out.println ("match_warray: key " + key);
83 for (int i = 0; i < test.length; i++)
85 if (verbose)
86 System.out.println (" expecting[" + i + "] " +
87 ref_warray[key][i] + ", got " +
88 test[i]);
89 if (ref_warray[key][i] != test[i])
90 return false;
92 return true;
95 public boolean match_except (short key, String test)
97 if (verbose)
98 System.out.println ("match_except: expecting " +
99 ref_except[key] + " got " +
100 test + " for key " + key);
101 return test.equals(ref_except[key]);