85 }
86 return false;
87 }
88 }
89
90 /**
91 * Defines the type of all "enumerative" values used to control
92 * various aspects of the rendering and imaging pipelines. Instances
93 * of this class are immutable and unique which means that
94 * tests for matches can be made using the == operator instead
95 * of the more expensive equals() method.
96 */
97 public static class Value {
98 private SunHints.Key myKey;
99 private int index;
100 private String description;
101
102 private static Value[][] ValueObjects =
103 new Value[NUM_KEYS][VALS_PER_KEY];
104
105 private synchronized static void register(SunHints.Key key,
106 Value value) {
107 int kindex = key.getIndex();
108 int vindex = value.getIndex();
109 if (ValueObjects[kindex][vindex] != null) {
110 throw new InternalError("duplicate index: "+vindex);
111 }
112 ValueObjects[kindex][vindex] = value;
113 }
114
115 public static Value get(int keyindex, int valueindex) {
116 return ValueObjects[keyindex][valueindex];
117 }
118
119 /**
120 * Construct a value using the indicated private index. Each
121 * subclass of Value maintains its own unique domain of integer
122 * indices. Enforcing the uniqueness of the integer indices
123 * is left to the subclass.
124 */
125 public Value(SunHints.Key key, int index, String description) {
|
85 }
86 return false;
87 }
88 }
89
90 /**
91 * Defines the type of all "enumerative" values used to control
92 * various aspects of the rendering and imaging pipelines. Instances
93 * of this class are immutable and unique which means that
94 * tests for matches can be made using the == operator instead
95 * of the more expensive equals() method.
96 */
97 public static class Value {
98 private SunHints.Key myKey;
99 private int index;
100 private String description;
101
102 private static Value[][] ValueObjects =
103 new Value[NUM_KEYS][VALS_PER_KEY];
104
105 private static synchronized void register(SunHints.Key key,
106 Value value) {
107 int kindex = key.getIndex();
108 int vindex = value.getIndex();
109 if (ValueObjects[kindex][vindex] != null) {
110 throw new InternalError("duplicate index: "+vindex);
111 }
112 ValueObjects[kindex][vindex] = value;
113 }
114
115 public static Value get(int keyindex, int valueindex) {
116 return ValueObjects[keyindex][valueindex];
117 }
118
119 /**
120 * Construct a value using the indicated private index. Each
121 * subclass of Value maintains its own unique domain of integer
122 * indices. Enforcing the uniqueness of the integer indices
123 * is left to the subclass.
124 */
125 public Value(SunHints.Key key, int index, String description) {
|