summaryrefslogtreecommitdiff
path: root/org/omg/CORBA/DefinitionKind.java
blob: ac185bdacea9a6a8f84b9a4d3117b6c41096bf27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
/* DefinitionKind.java --
   Copyright (C) 2005 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */


package org.omg.CORBA;

import org.omg.CORBA.portable.IDLEntity;

import java.io.Serializable;

/**
 * This class indicates the kind of the definition, stored in the interface
 * repository.
 *
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
 */
public class DefinitionKind
  implements IDLEntity, Serializable
{
  /**
   * Use v1.4 serialVersionUID for interoperability.
   */
  private static final long serialVersionUID = -8601167576704143376L;

  /**
   * Indicates that the current definition defines has no definition kind.
   */
  public static final int _dk_none = 0;

  /**
   * This is a "wildcard '*'", used in cases where any definition kind
   * is appropriate .
   */
  public static final int _dk_all = 1;

  /**
   * Indicates that the current definition defines an attribute.
   */
  public static final int _dk_Attribute = 2;

  /**
   * Indicates that the current definition defines a constant.
   */
  public static final int _dk_Constant = 3;

  /**
   * Indicates that the current definition defines an exception.
   */
  public static final int _dk_Exception = 4;

  /**
   * Indicates that the current definition defines an interface.
   * The interface definition can contain constants, types,
   * exceptions, operations, and attributes.
   */
  public static final int _dk_Interface = 5;

  /**
   * Indicates that the current definition defines a Module.
   * The Module can contain constants, typedefs, exceptions and also
   * interface, component, home, value or event type definitions.
   * The module can also enclose other (nested) modules.
   */
  public static final int _dk_Module = 6;

  /**
   * Indicates that the current definition defines an operation, including
   * the lists of parameters and exceptions raised by this operation.
   */
  public static final int _dk_Operation = 7;

  /**
   * Indicates that the current definition defines a named type that is not
   * an interface nor a value definition. Generally, it also cannot be
   * a definition of component, home and event, but these three kinds are
   * not listed in this class.
   */
  public static final int _dk_Typedef = 8;

  /**
   * Indicates that the current definition defines an alias.
   */
  public static final int _dk_Alias = 9;

  /**
   * Indicates that the current definition defines a structure.
   */
  public static final int _dk_Struct = 10;

  /**
   * Indicates that the current definition defines a union.
   */
  public static final int _dk_Union = 11;

  /**
   * Indicates that the current definition defines an enumeration.
   */
  public static final int _dk_Enum = 12;

  /**
   * Indicates that the current definition defines a primitive type.
   */
  public static final int _dk_Primitive = 13;

  /**
   * Indicates that the current definition defines a string.
   */
  public static final int _dk_String = 14;

  /**
   * Indicates that the current definition defines a sequence.
   */
  public static final int _dk_Sequence = 15;

  /**
   * Indicates that the current definition defines an array.
   */
  public static final int _dk_Array = 16;

  /**
   * Indicates that the current definition defines an another interface
   * repository.
   */
  public static final int _dk_Repository = 17;

  /**
   * Indicates that the current definition defines a wide (usually 16-bit
   * per character) string.
   */
  public static final int _dk_Wstring = 18;

  /**
   * Indicates that the current definition defines a CORBA <code>fixed</code>.
   */
  public static final int _dk_Fixed = 19;

  /**
   * Indicates that the current definition defines a value.
   */
  public static final int _dk_Value = 20;

  /**
   * Indicates that the current definition defines a value box.
   */
  public static final int _dk_ValueBox = 21;

  /**
   * Indicates that the current definition defines value member.
   */
  public static final int _dk_ValueMember = 22;

  /**
   * Indicates that the current definition defines a Native.
   */
  public static final int _dk_Native = 23;

  /**
   * Indicates that the current definition defines an abstract interface.
   */
  public static final int _dk_AbstractInterface = 24;

  /**
   * Indicates that the current definition defines has no definition kind.
   */
  public static final DefinitionKind dk_none = new DefinitionKind(_dk_none);

  /**
   * This is a "wildcard '*'", used in cases where any definition kind
   * is appropriate .
   */
  public static final DefinitionKind dk_all = new DefinitionKind(_dk_all);

  /**
   * Indicates that the current definition defines an attribute.
   */
  public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute);

  /**
   * Indicates that the current definition defines a constant.
   */
  public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant);

  /**
   * Indicates that the current definition defines an exception.
   */
  public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception);

  /**
   * Indicates that the current definition defines an interface.
   * The interface definition can contain constants, types,
   * exceptions, operations, and attributes.
   */
  public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface);

  /**
   * Indicates that the current definition defines a Module.
   * The Module can contain constants, typedefs, exceptions and also
   * interface, component, home, value or event type definitions.
   * The module can also enclose other (nested) modules.
   */
  public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module);

  /**
   * Indicates that the current definition defines an operation, including
   * the lists of parameters and exceptions raised by this operation.
   */
  public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation);

  /**
   * Indicates that the current definition defines a named type that is not
   * an interface nor a value definition. Generally, it also cannot be
   * a definition of component, home and event, but these three kinds are
   * not listed in this class.
   */
  public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef);

  /**
   * Indicates that the current definition defines an alias.
   */
  public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias);

  /**
   * Indicates that the current definition defines a structure.
   */
  public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct);

  /**
   * Indicates that the current definition defines a union.
   */
  public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union);

  /**
   * Indicates that the current definition defines an enumeration.
   */
  public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum);

  /**
   * Indicates that the current definition defines a primitive type.
   */
  public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive);

  /**
   * Indicates that the current definition defines a string.
   */
  public static final DefinitionKind dk_String = new DefinitionKind(_dk_String);

  /**
   * Indicates that the current definition defines a sequence.
   */
  public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence);

  /**
   * Indicates that the current definition defines an array.
   */
  public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array);

  /**
   * Indicates that the current definition defines an another interface
   * repository.
   */
  public static final DefinitionKind dk_Repository =
    new DefinitionKind(_dk_Repository);

  /**
   * Indicates that the current definition defines a wide (usually 16-bit
   * per character) string.
   */
  public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring);

  /**
   * Indicates that the current definition defines a CORBA <code>fixed</code>.
   */
  public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed);

  /**
   * Indicates that the current definition defines a value.
   */
  public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value);

  /**
   * Indicates that the current definition defines a value box.
   */
  public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox);

  /**
   * Indicates that the current definition defines value member.
   */
  public static final DefinitionKind dk_ValueMember =
    new DefinitionKind(_dk_ValueMember);

  /**
   * Indicates that the current definition defines a Native.
   */
  public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native);

  /**
   * Indicates that the current definition defines .
   */
  public static final DefinitionKind dk_AbstractInterface =
    new DefinitionKind(_dk_AbstractInterface);

  /**
   * The defintion code of the current instance of the definition kind.
   */
  private final int kind;

  /**
   * The table of the definition kinds
   */
  private static DefinitionKind[] table;

  /**
   * Creates a definition kind with the given integer definition kind code.
   *
   * @param a_kind a definition kind code, one of the _dk_.. constants,
   * defined in this class.
   */
  protected DefinitionKind(int a_kind)
  {
    kind = a_kind;
  }

  /**
   * Get the definition code of the current instance of the definition kind.
   *
   * @return one of the _dk_... constants, defined in this class.
   */
  public int value()
  {
    return kind;
  }

  /**
   * Get the definition kind, corresponding the given integer code.
   *
   * @param a_kind the definition kind code, one of the _dk_... constants,
   * defined in this class.
   *
   * @return the corresponding definition kind, one of the dk_... constants,
   * defined in this class.
   *
   * @throws BAD_PARAM if the given integer does not match any definition
   * kind.
   */
  public static DefinitionKind from_int(int a_kind)
  {
    if (table == null)
      fill_table();
    try
      {
        return table [ a_kind ];
      }
    catch (ArrayIndexOutOfBoundsException ex)
      {
        throw new BAD_PARAM("No def. kind " + a_kind);
      }
  }

  /**
   * Fill the conversion table on demand.
   */
  private static void fill_table()
  {
    table = new DefinitionKind[ 25 ];
    table [ _dk_none ] = dk_none;
    table [ _dk_all ] = dk_all;
    table [ _dk_Attribute ] = dk_Attribute;
    table [ _dk_Constant ] = dk_Constant;
    table [ _dk_Exception ] = dk_Exception;
    table [ _dk_Interface ] = dk_Interface;
    table [ _dk_Module ] = dk_Module;
    table [ _dk_Operation ] = dk_Operation;
    table [ _dk_Typedef ] = dk_Typedef;
    table [ _dk_Alias ] = dk_Alias;
    table [ _dk_Struct ] = dk_Struct;
    table [ _dk_Union ] = dk_Union;
    table [ _dk_Enum ] = dk_Enum;
    table [ _dk_Primitive ] = dk_Primitive;
    table [ _dk_String ] = dk_String;
    table [ _dk_Sequence ] = dk_Sequence;
    table [ _dk_Array ] = dk_Array;
    table [ _dk_Repository ] = dk_Repository;
    table [ _dk_Wstring ] = dk_Wstring;
    table [ _dk_Fixed ] = dk_Fixed;
    table [ _dk_Value ] = dk_Value;
    table [ _dk_ValueBox ] = dk_ValueBox;
    table [ _dk_ValueMember ] = dk_ValueMember;
    table [ _dk_Native ] = dk_Native;
    table [ _dk_AbstractInterface ] = dk_AbstractInterface;
  }
}