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

ControlDescription.java 文件源码 项目:Couch-Potato-Server 阅读 24 收藏 0 点赞 0 评论 0
@Override
public final String toString()
{
    if (contents==null)
    {
        final StringBuilder contentBuilder=new StringBuilder();

        for (int loop=0; loop<indent; loop++)
            contentBuilder.append('\t');
        contentBuilder.append(subject.toString());

        if (subject instanceof CompoundControl)
        {
            for (final Control member : ((CompoundControl)subject).getMemberControls())
            {
                contentBuilder.append(System.getProperty("line.separator"));
                contentBuilder.append(new ControlDescription(member, indent+1).toString());
            }
        }

        contents=contentBuilder.toString();
    }
    return contents;
}
ControlDescription.java 文件源码 项目:couch-potato-server 阅读 22 收藏 0 点赞 0 评论 0
@Override
public final String toString()
{
    if (contents==null)
    {
        final StringBuilder contentBuilder=new StringBuilder();

        for (int loop=0; loop<indent; loop++)
            contentBuilder.append('\t');
        contentBuilder.append(subject.toString());

        if (subject instanceof CompoundControl)
        {
            for (final Control member : ((CompoundControl)subject).getMemberControls())
            {
                contentBuilder.append(System.getProperty("line.separator"));
                contentBuilder.append(new ControlDescription(member, indent+1).toString());
            }
        }

        contents=contentBuilder.toString();
    }
    return contents;
}
ControlDescription.java 文件源码 项目:Couch-Potato-Server 阅读 23 收藏 0 点赞 0 评论 0
@Override
public final String toString()
{
    if (contents==null)
    {
        final StringBuilder contentBuilder=new StringBuilder();

        for (int loop=0; loop<indent; loop++)
            contentBuilder.append('\t');
        contentBuilder.append(subject.toString());

        if (subject instanceof CompoundControl)
        {
            for (final Control member : ((CompoundControl)subject).getMemberControls())
            {
                contentBuilder.append(System.getProperty("line.separator"));
                contentBuilder.append(new ControlDescription(member, indent+1).toString());
            }
        }

        contents=contentBuilder.toString();
    }
    return contents;
}
PortMixer.java 文件源码 项目:OpenJSharp 阅读 28 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:openjdk-jdk10 阅读 27 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
ToString.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
public static void main(String args[]) throws Exception {
    System.out.println();
    System.out.println();
    System.out.println("4629190: CompoundControl: getMemberControls() and toString() throw NullPointerException");

    String firstControlTypeName = "first_Control_Type_Name";
    String secondControlTypeName = "second_Control_Type_Name";
    String thirdControlTypeName = "third_Control_Type_Name";

    Control.Type firstControlType = new TestControlType(firstControlTypeName);
    Control.Type secondControlType = new TestControlType(secondControlTypeName);
    Control.Type thirdControlType = new TestControlType(thirdControlTypeName);

    Control firstControl = new TestControl(firstControlType);
    Control secondControl = new TestControl(secondControlType);
    Control thirdControl = new TestControl(thirdControlType);

    String testCompoundControlTypeName = "CompoundControl_Type_Name";
    CompoundControl.Type testCompoundControlType
        = new TestCompoundControlType(testCompoundControlTypeName);

    Control[] setControls = { firstControl, secondControl, thirdControl };
    CompoundControl testedCompoundControl
        = new TestCompoundControl(testCompoundControlType, setControls);

    // this may throw exception if bug applies
    Control[] producedControls = testedCompoundControl.getMemberControls();
    System.out.println("Got "+producedControls.length+" member controls.");

    // this may throw exception if bug applies
    String producedString = testedCompoundControl.toString();
    System.out.println("toString() returned: "+producedString);

    System.out.println("Test passed.");
}
PortMixer.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:jdk8u_jdk 阅读 21 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 23 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
ControlLocator.java 文件源码 项目:Couch-Potato-Server 阅读 20 收藏 0 点赞 0 评论 0
public Control find(final Control... in)
{
    for (final Control element : in)
    {
        if (locate.equals(element.getType()))
            return element;
        if (element instanceof CompoundControl)
        {
            final Control found=find(((CompoundControl)element).getMemberControls());
            if (found!=null)
                return found;
        }
    }
    return null;
}
ControlLocatorTest.java 文件源码 项目:Couch-Potato-Server 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void findIndirectDescendantSuccessfully()
{
    final CompoundControl mockParentControl=Mockito.mock(CompoundControl.class);
    Mockito.when(mockLine.getControls()).thenReturn(new Control[]{mockParentControl});
    Mockito.when(mockParentControl.getMemberControls()).thenReturn(new Control[]{mockVolume});

    Assert.assertEquals(mockVolume, new ControlLocator(testType).find(mockLine));
}
ControlLocator.java 文件源码 项目:couch-potato-server 阅读 22 收藏 0 点赞 0 评论 0
public Control find(final Control... in)
{
    for (final Control element : in)
    {
        if (locate.equals(element.getType()))
            return element;
        if (element instanceof CompoundControl)
        {
            final Control found=find(((CompoundControl)element).getMemberControls());
            if (found!=null)
                return found;
        }
    }
    return null;
}
ControlLocatorTest.java 文件源码 项目:couch-potato-server 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void findIndirectDescendantSuccessfully()
{
    final CompoundControl mockParentControl=Mockito.mock(CompoundControl.class);
    Mockito.when(mockLine.getControls()).thenReturn(new Control[]{mockParentControl});
    Mockito.when(mockParentControl.getMemberControls()).thenReturn(new Control[]{mockVolume});

    Assert.assertEquals(mockVolume, new ControlLocator(testType).find(mockLine));
}
PortMixer.java 文件源码 项目:infobip-open-jdk-8 阅读 22 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:jdk8u-dev-jdk 阅读 25 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:jdk7-jdk 阅读 23 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:openjdk-source-code-learn 阅读 22 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
ControlLocator.java 文件源码 项目:Couch-Potato-Server 阅读 19 收藏 0 点赞 0 评论 0
public Control find(final Control... in)
{
    for (final Control element : in)
    {
        if (locate.equals(element.getType()))
            return element;
        if (element instanceof CompoundControl)
        {
            final Control found=find(((CompoundControl)element).getMemberControls());
            if (found!=null)
                return found;
        }
    }
    return null;
}
ControlLocatorTest.java 文件源码 项目:Couch-Potato-Server 阅读 23 收藏 0 点赞 0 评论 0
@Test
public void findIndirectDescendantSuccessfully()
{
    final CompoundControl mockParentControl=Mockito.mock(CompoundControl.class);
    Mockito.when(mockLine.getControls()).thenReturn(new Control[]{mockParentControl});
    Mockito.when(mockParentControl.getMemberControls()).thenReturn(new Control[]{mockVolume});

    Assert.assertEquals(mockVolume, new ControlLocator(testType).find(mockLine));
}
PortMixer.java 文件源码 项目:OLD-OpenJDK8 阅读 24 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
BasicPlayer.java 文件源码 项目:BasicPlayer 阅读 20 收藏 0 点赞 0 评论 0
private static Control findControl(Type type, Control[] controls) {
    if (controls == null || controls.length == 0) return null;
    for (int i = 0; i < controls.length; i++) {
        Control control = controls[i];
        if (control.getType().equals(type)) return control;
        if (control instanceof CompoundControl) {
            CompoundControl compoundControl = (CompoundControl) control;
            Control member = findControl(type, compoundControl.getMemberControls());
            if (member != null) return member;
        }
    }
    return null;
}
PortMixer.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 24 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
PortMixer.java 文件源码 项目:openjdk-icedtea7 阅读 21 收藏 0 点赞 0 评论 0
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
AudioControlUtil.java 文件源码 项目:dev 阅读 20 收藏 0 点赞 0 评论 0
private static List<FloatControl> getVolumeControls(Control control) {
  List<FloatControl> result = new ArrayList<FloatControl>();
  if (control instanceof CompoundControl) {
    Control[] controls = ((CompoundControl) control).getMemberControls();
    for (Control c : controls) {
      result.addAll(getVolumeControls(c));
    }
  } else if (control instanceof FloatControl) {
    FloatControl fc = (FloatControl) control;
    if (fc.getType() == FloatControl.Type.VOLUME) {
      result.add(fc);
    }
  }
  return result;
}
JavaMixer.java 文件源码 项目:spark-svn-mirror 阅读 23 收藏 0 点赞 0 评论 0
private void createControlChildren(JavaMixer.ControlNode controlNode) {
    if (controlNode.getControl() instanceof CompoundControl) {
        CompoundControl control = (CompoundControl) controlNode.getControl();
        Control[] aControls = control.getMemberControls();
        for (Control con : aControls) {
            JavaMixer.ControlNode conNode = new JavaMixer.ControlNode(con);
            createControlChildren(conNode);
            controlNode.add(conNode);
        }
    }
}
JavaMixer.java 文件源码 项目:spark-svn-mirror 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    final JavaMixer sm = new JavaMixer();
    final JFrame jf = new JFrame("Mixer Test");
    final JPanel jp = new JPanel();
    jf.add(jp);
    jp.add(sm.getTree());
    jf.setSize(600, 500);
    jf.setVisible(true);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    sm.getTree().addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
                JavaMixer.ControlNode controlNode = (JavaMixer.ControlNode) path.getLastPathComponent();
                if (!(controlNode.getControl() instanceof CompoundControl)) {
                    if (jp.getComponentCount() > 1)
                        jp.remove(1);
                    jp.add(controlNode.getComponent(), 1);
                    jp.repaint();
                }
            }
        }
    });
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedInputVolume());
    jp.repaint();
    sm.setMicrophoneInput();
    sm.setMuteForMicrophoneOutput();
}
ToString.java 文件源码 项目:openjdk-jdk10 阅读 97 收藏 0 点赞 0 评论 0
TestCompoundControl(CompoundControl.Type type, Control[] memberControls) {
    super(type, memberControls);
}


问题


面经


文章

微信
公众号

扫码关注公众号