28 import org.omg.CORBA.portable.Streamable; |
28 import org.omg.CORBA.portable.Streamable; |
29 import org.omg.CORBA.portable.InputStream; |
29 import org.omg.CORBA.portable.InputStream; |
30 import org.omg.CORBA.portable.OutputStream; |
30 import org.omg.CORBA.portable.OutputStream; |
31 |
31 |
32 /** |
32 /** |
33 * The Holder for <tt>Double</tt>. For more information on |
33 * The Holder for {@code Double}. For more information on |
34 * Holder files, see <a href="doc-files/generatedfiles.html#holder"> |
34 * Holder files, see <a href="doc-files/generatedfiles.html#holder"> |
35 * "Generated Files: Holder Files"</a>.<P> |
35 * "Generated Files: Holder Files"</a>.<P> |
36 * A Holder class for a <code>double</code> |
36 * A Holder class for a {@code double} |
37 * that is used to store "out" and "inout" parameters in IDL methods. |
37 * that is used to store "out" and "inout" parameters in IDL methods. |
38 * If an IDL method signature has an IDL <code>double</code> as an "out" |
38 * If an IDL method signature has an IDL {@code double} as an "out" |
39 * or "inout" parameter, the programmer must pass an instance of |
39 * or "inout" parameter, the programmer must pass an instance of |
40 * <code>DoubleHolder</code> as the corresponding |
40 * {@code DoubleHolder} as the corresponding |
41 * parameter in the method invocation; for "inout" parameters, the programmer |
41 * parameter in the method invocation; for "inout" parameters, the programmer |
42 * must also fill the "in" value to be sent to the server. |
42 * must also fill the "in" value to be sent to the server. |
43 * Before the method invocation returns, the ORB will fill in the |
43 * Before the method invocation returns, the ORB will fill in the |
44 * value corresponding to the "out" value returned from the server. |
44 * value corresponding to the "out" value returned from the server. |
45 * <P> |
45 * <P> |
46 * If <code>myDoubleHolder</code> is an instance of <code>DoubleHolder</code>, |
46 * If {@code myDoubleHolder} is an instance of {@code DoubleHolder}, |
47 * the value stored in its <code>value</code> field can be accessed with |
47 * the value stored in its {@code value} field can be accessed with |
48 * <code>myDoubleHolder.value</code>. |
48 * {@code myDoubleHolder.value}. |
49 * |
49 * |
50 * @since JDK1.2 |
50 * @since JDK1.2 |
51 */ |
51 */ |
52 public final class DoubleHolder implements Streamable { |
52 public final class DoubleHolder implements Streamable { |
53 |
53 |
54 /** |
54 /** |
55 * The <code>double</code> value held by this <code>DoubleHolder</code> |
55 * The {@code double} value held by this {@code DoubleHolder} |
56 * object. |
56 * object. |
57 */ |
57 */ |
58 |
58 |
59 public double value; |
59 public double value; |
60 |
60 |
61 /** |
61 /** |
62 * Constructs a new <code>DoubleHolder</code> object with its |
62 * Constructs a new {@code DoubleHolder} object with its |
63 * <code>value</code> field initialized to 0.0. |
63 * {@code value} field initialized to 0.0. |
64 */ |
64 */ |
65 public DoubleHolder() { |
65 public DoubleHolder() { |
66 } |
66 } |
67 |
67 |
68 /** |
68 /** |
69 * Constructs a new <code>DoubleHolder</code> object for the given |
69 * Constructs a new {@code DoubleHolder} object for the given |
70 * <code>double</code>. |
70 * {@code double}. |
71 * @param initial the <code>double</code> with which to initialize |
71 * @param initial the {@code double} with which to initialize |
72 * the <code>value</code> field of the new |
72 * the {@code value} field of the new |
73 * <code>DoubleHolder</code> object |
73 * {@code DoubleHolder} object |
74 */ |
74 */ |
75 public DoubleHolder(double initial) { |
75 public DoubleHolder(double initial) { |
76 value = initial; |
76 value = initial; |
77 } |
77 } |
78 |
78 |
79 /** |
79 /** |
80 * Read a double value from the input stream and store it in the |
80 * Read a double value from the input stream and store it in the |
81 * value member. |
81 * value member. |
82 * |
82 * |
83 * @param input the <code>InputStream</code> to read from. |
83 * @param input the {@code InputStream} to read from. |
84 */ |
84 */ |
85 public void _read(InputStream input) { |
85 public void _read(InputStream input) { |
86 value = input.read_double(); |
86 value = input.read_double(); |
87 } |
87 } |
88 |
88 |
89 /** |
89 /** |
90 * Write the double value stored in this holder to an |
90 * Write the double value stored in this holder to an |
91 * <code>OutputStream</code>. |
91 * {@code OutputStream}. |
92 * |
92 * |
93 * @param output the <code>OutputStream</code> to write into. |
93 * @param output the {@code OutputStream} to write into. |
94 */ |
94 */ |
95 public void _write(OutputStream output) { |
95 public void _write(OutputStream output) { |
96 output.write_double(value); |
96 output.write_double(value); |
97 } |
97 } |
98 |
98 |
99 /** |
99 /** |
100 * Return the <code>TypeCode</code> of this holder object. |
100 * Return the {@code TypeCode} of this holder object. |
101 * |
101 * |
102 * @return the <code>TypeCode</code> object. |
102 * @return the {@code TypeCode} object. |
103 */ |
103 */ |
104 public org.omg.CORBA.TypeCode _type() { |
104 public org.omg.CORBA.TypeCode _type() { |
105 return ORB.init().get_primitive_tc(TCKind.tk_double); |
105 return ORB.init().get_primitive_tc(TCKind.tk_double); |
106 } |
106 } |
107 |
107 |