下面列出了javax.sound.sampled.Control#Type ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
@Override
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
@Override
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
@Override
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
@Override
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
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.");
}
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
}
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return true;
}
}
return false;
}
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
for (int i = 0; i < controls.length; i++) {
if (controlType == controls[i].getType()) {
return controls[i];
}
}
}
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
TestControl(Control.Type type) {
super(type);
}
public Control getControl(Control.Type control) {
return null;
}
public boolean isControlSupported(Control.Type control) {
return false;
}