1 7 8 package javax.sound.sampled; 9 10 11 22 public interface Port extends Line { 23 24 25 27 28 46 public static class Info extends Line.Info { 47 48 49 51 52 54 57 public static final Info MICROPHONE = new Info(Port .class,"MICROPHONE", true); 58 59 62 public static final Info LINE_IN = new Info(Port .class,"LINE_IN", true); 63 64 67 public static final Info COMPACT_DISC = new Info(Port .class,"COMPACT_DISC", true); 68 69 70 72 75 public static final Info SPEAKER = new Info(Port .class,"SPEAKER", false); 76 77 80 public static final Info HEADPHONE = new Info(Port .class,"HEADPHONE", false); 81 82 85 public static final Info LINE_OUT = new Info(Port .class,"LINE_OUT", false); 86 87 88 90 94 95 97 private String name; 98 private boolean isSource; 99 100 101 103 114 public Info(Class <?> lineClass, String name, boolean isSource) { 115 116 super(lineClass); 117 this.name = name; 118 this.isSource = isSource; 119 } 120 121 122 124 128 public String getName() { 129 return name; 130 } 131 132 138 public boolean isSource() { 139 return isSource; 140 } 141 142 148 public boolean matches(Line.Info info) { 149 150 if (! (super.matches(info)) ) { 151 return false; 152 } 153 154 if (!(name.equals(((Info)info).getName())) ) { 155 return false; 156 } 157 158 if (! (isSource == ((Info)info).isSource()) ) { 159 return false; 160 } 161 162 return true; 163 } 164 165 166 169 public final boolean equals(Object obj) { 170 return super.equals(obj); 171 } 172 173 176 public final int hashCode() { 177 return super.hashCode(); 178 } 179 180 181 182 187 public final String toString() { 188 return (name + ((isSource == true) ? " source" : " target") + " port"); 189 } 190 191 } } 193 | Popular Tags |