KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CORBA > CompletionStatus


1 /*
2  * @(#)CompletionStatus.java 1.22 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package org.omg.CORBA;
8
9 /**
10  * An object that indicates whether a method had completed running
11  * when a <code>SystemException</code> was thrown.
12  * <P>
13  * The class <code>CompletionStatus</code>
14  * contains three <code>CompletionStatus</code> instances, which are constants
15  * representing each
16  * possible completion status: <code>COMPLETED_MAYBE</code>,
17  * <code>COMPLETED_NO</code>, and <code>COMPLETED_YES</code>.
18  * It also contains
19  * three <code>int</code> members, each a constant corresponding to one of
20  * the <code>CompletionStatus</code> instances. These <code>int</code>
21  * members make it possible to use a <code>switch</code> statement.
22  * <P>
23  * The class also contains two methods:
24  * <UL>
25  * <LI><code>public int <bold>value</bold>()</code> -- which accesses the
26  * <code>value</code> field of a <code>CompletionStatus</code> object
27  * <LI><code>public static CompletionStatus
28  * <bold>from_int</bold>(int i)</code> --
29  * for creating an instance from one of the <code>int</code> members
30  * </UL>
31  * @version %I, %G
32  * @see org.omg.CORBA.SystemException
33  * @since JDK1.2
34  */

35
36 public final class CompletionStatus implements org.omg.CORBA.portable.IDLEntity JavaDoc
37 {
38 /**
39  * The constant indicating that a method completed running
40  * before a <code>SystemException</code> was thrown.
41  */

42     public static final int _COMPLETED_YES = 0,
43
44 /**
45  * The constant indicating that a method had not completed running
46  * when a <code>SystemException</code> was thrown.
47  */

48     _COMPLETED_NO = 1,
49
50 /**
51  * The constant indicating that it is unknown whether a method had
52  * completed running when a <code>SystemException</code> was thrown.
53  */

54     _COMPLETED_MAYBE = 2;
55
56
57 /**
58  * An instance of <code>CompletionStatus</code> initialized with
59  * the constant <code>_COMPLETED_YES</code>.
60  */

61     public static final CompletionStatus JavaDoc COMPLETED_YES = new CompletionStatus JavaDoc(_COMPLETED_YES);
62
63 /**
64  * An instance of <code>CompletionStatus</code> initialized with
65  * the constant <code>_COMPLETED_NO</code>.
66  */

67     public static final CompletionStatus JavaDoc COMPLETED_NO = new CompletionStatus JavaDoc(_COMPLETED_NO);
68
69     /**
70  * An instance of <code>CompletionStatus</code> initialized with
71  * the constant <code>_COMPLETED_MAYBE</code>.
72  */

73     public static final CompletionStatus JavaDoc COMPLETED_MAYBE = new CompletionStatus JavaDoc(_COMPLETED_MAYBE);
74
75     /**
76  * Retrieves the value of this <code>CompletionStatus</code> object.
77  *
78  * @return one of the possible <code>CompletionStatus</code> values:
79  * <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
80  * <code>_COMPLETED_MAYBE</code>
81  *
82  */

83     public int value() { return _value; }
84
85 /**
86  * Creates a <code>CompletionStatus</code> object from the given <code>int</code>.
87  *
88  * @param i one of <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
89  * <code>_COMPLETED_MAYBE</code>
90  *
91  * @return one of the possible <code>CompletionStatus</code> objects
92  * with values:
93  * <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
94  * <code>_COMPLETED_MAYBE</code>
95  *
96  * @exception org.omg.CORBA.BAD_PARAM if the argument given is not one of the
97  * <code>int</code> constants defined in <code>CompletionStatus</code>
98  */

99     public static CompletionStatus JavaDoc from_int(int i) {
100     switch (i) {
101     case _COMPLETED_YES:
102         return COMPLETED_YES;
103     case _COMPLETED_NO:
104         return COMPLETED_NO;
105     case _COMPLETED_MAYBE:
106         return COMPLETED_MAYBE;
107     default:
108         throw new org.omg.CORBA.BAD_PARAM JavaDoc();
109     }
110     }
111
112
113 /**
114  * Creates a <code>CompletionStatus</code> object from the given <code>int</code>.
115  *
116  * @param _value one of <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
117  * <code>_COMPLETED_MAYBE</code>
118  *
119  */

120     private CompletionStatus(int _value) {
121     this._value = _value;
122     }
123
124     private int _value;
125 }
126
Popular Tags