package nsdb.NucFeaturePackage;


/**
* nsdb/NucFeaturePackage/QualifierValue_uHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from corba/nsdb.idl
* Monday, August 23, 2004 12:02:41 PM BST
*/

abstract public class QualifierValue_uHelper
{
  private static String  _id = "IDL:nsdb/NucFeature/QualifierValue_u:1.0";

  public static void insert (org.omg.CORBA.Any a, nsdb.NucFeaturePackage.QualifierValue_u that)
  {
    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
    a.type (type ());
    write (out, that);
    a.read_value (out.create_input_stream (), type ());
  }

  public static nsdb.NucFeaturePackage.QualifierValue_u extract (org.omg.CORBA.Any a)
  {
    return read (a.create_input_stream ());
  }

  private static org.omg.CORBA.TypeCode __typeCode = null;
  synchronized public static org.omg.CORBA.TypeCode type ()
  {
    if (__typeCode == null)
    {
      org.omg.CORBA.TypeCode _disTypeCode0;
      _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      _disTypeCode0 = org.omg.CORBA.ORB.init ().create_alias_tc (nsdb.NucFeaturePackage.QualifierTypeCodeHelper.id (), "QualifierTypeCode", _disTypeCode0);
      org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [10];
      org.omg.CORBA.TypeCode _tcOf_members0;
      org.omg.CORBA.Any _anyOf_members0;

      // Branch for applicable (case label nsdb.NucFeature.boolean_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.boolean_qtc);
      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
      _members0[0] = new org.omg.CORBA.UnionMember (
        "applicable",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for text (case label nsdb.NucFeature.string_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.string_qtc);
      _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
      _members0[1] = new org.omg.CORBA.UnionMember (
        "text",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for integer (case label nsdb.NucFeature.integer_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.integer_qtc);
      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      _members0[2] = new org.omg.CORBA.UnionMember (
        "integer",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for real (case label nsdb.NucFeature.real_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.real_qtc);
      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
      _members0[3] = new org.omg.CORBA.UnionMember (
        "real",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for translation_exception (case label nsdb.NucFeature.TranslationException_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.TranslationException_qtc);
      _tcOf_members0 = type.TranslationExceptionHelper.type ();
      _members0[4] = new org.omg.CORBA.UnionMember (
        "translation_exception",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for codon_translation (case label nsdb.NucFeature.CodonTranslation_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.CodonTranslation_qtc);
      _tcOf_members0 = type.CodonTranslationHelper.type ();
      _members0[5] = new org.omg.CORBA.UnionMember (
        "codon_translation",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for anti_codon (case label nsdb.NucFeature.Anticodon_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.Anticodon_qtc);
      _tcOf_members0 = type.AntiCodonHelper.type ();
      _members0[6] = new org.omg.CORBA.UnionMember (
        "anti_codon",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for splice_consensus (case label nsdb.NucFeature.SpliceConsensus_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.SpliceConsensus_qtc);
      _tcOf_members0 = type.SpliceConsensusHelper.type ();
      _members0[7] = new org.omg.CORBA.UnionMember (
        "splice_consensus",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for repeat_unit (case label nsdb.NucFeature.RepeatUnit_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.RepeatUnit_qtc);
      _tcOf_members0 = type.RepeatUnitHelper.type ();
      _members0[8] = new org.omg.CORBA.UnionMember (
        "repeat_unit",
        _anyOf_members0,
        _tcOf_members0,
        null);

      // Branch for db_xref (case label nsdb.NucFeature.DbXref_qtc)
      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
      _anyOf_members0.insert_long ((int)nsdb.NucFeature.DbXref_qtc);
      _tcOf_members0 = type.DbXrefHelper.type ();
      _members0[9] = new org.omg.CORBA.UnionMember (
        "db_xref",
        _anyOf_members0,
        _tcOf_members0,
        null);
      __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (nsdb.NucFeaturePackage.QualifierValue_uHelper.id (), "QualifierValue_u", _disTypeCode0, _members0);
    }
    return __typeCode;
  }

  public static String id ()
  {
    return _id;
  }

  public static nsdb.NucFeaturePackage.QualifierValue_u read (org.omg.CORBA.portable.InputStream istream)
  {
    nsdb.NucFeaturePackage.QualifierValue_u value = new nsdb.NucFeaturePackage.QualifierValue_u ();
    int _dis0 = (int)0;
    _dis0 = istream.read_long ();
    switch (_dis0)
    {
      case nsdb.NucFeature.boolean_qtc:
        boolean _applicable = false;
        _applicable = istream.read_boolean ();
        value.applicable (_applicable);
        break;
      case nsdb.NucFeature.string_qtc:
        String _text = null;
        _text = istream.read_string ();
        value.text (_text);
        break;
      case nsdb.NucFeature.integer_qtc:
        int _integer = (int)0;
        _integer = istream.read_long ();
        value.integer (_integer);
        break;
      case nsdb.NucFeature.real_qtc:
        float _real = (float)0;
        _real = istream.read_float ();
        value.real (_real);
        break;
      case nsdb.NucFeature.TranslationException_qtc:
        type.TranslationException _translation_exception = null;
        _translation_exception = type.TranslationExceptionHelper.read (istream);
        value.translation_exception (_translation_exception);
        break;
      case nsdb.NucFeature.CodonTranslation_qtc:
        type.CodonTranslation _codon_translation = null;
        _codon_translation = type.CodonTranslationHelper.read (istream);
        value.codon_translation (_codon_translation);
        break;
      case nsdb.NucFeature.Anticodon_qtc:
        type.AntiCodon _anti_codon = null;
        _anti_codon = type.AntiCodonHelper.read (istream);
        value.anti_codon (_anti_codon);
        break;
      case nsdb.NucFeature.SpliceConsensus_qtc:
        type.SpliceConsensus _splice_consensus = null;
        _splice_consensus = type.SpliceConsensusHelper.read (istream);
        value.splice_consensus (_splice_consensus);
        break;
      case nsdb.NucFeature.RepeatUnit_qtc:
        type.RepeatUnit _repeat_unit = null;
        _repeat_unit = type.RepeatUnitHelper.read (istream);
        value.repeat_unit (_repeat_unit);
        break;
      case nsdb.NucFeature.DbXref_qtc:
        type.DbXref _db_xref = null;
        _db_xref = type.DbXrefHelper.read (istream);
        value.db_xref (_db_xref);
        break;
      default:
        value._default( _dis0 ) ;
        break;
    }
    return value;
  }

  public static void write (org.omg.CORBA.portable.OutputStream ostream, nsdb.NucFeaturePackage.QualifierValue_u value)
  {
    ostream.write_long (value.discriminator ());
    switch (value.discriminator ())
    {
      case nsdb.NucFeature.boolean_qtc:
        ostream.write_boolean (value.applicable ());
        break;
      case nsdb.NucFeature.string_qtc:
        ostream.write_string (value.text ());
        break;
      case nsdb.NucFeature.integer_qtc:
        ostream.write_long (value.integer ());
        break;
      case nsdb.NucFeature.real_qtc:
        ostream.write_float (value.real ());
        break;
      case nsdb.NucFeature.TranslationException_qtc:
        type.TranslationExceptionHelper.write (ostream, value.translation_exception ());
        break;
      case nsdb.NucFeature.CodonTranslation_qtc:
        type.CodonTranslationHelper.write (ostream, value.codon_translation ());
        break;
      case nsdb.NucFeature.Anticodon_qtc:
        type.AntiCodonHelper.write (ostream, value.anti_codon ());
        break;
      case nsdb.NucFeature.SpliceConsensus_qtc:
        type.SpliceConsensusHelper.write (ostream, value.splice_consensus ());
        break;
      case nsdb.NucFeature.RepeatUnit_qtc:
        type.RepeatUnitHelper.write (ostream, value.repeat_unit ());
        break;
      case nsdb.NucFeature.DbXref_qtc:
        type.DbXrefHelper.write (ostream, value.db_xref ());
        break;
    }
  }

}
