duke@1: /*
ohair@158: * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1: *
duke@1: * This code is free software; you can redistribute it and/or modify it
duke@1: * under the terms of the GNU General Public License version 2 only, as
ohair@158: * published by the Free Software Foundation. Oracle designates this
duke@1: * particular file as subject to the "Classpath" exception as provided
ohair@158: * by Oracle in the LICENSE file that accompanied this code.
duke@1: *
duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1: * version 2 for more details (a copy is included in the LICENSE file that
duke@1: * accompanied this code).
duke@1: *
duke@1: * You should have received a copy of the GNU General Public License version
duke@1: * 2 along with this work; if not, write to the Free Software Foundation,
duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1: *
ohair@158: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158: * or visit www.oracle.com if you need additional information or have any
ohair@158: * questions.
duke@1: */
duke@1: package org.omg.CORBA;
duke@1:
duke@1: /**
duke@1: * An object that indicates whether a method had completed running
duke@1: * when a SystemException
was thrown.
duke@1: *
duke@1: * The class CompletionStatus
duke@1: * contains three CompletionStatus
instances, which are constants
duke@1: * representing each
duke@1: * possible completion status: COMPLETED_MAYBE
,
duke@1: * COMPLETED_NO
, and COMPLETED_YES
.
duke@1: * It also contains
duke@1: * three int
members, each a constant corresponding to one of
duke@1: * the CompletionStatus
instances. These int
duke@1: * members make it possible to use a switch
statement.
duke@1: *
duke@1: * The class also contains two methods: duke@1: *
public int value ()
-- which accesses the
duke@1: * value
field of a CompletionStatus
object
duke@1: * public static CompletionStatus
duke@1: * from_int (int i)
--
duke@1: * for creating an instance from one of the int
members
duke@1: * SystemException
was thrown.
duke@1: */
duke@1: public static final int _COMPLETED_YES = 0,
duke@1:
duke@1: /**
duke@1: * The constant indicating that a method had not completed running
duke@1: * when a SystemException
was thrown.
duke@1: */
duke@1: _COMPLETED_NO = 1,
duke@1:
duke@1: /**
duke@1: * The constant indicating that it is unknown whether a method had
duke@1: * completed running when a SystemException
was thrown.
duke@1: */
duke@1: _COMPLETED_MAYBE = 2;
duke@1:
duke@1:
duke@1: /**
duke@1: * An instance of CompletionStatus
initialized with
duke@1: * the constant _COMPLETED_YES
.
duke@1: */
duke@1: public static final CompletionStatus COMPLETED_YES = new CompletionStatus(_COMPLETED_YES);
duke@1:
duke@1: /**
duke@1: * An instance of CompletionStatus
initialized with
duke@1: * the constant _COMPLETED_NO
.
duke@1: */
duke@1: public static final CompletionStatus COMPLETED_NO = new CompletionStatus(_COMPLETED_NO);
duke@1:
duke@1: /**
duke@1: * An instance of CompletionStatus
initialized with
duke@1: * the constant _COMPLETED_MAYBE
.
duke@1: */
duke@1: public static final CompletionStatus COMPLETED_MAYBE = new CompletionStatus(_COMPLETED_MAYBE);
duke@1:
duke@1: /**
duke@1: * Retrieves the value of this CompletionStatus
object.
duke@1: *
duke@1: * @return one of the possible CompletionStatus
values:
duke@1: * _COMPLETED_YES
, _COMPLETED_NO
, or
duke@1: * _COMPLETED_MAYBE
duke@1: *
duke@1: */
duke@1: public int value() { return _value; }
duke@1:
duke@1: /**
duke@1: * Creates a CompletionStatus
object from the given int
.
duke@1: *
duke@1: * @param i one of _COMPLETED_YES
, _COMPLETED_NO
, or
duke@1: * _COMPLETED_MAYBE
duke@1: *
duke@1: * @return one of the possible CompletionStatus
objects
duke@1: * with values:
duke@1: * _COMPLETED_YES
, _COMPLETED_NO
, or
duke@1: * _COMPLETED_MAYBE
duke@1: *
duke@1: * @exception org.omg.CORBA.BAD_PARAM if the argument given is not one of the
duke@1: * int
constants defined in CompletionStatus
duke@1: */
duke@1: public static CompletionStatus from_int(int i) {
duke@1: switch (i) {
duke@1: case _COMPLETED_YES:
duke@1: return COMPLETED_YES;
duke@1: case _COMPLETED_NO:
duke@1: return COMPLETED_NO;
duke@1: case _COMPLETED_MAYBE:
duke@1: return COMPLETED_MAYBE;
duke@1: default:
duke@1: throw new org.omg.CORBA.BAD_PARAM();
duke@1: }
duke@1: }
duke@1:
duke@1:
duke@1: /**
duke@1: * Creates a CompletionStatus
object from the given int
.
duke@1: *
duke@1: * @param _value one of _COMPLETED_YES
, _COMPLETED_NO
, or
duke@1: * _COMPLETED_MAYBE
duke@1: *
duke@1: */
duke@1: private CompletionStatus(int _value) {
duke@1: this._value = _value;
duke@1: }
duke@1:
duke@1: private int _value;
duke@1: }