Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java
38918 views
/*1* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.sampled;2627/**28* A <code>CompoundControl</code>, such as a graphic equalizer, provides control29* over two or more related properties, each of which is itself represented as30* a <code>Control</code>.31*32* @author Kara Kytle33* @since 1.334*/35public abstract class CompoundControl extends Control {363738// TYPE DEFINES394041// INSTANCE VARIABLES424344/**45* The set of member controls.46*/47private Control[] controls;48495051// CONSTRUCTORS525354/**55* Constructs a new compound control object with the given parameters.56*57* @param type the type of control represented this compound control object58* @param memberControls the set of member controls59*/60protected CompoundControl(Type type, Control[] memberControls) {6162super(type);63this.controls = memberControls;64}65666768// METHODS697071/**72* Returns the set of member controls that comprise the compound control.73* @return the set of member controls.74*/75public Control[] getMemberControls() {7677Control[] localArray = new Control[controls.length];7879for (int i = 0; i < controls.length; i++) {80localArray[i] = controls[i];81}8283return localArray;84}858687// ABSTRACT METHOD IMPLEMENTATIONS: CONTROL888990/**91* Provides a string representation of the control92* @return a string description93*/94public String toString() {9596StringBuffer buf = new StringBuffer();97for (int i = 0; i < controls.length; i++) {98if (i != 0) {99buf.append(", ");100if ((i + 1) == controls.length) {101buf.append("and ");102}103}104buf.append(controls[i].getType());105}106107return new String(getType() + " Control containing " + buf + " Controls.");108}109110111// INNER CLASSES112113114/**115* An instance of the <code>CompoundControl.Type</code> inner class identifies one kind of116* compound control. Static instances are provided for the117* common types.118*119* @author Kara Kytle120* @since 1.3121*/122public static class Type extends Control.Type {123124125// TYPE DEFINES126127// CONSTRUCTOR128129130/**131* Constructs a new compound control type.132* @param name the name of the new compound control type133*/134protected Type(String name) {135super(name);136}137} // class Type138139} // class CompoundControl140141142