diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-07-27 16:04:43 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-07-27 16:04:43 -0700 |
commit | 038a4b832342ccf710d7d57bad1d10c7b36af022 (patch) | |
tree | 01a1b287852cfcd1750a401e7be030c8f5e5a6b7 /java/src | |
parent | adding more Java optional tests (diff) | |
download | ice-038a4b832342ccf710d7d57bad1d10c7b36af022.tar.bz2 ice-038a4b832342ccf710d7d57bad1d10c7b36af022.tar.xz ice-038a4b832342ccf710d7d57bad1d10c7b36af022.zip |
updating Java API
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/BooleanOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/ByteOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/DoubleOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/FloatOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/IntOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/LongOptional.java | 106 | ||||
-rw-r--r-- | java/src/Ice/ShortOptional.java | 106 | ||||
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 277 |
8 files changed, 959 insertions, 60 deletions
diff --git a/java/src/Ice/BooleanOptional.java b/java/src/Ice/BooleanOptional.java new file mode 100644 index 00000000000..724f89e7460 --- /dev/null +++ b/java/src/Ice/BooleanOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional boolean parameter. + **/ +public class BooleanOptional +{ + /** + * The value defaults to unset. + **/ + public BooleanOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public BooleanOptional(boolean v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public BooleanOptional(BooleanOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public boolean get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(boolean v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(BooleanOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = false; + } + + private boolean _value; + private boolean _isSet; +} diff --git a/java/src/Ice/ByteOptional.java b/java/src/Ice/ByteOptional.java new file mode 100644 index 00000000000..4430f634ffc --- /dev/null +++ b/java/src/Ice/ByteOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional byte parameter. + **/ +public class ByteOptional +{ + /** + * The value defaults to unset. + **/ + public ByteOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public ByteOptional(byte v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public ByteOptional(ByteOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public byte get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(byte v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(ByteOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private byte _value; + private boolean _isSet; +} diff --git a/java/src/Ice/DoubleOptional.java b/java/src/Ice/DoubleOptional.java new file mode 100644 index 00000000000..d9b78066616 --- /dev/null +++ b/java/src/Ice/DoubleOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional double parameter. + **/ +public class DoubleOptional +{ + /** + * The value defaults to unset. + **/ + public DoubleOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public DoubleOptional(double v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public DoubleOptional(DoubleOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public double get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(double v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(DoubleOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private double _value; + private boolean _isSet; +} diff --git a/java/src/Ice/FloatOptional.java b/java/src/Ice/FloatOptional.java new file mode 100644 index 00000000000..d8f11cb6e5e --- /dev/null +++ b/java/src/Ice/FloatOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional float parameter. + **/ +public class FloatOptional +{ + /** + * The value defaults to unset. + **/ + public FloatOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public FloatOptional(float v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public FloatOptional(FloatOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public float get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(float v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(FloatOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = (float)0; + } + + private float _value; + private boolean _isSet; +} diff --git a/java/src/Ice/IntOptional.java b/java/src/Ice/IntOptional.java new file mode 100644 index 00000000000..d80f963b11a --- /dev/null +++ b/java/src/Ice/IntOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional int parameter. + **/ +public class IntOptional +{ + /** + * The value defaults to unset. + **/ + public IntOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public IntOptional(int v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public IntOptional(IntOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public int get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(int v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(IntOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private int _value; + private boolean _isSet; +} diff --git a/java/src/Ice/LongOptional.java b/java/src/Ice/LongOptional.java new file mode 100644 index 00000000000..a40c362736f --- /dev/null +++ b/java/src/Ice/LongOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional long parameter. + **/ +public class LongOptional +{ + /** + * The value defaults to unset. + **/ + public LongOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public LongOptional(long v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public LongOptional(LongOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public long get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(long v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(LongOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private long _value; + private boolean _isSet; +} diff --git a/java/src/Ice/ShortOptional.java b/java/src/Ice/ShortOptional.java new file mode 100644 index 00000000000..b3d3742f8ad --- /dev/null +++ b/java/src/Ice/ShortOptional.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +/** + * Manages an optional short parameter. + **/ +public class ShortOptional +{ + /** + * The value defaults to unset. + **/ + public ShortOptional() + { + _isSet = false; + } + + /** + * Sets the value to the given argument. + * + * @param v The initial value. + **/ + public ShortOptional(short v) + { + _value = v; + _isSet = true; + } + + /** + * Sets the value to a shallow copy of the given optional. + * + * @param opt The source value. + **/ + public ShortOptional(ShortOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Obtains the current value. + * + * @return The current value. + * @throws IllegalStateException If the value is not set. + **/ + public short get() + { + if(!_isSet) + { + throw new IllegalStateException("no value is set"); + } + return _value; + } + + /** + * Sets the value to the given argument. + * + * @param v The new value. + **/ + public void set(short v) + { + _value = v; + _isSet = true; + } + + /** + * If the given argument is set, this optional is set to a shallow copy of the argument, + * otherwise this optional is unset. + * + * @param opt The source value. + **/ + public void set(ShortOptional opt) + { + _value = opt._value; + _isSet = opt._isSet; + } + + /** + * Determines whether the value is set. + * + * @return True if the value is set, false otherwise. + **/ + public boolean isSet() + { + return _isSet; + } + + /** + * Unsets this value. + **/ + public void clear() + { + _isSet = false; + _value = 0; + } + + private short _value; + private boolean _isSet; +} diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 3ed20b61b90..7732c8e4c1a 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -822,11 +822,20 @@ public class BasicStream } public void - writeByte(int tag, Ice.Optional<Byte> v) + writeByte(int tag, Ice.ByteOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F1)) + if(v != null && v.isSet()) { - writeByte(v.get()); + writeByte(tag, v.get()); + } + } + + public void + writeByte(int tag, byte v) + { + if(writeOpt(tag, Ice.OptionalType.F1)) + { + writeByte(v); } } @@ -854,9 +863,18 @@ public class BasicStream public void writeByteSeq(int tag, Ice.Optional<byte[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeByteSeq(tag, v.get()); + } + } + + public void + writeByteSeq(int tag, byte[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - writeByteSeq(v.get()); + writeByteSeq(v); } } @@ -896,7 +914,7 @@ public class BasicStream } public void - readByte(int tag, Ice.Optional<Byte> v) + readByte(int tag, Ice.ByteOptional v) { if(readOpt(tag, Ice.OptionalType.F1)) { @@ -965,11 +983,20 @@ public class BasicStream } public void - writeBool(int tag, Ice.Optional<Boolean> v) + writeBool(int tag, Ice.BooleanOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F1)) + if(v != null && v.isSet()) { - writeBool(v.get()); + writeBool(tag, v.get()); + } + } + + public void + writeBool(int tag, boolean v) + { + if(writeOpt(tag, Ice.OptionalType.F1)) + { + writeBool(v); } } @@ -1000,9 +1027,18 @@ public class BasicStream public void writeBoolSeq(int tag, Ice.Optional<boolean[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - writeBoolSeq(v.get()); + writeBoolSeq(tag, v.get()); + } + } + + public void + writeBoolSeq(int tag, boolean[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeBoolSeq(v); } } @@ -1020,7 +1056,7 @@ public class BasicStream } public void - readBool(int tag, Ice.Optional<Boolean> v) + readBool(int tag, Ice.BooleanOptional v) { if(readOpt(tag, Ice.OptionalType.F1)) { @@ -1072,11 +1108,20 @@ public class BasicStream } public void - writeShort(int tag, Ice.Optional<Short> v) + writeShort(int tag, Ice.ShortOptional v) + { + if(v != null && v.isSet()) + { + writeShort(tag, v.get()); + } + } + + public void + writeShort(int tag, short v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F2)) + if(writeOpt(tag, Ice.OptionalType.F2)) { - writeShort(v.get()); + writeShort(v); } } @@ -1100,11 +1145,19 @@ public class BasicStream public void writeShortSeq(int tag, Ice.Optional<short[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeShortSeq(tag, v.get()); + } + } + + public void + writeShortSeq(int tag, short[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - final short[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 2 + (arr.length > 254 ? 5 : 1)); - writeShortSeq(arr); + writeSize(v == null || v.length == 0 ? 1 : v.length * 2 + (v.length > 254 ? 5 : 1)); + writeShortSeq(v); } } @@ -1122,7 +1175,7 @@ public class BasicStream } public void - readShort(int tag, Ice.Optional<Short> v) + readShort(int tag, Ice.ShortOptional v) { if(readOpt(tag, Ice.OptionalType.F2)) { @@ -1174,11 +1227,20 @@ public class BasicStream } public void - writeInt(int tag, Ice.Optional<Integer> v) + writeInt(int tag, Ice.IntOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F4)) + if(v != null && v.isSet()) { - writeInt(v.get()); + writeInt(tag, v.get()); + } + } + + public void + writeInt(int tag, int v) + { + if(writeOpt(tag, Ice.OptionalType.F4)) + { + writeInt(v); } } @@ -1208,11 +1270,19 @@ public class BasicStream public void writeIntSeq(int tag, Ice.Optional<int[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeIntSeq(tag, v.get()); + } + } + + public void + writeIntSeq(int tag, int[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - final int[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 4 + (arr.length > 254 ? 5 : 1)); - writeIntSeq(arr); + writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1)); + writeIntSeq(v); } } @@ -1230,7 +1300,7 @@ public class BasicStream } public void - readInt(int tag, Ice.Optional<Integer> v) + readInt(int tag, Ice.IntOptional v) { if(readOpt(tag, Ice.OptionalType.F4)) { @@ -1282,11 +1352,20 @@ public class BasicStream } public void - writeLong(int tag, Ice.Optional<Long> v) + writeLong(int tag, Ice.LongOptional v) + { + if(v != null && v.isSet()) + { + writeLong(tag, v.get()); + } + } + + public void + writeLong(int tag, long v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F8)) + if(writeOpt(tag, Ice.OptionalType.F8)) { - writeLong(v.get()); + writeLong(v); } } @@ -1310,11 +1389,19 @@ public class BasicStream public void writeLongSeq(int tag, Ice.Optional<long[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - final long[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 8 + (arr.length > 254 ? 5 : 1)); - writeLongSeq(arr); + writeLongSeq(tag, v.get()); + } + } + + public void + writeLongSeq(int tag, long[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1)); + writeLongSeq(v); } } @@ -1332,7 +1419,7 @@ public class BasicStream } public void - readLong(int tag, Ice.Optional<Long> v) + readLong(int tag, Ice.LongOptional v) { if(readOpt(tag, Ice.OptionalType.F8)) { @@ -1384,11 +1471,20 @@ public class BasicStream } public void - writeFloat(int tag, Ice.Optional<Float> v) + writeFloat(int tag, Ice.FloatOptional v) + { + if(v != null && v.isSet()) + { + writeFloat(tag, v.get()); + } + } + + public void + writeFloat(int tag, float v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F4)) + if(writeOpt(tag, Ice.OptionalType.F4)) { - writeFloat(v.get()); + writeFloat(v); } } @@ -1412,11 +1508,19 @@ public class BasicStream public void writeFloatSeq(int tag, Ice.Optional<float[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) { - final float[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 4 + (arr.length > 254 ? 5 : 1)); - writeFloatSeq(arr); + writeFloatSeq(tag, v.get()); + } + } + + public void + writeFloatSeq(int tag, float[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) + { + writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1)); + writeFloatSeq(v); } } @@ -1434,7 +1538,7 @@ public class BasicStream } public void - readFloat(int tag, Ice.Optional<Float> v) + readFloat(int tag, Ice.FloatOptional v) { if(readOpt(tag, Ice.OptionalType.F4)) { @@ -1486,11 +1590,20 @@ public class BasicStream } public void - writeDouble(int tag, Ice.Optional<Double> v) + writeDouble(int tag, Ice.DoubleOptional v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.F8)) + if(v != null && v.isSet()) { - writeDouble(v.get()); + writeDouble(tag, v.get()); + } + } + + public void + writeDouble(int tag, double v) + { + if(writeOpt(tag, Ice.OptionalType.F8)) + { + writeDouble(v); } } @@ -1514,11 +1627,19 @@ public class BasicStream public void writeDoubleSeq(int tag, Ice.Optional<double[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeDoubleSeq(tag, v.get()); + } + } + + public void + writeDoubleSeq(int tag, double[] v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - final double[] arr = v.get(); - writeSize(arr == null || arr.length == 0 ? 1 : arr.length * 8 + (arr.length > 254 ? 5 : 1)); - writeDoubleSeq(arr); + writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1)); + writeDoubleSeq(v); } } @@ -1536,7 +1657,7 @@ public class BasicStream } public void - readDouble(int tag, Ice.Optional<Double> v) + readDouble(int tag, Ice.DoubleOptional v) { if(readOpt(tag, Ice.OptionalType.F8)) { @@ -1649,9 +1770,18 @@ public class BasicStream public void writeString(int tag, Ice.Optional<String> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.VSize)) + if(v != null && v.isSet()) + { + writeString(tag, v.get()); + } + } + + public void + writeString(int tag, String v) + { + if(writeOpt(tag, Ice.OptionalType.VSize)) { - writeString(v.get()); + writeString(v); } } @@ -1675,10 +1805,19 @@ public class BasicStream public void writeStringSeq(int tag, Ice.Optional<String[]> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.FSize)) + if(v != null && v.isSet()) + { + writeStringSeq(tag, v.get()); + } + } + + public void + writeStringSeq(int tag, String[] v) + { + if(writeOpt(tag, Ice.OptionalType.FSize)) { startSize(); - writeStringSeq(v.get()); + writeStringSeq(v); endSize(); } } @@ -1809,10 +1948,19 @@ public class BasicStream public void writeProxy(int tag, Ice.Optional<Ice.ObjectPrx> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.FSize)) + if(v != null && v.isSet()) + { + writeProxy(tag, v.get()); + } + } + + public void + writeProxy(int tag, Ice.ObjectPrx v) + { + if(writeOpt(tag, Ice.OptionalType.FSize)) { startSize(); - writeProxy(v.get()); + writeProxy(v); endSize(); } } @@ -1895,9 +2043,18 @@ public class BasicStream public <T extends Ice.Object> void writeObject(int tag, Ice.Optional<T> v) { - if(v != null && v.isSet() && writeOpt(tag, Ice.OptionalType.Size)) + if(v != null && v.isSet()) + { + writeObject(tag, v.get()); + } + } + + public void + writeObject(int tag, Ice.Object v) + { + if(writeOpt(tag, Ice.OptionalType.Size)) { - writeObject(v.get()); + writeObject(v); } } |