KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > common > util > AbstractEnumerator


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: AbstractEnumerator.java,v 1.2 2005/06/08 06:19:08 nickb Exp $
16  */

17 package org.eclipse.emf.common.util;
18
19
20 /**
21  * An extensible enumerator implementation.
22  */

23 public abstract class AbstractEnumerator implements Enumerator
24 {
25   /**
26    * The name of the enumerator.
27    */

28   private final String JavaDoc name;
29
30   /**
31    * The <code>int</code> value of the enumerator.
32    */

33   private final int value;
34
35   /**
36    * Creates an initialized instance.
37    * @param value the <code>int</code> value of the enumerator.
38    * @param name the name of the enumerator.
39    */

40   protected AbstractEnumerator(int value, String JavaDoc name)
41   {
42     this.name = name;
43     this.value = value;
44   }
45
46   /**
47    * Returns the name of the enumerator.
48    * @return the name.
49    */

50   public final String JavaDoc getName()
51   {
52     return name;
53   }
54
55   /**
56    * Returns the <code>int</code> value of the enumerator.
57    * @return the value.
58    */

59   public final int getValue()
60   {
61     return value;
62   }
63
64   /**
65    * Returns the name of the enumerator.
66    * @return the name.
67    */

68   public final String JavaDoc toString()
69   {
70     return name;
71   }
72 }
73
Popular Tags