KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > AttributeValue


1 /*
2  * @(#)AttributeValue.java 1.8 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
8 package java.awt;
9
10 import sun.awt.DebugHelper;
11
12 abstract class AttributeValue {
13     private final int value;
14     private final String JavaDoc[] names;
15
16     private static final DebugHelper dbg =
17         DebugHelper.create(AttributeValue JavaDoc.class);
18
19     protected AttributeValue(int value, String JavaDoc[] names) {
20         if (dbg.on) {
21         dbg.assertion(value >= 0 && names != null && value < names.length);
22     }
23         this.value = value;
24     this.names = names;
25     }
26     // This hashCode is used by the sun.awt implementation as an array
27
// index.
28
public int hashCode() {
29         return value;
30     }
31     public String JavaDoc toString() {
32         return names[value];
33     }
34 }
35
Popular Tags