diff options
Diffstat (limited to 'gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes')
9 files changed, 1495 insertions, 0 deletions
diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java new file mode 100644 index 000000000..3cb8ebfb3 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java @@ -0,0 +1,148 @@ +/* AliasTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + + +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * The type code that is an alias of another type code. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class AliasTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * The typecode repository id. + */ + protected final String id; + + /** + * The typecode name. + */ + protected final String name; + + /** + * The type code for that this typecode is an alias. + */ + protected final TypeCode aliasFor; + + /** + * Create the typecode, specifying for that typecode it is an + * alias and the id and name of the newly created typecode. + * + * @param an_aliasFor the typecode, for that this typecode is an + * alias. + * + * @param an_id the repository id fo the newly created typecode. + * + * @param a_name the name of the newly created typecode. + */ + public AliasTypeCode(TypeCode an_aliasFor, String an_id, String a_name) + { + super(TCKind.tk_alias); + aliasFor = an_aliasFor; + id = an_id; + name = a_name; + } + + /** + * Get the typecode, for that this typecode is an alias. + */ + public TypeCode content_type() + { + return aliasFor; + } + + /** + * The objects are assumed to be equal if they repository + * ids are both equal or both unavailable and the + * kind values are equal. + * + * @param other the other typecode to compare. + */ + public boolean equal(TypeCode other) + { + if (super.equal(other)) + return true; + try + { + return id.equals(other.id()); + } + catch (BadKind ex) + { + return false; + } + } + + /** + * Return true if the given typecode is equal for + * either this typecode of the alias typecode. + * + * @param other the typecode to compare. + */ + public boolean equivalent(TypeCode other) + { + return other.equal(this) || other.equal(aliasFor); + } + + /** + * Get the repository id of this typecode. + */ + public String id() + { + return id; + } + + /** + * Get the name of this typecode. + */ + public String name() + { + return name; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java new file mode 100644 index 000000000..bb798101a --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java @@ -0,0 +1,272 @@ +/* ArrayTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + + +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * A TypeCode for arrays. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ArrayTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + + /** + * The array components. + */ + TypeCode of; + + /** + * The length of the array, must be updated when setting + * a new value. + */ + private int length; + + /** + * Create a primitive array type code, defining the sequence + * {@link TCKind.tk_sequence)} with + * the given member type. + * + * @param array_of the sequence member type. + */ + public ArrayTypeCode(TCKind array_of) + { + super(TCKind.tk_sequence); + of = new PrimitiveTypeCode(array_of); + } + + /** + * Create a primitive array type code, defining the array, sequence + * or other type with the given member type. + * + * @param this_type the type of this type (normally either + * sequence of array). + * @param array_of the sequence member type. + */ + public ArrayTypeCode(TCKind this_type, TypeCode array_of) + { + super(this_type); + of = array_of; + } + + /** + * Return the array component type. + * @return the array component type + * @throws org.omg.CORBA.TypeCodePackage.BadKind + */ + public TypeCode content_type() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + return of; + } + + /** + * Return true if the other TypeCode defines the array, having elements + * of the same type. The sizes of arrays are not taken into + * consideration. + * + * @param other the other TypeCode + * @return true if <code>other</code> is an array with the same + * component type. + */ + public boolean equal(TypeCode other) + { + try + { + return kind() == other.kind() && + content_type() == other.content_type(); + } + catch (BadKind ex) + { + // Should not be thrown. + return false; + } + } + + /** + * Returns the agreed Id in the form of + * <code>IDL:omg.org/CORBA/ {type name} Seq:1.0</code>. + * + * @return the Id of this TypeCode. + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind if the content type + * is not one of the constants, defined in {@link TCKind}. + * This package class should not be used as TypeCode for the arrays, + * holding the user defined components. + */ + public String id() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + switch (content_type().kind().value()) + { + case TCKind._tk_null : + return "IDL:omg.org/CORBA/NullSeq:1.0"; + + case TCKind._tk_void : + return "IDL:omg.org/CORBA/VoidSeq:1.0"; + + case TCKind._tk_short : + return "IDL:omg.org/CORBA/ShortSeq:1.0"; + + case TCKind._tk_long : + return "IDL:omg.org/CORBA/LongSeq:1.0"; + + case TCKind._tk_ushort : + return "IDL:omg.org/CORBA/UShortSeq:1.0"; + + case TCKind._tk_ulong : + return "IDL:omg.org/CORBA/ULongSeq:1.0"; + + case TCKind._tk_float : + return "IDL:omg.org/CORBA/FloatSeq:1.0"; + + case TCKind._tk_double : + return "IDL:omg.org/CORBA/DoubleSeq:1.0"; + + case TCKind._tk_boolean : + return "IDL:omg.org/CORBA/BooleanSeq:1.0"; + + case TCKind._tk_char : + return "IDL:omg.org/CORBA/CharSeq:1.0"; + + case TCKind._tk_octet : + return "IDL:omg.org/CORBA/OctetSeq:1.0"; + + case TCKind._tk_any : + return "IDL:omg.org/CORBA/AnySeq:1.0"; + + case TCKind._tk_TypeCode : + return "IDL:omg.org/CORBA/TypeCodeSeq:1.0"; + + case TCKind._tk_Principal : + return "IDL:omg.org/CORBA/PrincipalSeq:1.0"; + + case TCKind._tk_objref : + return "IDL:omg.org/CORBA/ObjrefSeq:1.0"; + + case TCKind._tk_struct : + return "IDL:omg.org/CORBA/StructSeq:1.0"; + + case TCKind._tk_union : + return "IDL:omg.org/CORBA/UnionSeq:1.0"; + + case TCKind._tk_enum : + return "IDL:omg.org/CORBA/EnumSeq:1.0"; + + case TCKind._tk_string : + return "IDL:omg.org/CORBA/StringSeq:1.0"; + + case TCKind._tk_sequence : + return "IDL:omg.org/CORBA/SequenceSeq:1.0"; + + case TCKind._tk_array : + return "IDL:omg.org/CORBA/ArraySeq:1.0"; + + case TCKind._tk_alias : + return "IDL:omg.org/CORBA/AliasSeq:1.0"; + + case TCKind._tk_except : + return "IDL:omg.org/CORBA/ExceptSeq:1.0"; + + case TCKind._tk_longlong : + return "IDL:omg.org/CORBA/LongLongSeq:1.0"; + + case TCKind._tk_ulonglong : + return "IDL:omg.org/CORBA/ULongLongSeq:1.0"; + + case TCKind._tk_longdouble : + return "IDL:omg.org/CORBA/LongDoubleSeq:1.0"; + + case TCKind._tk_wchar : + return "IDL:omg.org/CORBA/WCharSeq:1.0"; + + case TCKind._tk_wstring : + return "IDL:omg.org/CORBA/WStringSeq:1.0"; + + case TCKind._tk_fixed : + return "IDL:omg.org/CORBA/FixedSeq:1.0"; + + case TCKind._tk_value : + return "IDL:omg.org/CORBA/ValueSeq:1.0"; + + case TCKind._tk_value_box : + return "IDL:omg.org/CORBA/Value_boxSeq:1.0"; + + case TCKind._tk_native : + return "IDL:omg.org/CORBA/NativeSeq:1.0"; + + case TCKind._tk_abstract_interface : + return "IDL:omg.org/CORBA/Abstract_interfaceSeq:1.0"; + + default : + throw new BadKind(); + } + } + + /** + * Return the array length. + * @return the length of the array. + * @throws org.omg.CORBA.TypeCodePackage.BadKind + */ + public int length() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + return length; + } + + /** + * Sets the array length to the supplied value. + * + * @param l the new length. + */ + public void setLength(int l) + { + this.length = l; + } + +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java new file mode 100644 index 000000000..af7f46ecf --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java @@ -0,0 +1,152 @@ +/* FixedTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + + +import java.math.BigDecimal; + +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * A typecode for CORBA <code>fixed</code> + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class FixedTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + + /** + * The number of the used digits. + */ + private short digits; + + /** + * The number of the digits after the decimal point. + */ + private short scale; + + /** + * Creates the instance of the fixed type code. + */ + public FixedTypeCode() + { + super(TCKind.tk_fixed); + } + + /** + * Creates the instance of the fixed type code, + * setting the digits and scale by example. + */ + public FixedTypeCode(BigDecimal example) + { + super(TCKind.tk_fixed); + if (example != null) + { + setScale(example.scale()); + setDigits(countDigits(example)); + } + } + + /** + * Set the number of digits. + */ + public void setDigits(int a_digits) + { + this.digits = (short) a_digits; + } + + /** + * Set the number of digits after the decimal point. + */ + public void setScale(int a_scale) + { + this.scale = (short) a_scale; + } + + /** + * Get the number of digits in thid BigDecimal + * + * @param number a BigDecimal to check. + */ + public static int countDigits(BigDecimal number) + { + return number.unscaledValue().abs().toString().length(); + } + + /** + * Compare with other type code for equality. + */ + public boolean equal(TypeCode other) + { + if (other == this) return true; + try + { + TypeCode that = (TypeCode) other; + return kind() == that.kind() && digits == that.fixed_digits() && + scale == that.fixed_scale(); + } + catch (BadKind ex) + { + return false; + } + } + + /** + * Get the number of digits. + */ + public short fixed_digits() + { + return digits; + } + + /** + * Get the number of digits after the decimal point. + */ + public short fixed_scale() + { + return scale; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java new file mode 100644 index 000000000..0a907844a --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java @@ -0,0 +1,249 @@ +/* GeneralTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + +import gnu.CORBA.CDR.BufferedCdrOutput; + +import java.util.Arrays; +import java.util.BitSet; + +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * A typecode for types, requiring to provide various additional + * properties but still not requiring to store the + * members of the structure. The property can be retrieved + * by the corresponding method if it has been previously assigned. + * Otherwise, a {@link BadKind} is thrown. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class GeneralTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + + /** + * Indicates that the field value has not been previously set. + */ + protected static int UNSET = Integer.MIN_VALUE; + + /** + * The kinds for that the length() must return 0 even if it + * has not been previously set. + */ + private static final BitSet lengthAllowed = new BitSet(); + + static + { + lengthAllowed.set(TCKind._tk_array); + lengthAllowed.set(TCKind._tk_sequence); + lengthAllowed.set(TCKind._tk_string); + lengthAllowed.set(TCKind._tk_wstring); + } + + private String id; + private String name; + private TypeCode concrete_base_type; + private TypeCode content_type; + private int len; + private int type_modifier = UNSET; + + /** + * Create a new instance, setting kind to the given kind. + * @param a_kind the kind of the typecode being created. + */ + public GeneralTypeCode(TCKind a_kind) + { + super(a_kind); + if (!lengthAllowed.get(a_kind.value())) + len = UNSET; + } + + /** + * Set this property. + */ + public void setConcreteBase_type(TypeCode a_concrete_base_type) + { + this.concrete_base_type = a_concrete_base_type; + } + + /** + * Set the component content type. + */ + public void setContentType(TypeCode a_content_type) + { + this.content_type = a_content_type; + } + + /** + * Set this property. + */ + public void setId(String an_id) + { + this.id = an_id; + } + + /** + * Set the length property. + * @param l + */ + public void setLength(int l) + { + len = l; + } + + /** + * Set this property. + */ + public void setName(String a_name) + { + this.name = a_name; + } + + /** + * Set the type modifier. + */ + public void setTypeModifier(int a_type_modifier) + { + this.type_modifier = a_type_modifier; + } + + /** {@inheritDoc} */ + public TypeCode concrete_base_type() + throws BadKind + { + if (concrete_base_type != null) + return concrete_base_type; + throw new BadKind("concrete_base_type"); + } + + /** + * Returns the content type that must be explicitly set + * for this class. + * + * @throws BadKind if the content type has not been set. + */ + public TypeCode content_type() + throws BadKind + { + if (content_type != null) + return content_type; + throw new BadKind("content_type"); + } + + /** + * Returns true if both typecodes, if written into CDR + * stream, would result the same stream content. + */ + public boolean equal(TypeCode other) + { + if (this == other) + return true; + if (kind() != other.kind()) + return false; + + BufferedCdrOutput a = new BufferedCdrOutput(16); + BufferedCdrOutput b = new BufferedCdrOutput(16); + + a.write_TypeCode(this); + b.write_TypeCode(other); + + return Arrays.equals(a.buffer.toByteArray(), b.buffer.toByteArray()); + } + + /** + * Delegates functionality to {@link #equal}. + */ + public boolean equivalent(TypeCode other) + { + return equal(other); + } + + /** {@inheritDoc} */ + public String id() + throws BadKind + { + if (id != null) + return id; + throw new BadKind("id"); + } + + /** + * Get the length. For sequences, arrays, strings and wstrings + * this method returns 0 rather than throwing a BadKind even + * if {@link setLength(int)} has not been previously called. + * + * @return the length of string, array or sequence. + * + * @throws BadKind if the method cannot be invoked for the + * given kind of typecode. + */ + public int length() + throws BadKind + { + if (len != UNSET) + return len; + throw new BadKind("length"); + } + + /** {@inheritDoc} */ + public String name() + throws BadKind + { + if (name != null) + return name; + throw new BadKind("name"); + } + + /** {@inheritDoc} */ + public short type_modifier() + throws BadKind + { + if (type_modifier != UNSET) + return (short) type_modifier; + throw new BadKind("type_modifier"); + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java new file mode 100644 index 000000000..22d39a82c --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java @@ -0,0 +1,201 @@ +/* PrimitiveTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.CORBA.typecodes; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.TypeCodePackage.Bounds; +import org.omg.CORBA.portable.IDLEntity; + +/** + * An information about a primitive CORBA data type + * (boolean, char, wchar, octet and also signed or unsigned short, long, + * long long, float and double). + * This class only implements the methods {@link #kind() } + * and {@link equal() } that are valid for + * all TypeCode kinds. Other methods are implemented in derived + * subclasses. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class PrimitiveTypeCode + extends TypeCode + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * The kind of this TypeCode. + */ + protected final TCKind kind; + + public PrimitiveTypeCode(TCKind a_kind) + { + kind = a_kind; + } + + public TypeCode concrete_base_type() + throws BadKind + { + throw new BadKind(); + } + + public TypeCode content_type() + throws BadKind + { + throw new BadKind(); + } + + public int default_index() + throws BadKind + { + throw new BadKind(); + } + + public TypeCode discriminator_type() + throws BadKind + { + throw new BadKind(); + } + + /** + * Test two types for equality. The default implementation + * returs true of the types of the same kind. + * @param other the other type to compere with + * @return true if the types are interchangeable. + */ + public boolean equal(TypeCode other) + { + return kind() == other.kind(); + } + + public boolean equivalent(TypeCode parm1) + { + throw new NO_IMPLEMENT(); + } + + public short fixed_digits() + throws BadKind + { + throw new BadKind("fixed_digits"); + } + + public short fixed_scale() + throws BadKind + { + throw new BadKind("fixed_scale"); + } + + public TypeCode get_compact_typecode() + { + throw new NO_IMPLEMENT(); + } + + public String id() + throws BadKind + { + throw new BadKind("id"); + } + + /** + * Return the kind of this type code object. + * @return one of the <code>TCKind.t_..</code> fields. + */ + public TCKind kind() + { + return kind; + } + + public int length() + throws BadKind + { + throw new BadKind("length"); + } + + public int member_count() + throws BadKind + { + throw new BadKind("member_count"); + } + + public Any member_label(int index) + throws BadKind, Bounds + { + throw new BadKind("member_label"); + } + + public String member_name(int index) + throws BadKind, Bounds + { + throw new BadKind("member_name"); + } + + public TypeCode member_type(int index) + throws BadKind, Bounds + { + throw new BadKind("member_type"); + } + + public short member_visibility(int index) + throws BadKind, Bounds + { + throw new BadKind("member_visibility"); + } + + public String name() + throws BadKind + { + throw new BadKind("name"); + } + + public short type_modifier() + throws BadKind + { + throw new BadKind("type_modifier"); + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java new file mode 100644 index 000000000..89f342546 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java @@ -0,0 +1,252 @@ +/* RecordTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + +import gnu.CORBA.CorbaList; + +import org.omg.CORBA.Any; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.TypeCodePackage.Bounds; +import org.omg.CORBA.UnionMember; +import org.omg.CORBA.ValueMember; + +/** + * The type code that also has the member property getters + * supported. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class RecordTypeCode + extends GeneralTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * The individual field of the record. + */ + public static class Field + { + /** + * The record label. + */ + public Any label; + + /** + * The record name. + */ + public String name; + + /** + * The record type. + */ + public TypeCode type; + + /** + * The record visibility. + */ + public int visibility = UNSET; + } + + /** + * The members of this data structure. + */ + protected CorbaList members = new CorbaList(); + private TypeCode discriminator_type; + private int default_index = UNSET; + + /** + * Creates the type code of the given kind. + */ + public RecordTypeCode(TCKind a_kind) + { + super(a_kind); + } + + /** + * Set the default index. + */ + public void setDefaultIndex(int a_default_index) + { + this.default_index = a_default_index; + } + + /** + * Set the discriminator type. + */ + public void setDiscriminator_type(TypeCode a_discriminator_type) + { + this.discriminator_type = a_discriminator_type; + } + + public Field getField(int p) + { + return (Field) members.get(p); + } + + public void add(Field field) + { + members.add(field); + } + + /** + * Adds a new field, taking values from the passed + * {@link StructMember}. + */ + public void add(StructMember m) + { + Field f = field(); + f.name = m.name; + f.type = m.type; + } + + /** + * Adds a new field, taking values from the passed + * {@link ValueMember}. + */ + public void add(ValueMember m) + { + Field f = field(); + f.name = m.name; + f.type = m.type; + f.visibility = m.access; + + } + + /** + * Adds a new field, taking values from the passed + * {@link UnionMember}. + */ + public void add(UnionMember m) + { + Field f = field(); + f.name = m.name; + f.type = m.type; + f.label = m.label; + } + + public int default_index() + throws BadKind + { + if (default_index != UNSET) + return default_index; + throw new BadKind(); + } + + public TypeCode discriminator_type() + throws BadKind + { + if (discriminator_type != null) + return discriminator_type; + throw new BadKind(); + } + + /** + * Creates, adds and returns new field. + */ + public Field field() + { + Field f = new Field(); + members.add(f); + return f; + } + + /** {@inheritDoc} */ + public int member_count() + { + return members.size(); + } + + /** {@inheritDoc} */ + public Any member_label(int index) + throws BadKind, Bounds + { + Field f = getField(index); + if (f.label != null) + { + return f.label; + } + else + throw new BadKind(); + } + + /** {@inheritDoc} */ + public String member_name(int index) + throws BadKind + { + Field f = getField(index); + if (f.name != null) + { + return f.name; + } + else + throw new BadKind(); + } + + /** {@inheritDoc} */ + public TypeCode member_type(int index) + throws BadKind, Bounds + { + Field f = getField(index); + if (f.type != null) + { + return f.type; + } + else + throw new BadKind(); + } + + /** {@inheritDoc} */ + public short member_visibility(int index) + throws BadKind, Bounds + { + Field f = getField(index); + if (f.visibility != UNSET) + { + return (short) f.visibility; + } + else + throw new BadKind(); + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java new file mode 100644 index 000000000..8ec2f5474 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java @@ -0,0 +1,84 @@ +/* RecursiveTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + + +import org.omg.CORBA.TCKind; + +/** + * The typecode, serving as a placeholder in defining + * typecodes, containing recursion. + */ +public class RecursiveTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * The id of the type for that this type serves as a + * placeholder. + */ + private final String the_id; + + /** + * Create a typecode that serves as a placeholder for + * the typecode with the given id. + * + * @param an_id the Id of the type for that this type serves as a + * placeholder. + */ + public RecursiveTypeCode(String an_id) + { + super(TCKind.tk_null); + the_id = an_id; + } + + /** + * Get the id of the type for that this type serves as a + * placeholder. + */ + public String id() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + return the_id; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java new file mode 100644 index 000000000..2d1689b45 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java @@ -0,0 +1,89 @@ +/* StringTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.CORBA.typecodes; + + +import org.omg.CORBA.TCKind; + +/** + * The typecode for string and wide string. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class StringTypeCode + extends PrimitiveTypeCode +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + private int len = 0; + + /** + * Create a new instance of the string type code. + * + * @param a_kind a kind of this typecode, normally + * either tk_string or tk_wstring. + */ + public StringTypeCode(TCKind a_kind) + { + super(a_kind); + } + + /** + * Set the length property. + * + * @param a_length a length. + */ + public void setLength(int a_length) + { + len = a_length; + } + + /** + * Get the length of the string. This method returns 0 + * (unbounded) if the property has not been set. + * + * @return the length (bound) of the string. + */ + public int length() + { + return len; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/package.html b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/package.html new file mode 100644 index 000000000..891b3b965 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/CORBA/typecodes/package.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.CORBA.typecodes</title></head> + +<body> + Contains GNU Classpath specific typecode definitions. + + @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> + |