// javastubs/Test1/U2.java
// Stubs for "Test1"
//
// This file was automatically generated with ILU (version 2.0beta1) tools
// at Tue Sep 21 11:45:19 1999 by `nobody'
// running "c:/iluwin/bin/java-stubber.exe" of Tue Sep 21 10:50:42 1999
// on "C:/iluwin/examples/test1/Test1.isl" of Mon Sep 20 15:53:47 1999,
// and "c:/iluwin/interfaces/ilu.isl" of Mon Sep 20 15:51:47 1999.
//
// ILU is Copyright 1991-1999 Xerox Corporation, All Rights Reserved.
// ILU information:  ftp://ftp.parc.xerox.com/pub/ilu/ilu.html.



package Test1;


/** 
 * Class representing an ILU union type.
 */
public class U2 implements java.io.Serializable {
    boolean _init = false;
    short _dis = 0;
    java.lang.Object _val = null;

    static void _throw()
            throws org.omg.CORBA.BAD_OPERATION {
        throw new org.omg.CORBA.BAD_OPERATION();
    } //_throw

    public U2() {
        _init = false;
        _val = null;
    } //constructor

    public short discriminator()
                throws org.omg.CORBA.BAD_OPERATION {
        if (!_init) {
            _throw();
        }
        return _dis;
    } //discriminator

    public static U2 alloc_x1(short _dis, boolean _v)
            throws org.omg.CORBA.BAD_OPERATION {
        U2 _res = new U2();
        _res.set_x1(_dis, _v);
        return _res;
    } //alloc_x1

    public static U2 alloc_x1(boolean _v)
            throws org.omg.CORBA.BAD_OPERATION {
        return alloc_x1((short)3, _v);
    } //alloc_x1

    public boolean get_x1()
            throws org.omg.CORBA.BAD_OPERATION {
        if (!_init) {_throw();}
        switch(_dis) {
            case (short)3:
            case (short)7:
                break;
            default: 
                _throw();
        }
        return (boolean) ((java.lang.Boolean)_val).booleanValue();
    } //get_x1

    public void set_x1(short _d, boolean _v)
            throws org.omg.CORBA.BAD_OPERATION {
        switch (_d) {
            case (short)3:
            case (short)7:
                break;
            default: _throw();
        }
        _dis = _d;
        _val = new java.lang.Boolean(_v);
        _init = true;
    } //set_x1

    public void set_x1(boolean _v) {
        set_x1((short)3, _v);
    } //set_x1

    public static U2 alloc_x2(short _dis, O2 _v)
            throws org.omg.CORBA.BAD_OPERATION {
        U2 _res = new U2();
        _res.set_x2(_dis, _v);
        return _res;
    } //alloc_x2

    public static U2 alloc_x2(O2 _v)
            throws org.omg.CORBA.BAD_OPERATION {
        return alloc_x2((short)1, _v);
    } //alloc_x2

    public O2 get_x2()
            throws org.omg.CORBA.BAD_OPERATION {
        if (!_init) {_throw();}
        switch(_dis) {
            case (short)1:
            case (short)22:
                break;
            default: 
                _throw();
        }
        return (O2) ((O2)_val);
    } //get_x2

    public void set_x2(short _d, O2 _v)
            throws org.omg.CORBA.BAD_OPERATION {
        switch (_d) {
            case (short)1:
            case (short)22:
                break;
            default: _throw();
        }
        _dis = _d;
        _val = _v;
        _init = true;
    } //set_x2

    public void set_x2(O2 _v) {
        set_x2((short)1, _v);
    } //set_x2

    public static U2 alloc_x3(short _dis, java.lang.String[] _v)
            throws org.omg.CORBA.BAD_OPERATION {
        U2 _res = new U2();
        _res.set_x3(_dis, _v);
        return _res;
    } //alloc_x3

    public static U2 alloc_x3(java.lang.String[] _v)
            throws org.omg.CORBA.BAD_OPERATION {
        return alloc_x3((short)2, _v);
    } //alloc_x3

    public java.lang.String[] get_x3()
            throws org.omg.CORBA.BAD_OPERATION {
        if (!_init) {_throw();}
        switch(_dis) {
            case (short)2:
                break;
            default: 
                _throw();
        }
        return (java.lang.String[]) ((java.lang.String[])_val);
    } //get_x3

    public void set_x3(short _d, java.lang.String[] _v)
            throws org.omg.CORBA.BAD_OPERATION {
        switch (_d) {
            case (short)2:
                break;
            default: _throw();
        }
        _dis = _d;
        _val = _v;
        _init = true;
    } //set_x3

    public void set_x3(java.lang.String[] _v) {
        set_x3((short)2, _v);
    } //set_x3

    public void setOther(short _d)
            throws org.omg.CORBA.BAD_OPERATION {
        switch (_d) {
            case (short)3:
            case (short)7:
            case (short)1:
            case (short)22:
            case (short)2:
                _throw();
            default:
                break;
        }
        _dis = _d;
        _val = null;
        _init = true;
    } //setOther

    public static U2 allocOther(short _dis)
            throws org.omg.CORBA.BAD_OPERATION {
        U2 _res = new U2();
        _res.setOther(_dis);
        return _res;
    } //allocOther

} //U2
