220 * @see Mixer#getTargetLineInfo(Line.Info) 221 * @see Mixer#isLineSupported(Line.Info) 222 * @see AudioSystem#getLine(Line.Info) 223 * @see AudioSystem#getSourceLineInfo(Line.Info) 224 * @see AudioSystem#getTargetLineInfo(Line.Info) 225 * @see AudioSystem#isLineSupported(Line.Info) 226 * @since 1.3 227 */ 228 class Info { 229 230 /** 231 * The class of the line described by the info object. 232 */ 233 private final Class<?> lineClass; 234 235 /** 236 * Constructs an info object that describes a line of the specified 237 * class. This constructor is typically used by an application to 238 * describe a desired line. 239 * 240 * @param lineClass the class of the line that the new Line.Info object 241 * describes 242 */ 243 public Info(Class<?> lineClass) { 244 245 if (lineClass == null) { 246 this.lineClass = Line.class; 247 } else { 248 this.lineClass = lineClass; 249 } 250 } 251 252 /** 253 * Obtains the class of the line that this Line.Info object describes. 254 * 255 * @return the described line's class 256 */ 257 public Class<?> getLineClass() { 258 return lineClass; 259 } 260 261 /** 262 * Indicates whether the specified info object matches this one. To 263 * match, the specified object must be identical to or a special case of 264 * this one. The specified info object must be either an instance of 265 * the same class as this one, or an instance of a sub-type of this one. 266 * In addition, the attributes of the specified object must be 267 * compatible with the capabilities of this one. Specifically, the 268 * routing configuration for the specified info object must be 269 * compatible with that of this one. Subclasses may add other criteria 270 * to determine whether the two objects match. 271 * 272 * @param info the info object which is being compared to this one 273 * @return {@code true} if the specified object matches this one, 274 * {@code false} otherwise 275 */ 276 public boolean matches(Info info) { 277 278 // $$kk: 08.30.99: is this backwards? 279 // dataLine.matches(targetDataLine) == true: targetDataLine is always dataLine 280 // targetDataLine.matches(dataLine) == false 281 // so if i want to make sure i get a targetDataLine, i need: 282 // targetDataLine.matches(prospective_match) == true 283 // => prospective_match may be other things as well, but it is at least a targetDataLine 284 // targetDataLine defines the requirements which prospective_match must meet. 285 286 287 // "if this Class object represents a declared class, this method returns 288 // true if the specified Object argument is an instance of the represented 289 // class (or of any of its subclasses)" 290 // GainControlClass.isInstance(MyGainObj) => true | 220 * @see Mixer#getTargetLineInfo(Line.Info) 221 * @see Mixer#isLineSupported(Line.Info) 222 * @see AudioSystem#getLine(Line.Info) 223 * @see AudioSystem#getSourceLineInfo(Line.Info) 224 * @see AudioSystem#getTargetLineInfo(Line.Info) 225 * @see AudioSystem#isLineSupported(Line.Info) 226 * @since 1.3 227 */ 228 class Info { 229 230 /** 231 * The class of the line described by the info object. 232 */ 233 private final Class<?> lineClass; 234 235 /** 236 * Constructs an info object that describes a line of the specified 237 * class. This constructor is typically used by an application to 238 * describe a desired line. 239 * 240 * @param lineClass the class of the line that the new 241 * {@code Line.Info} object describes 242 */ 243 public Info(Class<?> lineClass) { 244 245 if (lineClass == null) { 246 this.lineClass = Line.class; 247 } else { 248 this.lineClass = lineClass; 249 } 250 } 251 252 /** 253 * Obtains the class of the line that this {@code Line.Info} object 254 * describes. 255 * 256 * @return the described line's class 257 */ 258 public Class<?> getLineClass() { 259 return lineClass; 260 } 261 262 /** 263 * Indicates whether the specified info object matches this one. To 264 * match, the specified object must be identical to or a special case of 265 * this one. The specified info object must be either an instance of the 266 * same class as this one, or an instance of a sub-type of this one. In 267 * addition, the attributes of the specified object must be compatible 268 * with the capabilities of this one. Specifically, the routing 269 * configuration for the specified info object must be compatible with 270 * that of this one. Subclasses may add other criteria to determine 271 * whether the two objects match. 272 * 273 * @param info the info object which is being compared to this one 274 * @return {@code true} if the specified object matches this one, 275 * {@code false} otherwise 276 */ 277 public boolean matches(Info info) { 278 279 // $$kk: 08.30.99: is this backwards? 280 // dataLine.matches(targetDataLine) == true: targetDataLine is always dataLine 281 // targetDataLine.matches(dataLine) == false 282 // so if i want to make sure i get a targetDataLine, i need: 283 // targetDataLine.matches(prospective_match) == true 284 // => prospective_match may be other things as well, but it is at least a targetDataLine 285 // targetDataLine defines the requirements which prospective_match must meet. 286 287 288 // "if this Class object represents a declared class, this method returns 289 // true if the specified Object argument is an instance of the represented 290 // class (or of any of its subclasses)" 291 // GainControlClass.isInstance(MyGainObj) => true |