KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ir3 > FixedDef_impl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle.
23 Contributor(s): Mathieu Vadet, Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ir3;
28
29 // Package dependencies
30
import org.omg.CORBA.*;
31
32 /**
33  * Implementation of the CORBA::FixedDef interface.
34  *
35  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
36  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
37  *
38  * @version 0.3
39  */

40
41 public class FixedDef_impl
42        extends AnonymousIDLType
43        implements FixedDefOperations
44 {
45     // ==================================================================
46
//
47
// Constructor.
48
//
49
// ==================================================================
50

51     /**
52      * TODO
53      */

54     public
55     FixedDef_impl(IFR ifr)
56     {
57         // call the AnonymousIDLType contructor.
58
super(ifr);
59
60         // set the TIE servant object.
61
setServant(new FixedDefPOATie(this));
62
63         // sets the digits and scale to zero.
64
digits_ = (short)0;
65         scale_ = (short)0;
66     }
67
68     // ==================================================================
69
//
70
// Internal state.
71
//
72
// ==================================================================
73

74     /** The fixed digits. */
75     protected short digits_;
76
77     /** The fixed scale. */
78     protected short scale_;
79
80     // ==================================================================
81
//
82
// Internal methods inherited from IROject_impl.
83
//
84
// ==================================================================
85

86     /**
87      * Warning : this operation must be implemented by subclasses.
88      * It allows us to avoid some casts while creating ::CORBA::TypeCode
89      */

90     protected TypeCode
91     recursiveType(java.util.List JavaDoc idSeq)
92     {
93         return type();
94     }
95
96     // ==================================================================
97
//
98
// Public methods.
99
//
100
// ==================================================================
101

102     /**
103      * Obtain its CORBA::FixedDef object reference.
104      */

105     public FixedDef
106     asFixedDef()
107     {
108         return FixedDefHelper.narrow(asObject());
109     }
110
111     // ==================================================================
112
//
113
// For CORBA::IRObject interface.
114
//
115
// ==================================================================
116

117     /**
118      * IDL:omg.org/CORBA/IRObject/def_kind:1.0
119      */

120     public DefinitionKind
121     def_kind()
122     {
123         return DefinitionKind.dk_Fixed;
124     }
125
126     // ==================================================================
127
//
128
// For CORBA::IDLType interface.
129
//
130
// ==================================================================
131

132     /**
133      * IDL:omg.org/CORBA/IDLType/type:1.0
134      */

135     public TypeCode
136     type()
137     {
138         // delegates to the TypeCodeFactory.
139
return getIFR().getTCF().create_fixed_tc(digits(), scale());
140     }
141
142     // ==================================================================
143
//
144
// For CORBA::FixedDef interface.
145
//
146
// ==================================================================
147

148     /**
149      * IDL:omg.org/CORBA/FixedDef/digits:1.0
150      */

151     public short
152     digits()
153     {
154         return digits_;
155     }
156
157     /**
158      * IDL:omg.org/CORBA/FixedDef/digits:1.0
159      */

160     public void
161     digits(short d)
162     {
163         // must be set to a value between 1 and 31.
164
if(d < 1 || d > 31)
165             throw exceptionBadParam("digits must be between 1 and 31");
166
167         digits_ = d;
168     }
169
170     /**
171      * IDL:omg.org/CORBA/FixedDef/scale:1.0
172      */

173     public short
174     scale()
175     {
176         return scale_;
177     }
178
179     /**
180      * IDL:omg.org/CORBA/FixedDef/scale:1.0
181      */

182     public void
183     scale(short s)
184     {
185         scale_ = s;
186     }
187 }
188
Popular Tags