java类javax.sound.sampled.EnumControl的实例源码

EnumControlTest.java 文件源码 项目:cn1 阅读 22 收藏 0 点赞 0 评论 0
public void testEnumControl() {
    Object[] values = new Object[] { "val1", "val2" };
    EnumControl control = new MyControl(EnumControl.Type.REVERB, values,
            "val1");

    assertEquals("val1", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val1", control.toString());

    control.setValue("val2");
    assertEquals("val2", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val2", control.toString());

    try {
        control.setValue("val3");
        fail("No expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {            
    }
}
EnumControlTest.java 文件源码 项目:freeVM 阅读 28 收藏 0 点赞 0 评论 0
public void testEnumControl() {
    Object[] values = new Object[] { "val1", "val2" };
    EnumControl control = new MyControl(EnumControl.Type.REVERB, values,
            "val1");

    assertEquals("val1", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val1", control.toString());

    control.setValue("val2");
    assertEquals("val2", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val2", control.toString());

    try {
        control.setValue("val3");
        fail("No expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {            
    }
}
EnumControlTest.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
public void testEnumControl() {
    Object[] values = new Object[] { "val1", "val2" };
    EnumControl control = new MyControl(EnumControl.Type.REVERB, values,
            "val1");

    assertEquals("val1", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val1", control.toString());

    control.setValue("val2");
    assertEquals("val2", control.getValue());
    assertTrue(Arrays.equals(values, control.getValues()));
    assertEquals("Reverb with current value: val2", control.toString());

    try {
        control.setValue("val3");
        fail("No expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {            
    }
}
JavaMixer.java 文件源码 项目:spark-svn-mirror 阅读 22 收藏 0 点赞 0 评论 0
public ControlNode(Control control) {
    super(control.getType(), true);
    this.control = control;
    if (control instanceof BooleanControl) {
        component = createControlComponent((BooleanControl) control);
    } else if (control instanceof EnumControl) {
        component = createControlComponent((EnumControl) control);
    } else if (control instanceof FloatControl) {
        component = createControlComponent((FloatControl) control);
    } else {
        component = null;
    }
}
EnumControlTest.java 文件源码 项目:cn1 阅读 18 收藏 0 点赞 0 评论 0
public MyControl(EnumControl.Type type, Object[] values, Object value) {
    super(type, values, value);
}
EnumControlTest.java 文件源码 项目:freeVM 阅读 17 收藏 0 点赞 0 评论 0
public MyControl(EnumControl.Type type, Object[] values, Object value) {
    super(type, values, value);
}
EnumControlTest.java 文件源码 项目:freeVM 阅读 19 收藏 0 点赞 0 评论 0
public MyControl(EnumControl.Type type, Object[] values, Object value) {
    super(type, values, value);
}
JavaMixer.java 文件源码 项目:spark-svn-mirror 阅读 21 收藏 0 点赞 0 评论 0
private JComponent createControlComponent(EnumControl control) {
    JPanel component = new JPanel();
    String strControlName = control.getType().toString();
    component.setBorder(new TitledBorder(new EtchedBorder(), strControlName));
    return component;
}
AbstractAudio.java 文件源码 项目:SimpleAudio 阅读 19 收藏 0 点赞 0 评论 0
protected static final HashMap<String, Control> extractControls(Line line, Map<String, Control> old) {

    HashMap<String, Control> controls = new HashMap<>();

    for(Control control : line.getControls()) {

        String key = control.getType().toString();

        if(old != null && old.containsKey(key)) {

            Control oldControl = old.get(key);

            if(control instanceof FloatControl && oldControl instanceof FloatControl) {

                ((FloatControl)control).setValue(((FloatControl)oldControl).getValue());

            } else if(control instanceof BooleanControl && oldControl instanceof BooleanControl) {

                ((BooleanControl)control).setValue(((BooleanControl)oldControl).getValue());

            } else if(control instanceof EnumControl && oldControl instanceof EnumControl) {

                ((EnumControl)control).setValue(((EnumControl)oldControl).getValue());
            }
        }

        controls.put(control.getType().toString(), control);
    }

    return controls;
}


问题


面经


文章

微信
公众号

扫码关注公众号