< prev index next >

src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java

Print this page




  36  * <p>
  37  * Controls that provide a choice between only two settings can often be
  38  * implemented instead as a {@link BooleanControl}, and controls that provide a
  39  * set of values along some quantifiable dimension might be implemented instead
  40  * as a {@code FloatControl} with a coarse resolution. However, a key feature of
  41  * {@code EnumControl} is that the returned values are arbitrary objects, rather
  42  * than numerical or boolean values. This means that each returned object can
  43  * provide further information. As an example, the settings of a
  44  * {@link EnumControl.Type#REVERB REVERB} control are instances of
  45  * {@link ReverbType} that can be queried for the parameter values used for each
  46  * setting.
  47  *
  48  * @author Kara Kytle
  49  * @since 1.3
  50  */
  51 public abstract class EnumControl extends Control {
  52 
  53     /**
  54      * The set of possible values.
  55      */
  56     private Object[] values;
  57 
  58     /**
  59      * The current value.
  60      */
  61     private Object value;
  62 
  63     /**
  64      * Constructs a new enumerated control object with the given parameters.
  65      *
  66      * @param  type the type of control represented this enumerated control
  67      *         object
  68      * @param  values the set of possible values for the control
  69      * @param  value the initial control value
  70      */
  71     protected EnumControl(Type type, Object[] values, Object value) {
  72         super(type);
  73         this.values = values;
  74         this.value = value;
  75     }
  76 




  36  * <p>
  37  * Controls that provide a choice between only two settings can often be
  38  * implemented instead as a {@link BooleanControl}, and controls that provide a
  39  * set of values along some quantifiable dimension might be implemented instead
  40  * as a {@code FloatControl} with a coarse resolution. However, a key feature of
  41  * {@code EnumControl} is that the returned values are arbitrary objects, rather
  42  * than numerical or boolean values. This means that each returned object can
  43  * provide further information. As an example, the settings of a
  44  * {@link EnumControl.Type#REVERB REVERB} control are instances of
  45  * {@link ReverbType} that can be queried for the parameter values used for each
  46  * setting.
  47  *
  48  * @author Kara Kytle
  49  * @since 1.3
  50  */
  51 public abstract class EnumControl extends Control {
  52 
  53     /**
  54      * The set of possible values.
  55      */
  56     private final Object[] values;
  57 
  58     /**
  59      * The current value.
  60      */
  61     private Object value;
  62 
  63     /**
  64      * Constructs a new enumerated control object with the given parameters.
  65      *
  66      * @param  type the type of control represented this enumerated control
  67      *         object
  68      * @param  values the set of possible values for the control
  69      * @param  value the initial control value
  70      */
  71     protected EnumControl(Type type, Object[] values, Object value) {
  72         super(type);
  73         this.values = values;
  74         this.value = value;
  75     }
  76 


< prev index next >