1 /*
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
90 }
91
92 this.value = value;
93 }
94
95 /**
96 * Obtains this control's current value.
97 *
98 * @return the current value
99 */
100 public Object getValue() {
101 return value;
102 }
103
104 /**
105 * Returns the set of possible values for this control.
106 *
107 * @return the set of possible values
108 */
109 public Object[] getValues() {
110
111 Object[] localArray = new Object[values.length];
112
113 for (int i = 0; i < values.length; i++) {
114 localArray[i] = values[i];
115 }
116
117 return localArray;
118 }
119
120 /**
121 * Indicates whether the value specified is supported.
122 *
123 * @param value the value for which support is queried
124 * @return {@code true} if the value is supported, otherwise {@code false}
125 */
126 private boolean isValueSupported(Object value) {
127
128 for (int i = 0; i < values.length; i++) {
129 //$$fb 2001-07-20: Fix for bug 4400392: setValue() in ReverbControl always throws Exception
130 //if (values.equals(values[i])) {
131 if (value.equals(values[i])) {
132 return true;
133 }
134 }
135
136 return false;
137 }
|
1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
90 }
91
92 this.value = value;
93 }
94
95 /**
96 * Obtains this control's current value.
97 *
98 * @return the current value
99 */
100 public Object getValue() {
101 return value;
102 }
103
104 /**
105 * Returns the set of possible values for this control.
106 *
107 * @return the set of possible values
108 */
109 public Object[] getValues() {
110 return values.clone();
111 }
112
113 /**
114 * Indicates whether the value specified is supported.
115 *
116 * @param value the value for which support is queried
117 * @return {@code true} if the value is supported, otherwise {@code false}
118 */
119 private boolean isValueSupported(Object value) {
120
121 for (int i = 0; i < values.length; i++) {
122 //$$fb 2001-07-20: Fix for bug 4400392: setValue() in ReverbControl always throws Exception
123 //if (values.equals(values[i])) {
124 if (value.equals(values[i])) {
125 return true;
126 }
127 }
128
129 return false;
130 }
|