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
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 }
131
132 /**
133 * Provides a string representation of the control.
134 *
135 * @return a string description
136 */
137 @Override
138 public String toString() {
139 return new String(getType() + " with current value: " + getValue());
140 }
141
142 /**
143 * An instance of the {@code EnumControl.Type} inner class identifies one
144 * kind of enumerated control. Static instances are provided for the common
145 * types.
146 *
147 * @author Kara Kytle
148 * @see EnumControl
149 * @since 1.3
150 */
151 public static class Type extends Control.Type {
152
153 /**
154 * Represents a control over a set of possible reverberation settings.
155 * Each reverberation setting is described by an instance of the
156 * {@link ReverbType} class. (To access these settings, invoke
157 * {@link EnumControl#getValues} on an enumerated control of type
158 * {@code REVERB}.)
159 */
|
1 /*
2 * Copyright (c) 1999, 2020, 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
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 }
131
132 /**
133 * Returns a string representation of the enumerated control.
134 *
135 * @return a string representation of the enumerated control
136 */
137 @Override
138 public String toString() {
139 return String.format("%s with current value: %s", super.toString(),
140 getValue());
141 }
142
143 /**
144 * An instance of the {@code EnumControl.Type} inner class identifies one
145 * kind of enumerated control. Static instances are provided for the common
146 * types.
147 *
148 * @author Kara Kytle
149 * @see EnumControl
150 * @since 1.3
151 */
152 public static class Type extends Control.Type {
153
154 /**
155 * Represents a control over a set of possible reverberation settings.
156 * Each reverberation setting is described by an instance of the
157 * {@link ReverbType} class. (To access these settings, invoke
158 * {@link EnumControl#getValues} on an enumerated control of type
159 * {@code REVERB}.)
160 */
|