예제 #1
0
 /// <summary>Indicates whether the specified info object matches this one.</summary>
 /// <remarks>
 /// Indicates whether the specified info object matches this one.
 /// To match, the specified object must be identical to or
 /// a special case of this one.  The specified info object
 /// must be either an instance of the same class as this one,
 /// or an instance of a sub-type of this one.  In addition, the
 /// attributes of the specified object must be compatible with the
 /// capabilities of this one.  Specifically, the routing configuration
 /// for the specified info object must be compatible with that of this
 /// one.
 /// Subclasses may add other criteria to determine whether the two objects
 /// match.
 /// </remarks>
 /// <param name="info">the info object which is being compared to this one</param>
 /// <returns>
 /// <code>true</code> if the specified object matches this one,
 /// <code>false</code> otherwise
 /// </returns>
 public virtual bool matches(LineInfo info)
 {
     // $$kk: 08.30.99: is this backwards?
     // dataLine.matches(targetDataLine) == true: targetDataLine is always dataLine
     // targetDataLine.matches(dataLine) == false
     // so if i want to make sure i get a targetDataLine, i need:
     // targetDataLine.matches(prospective_match) == true
     // => prospective_match may be other things as well, but it is at least a targetDataLine
     // targetDataLine defines the requirements which prospective_match must meet.
     // "if this Class object represents a declared class, this method returns
     // true if the specified Object argument is an instance of the represented
     // class (or of any of its subclasses)"
     // GainControlClass.isInstance(MyGainObj) => true
     // GainControlClass.isInstance(MySpecialGainInterfaceObj) => true
     // this_class.isInstance(that_object)	=> that object can by cast to this class
     //										=> that_object's class may be a subtype of this_class
     //										=> that may be more specific (subtype) of this
     // "If this Class object represents an interface, this method returns true
     // if the class or any superclass of the specified Object argument implements
     // this interface"
     // GainControlClass.isInstance(MyGainObj) => true
     // GainControlClass.isInstance(GenericControlObj) => may be false
     // => that may be more specific
     if (!(info is Line))
     {
         return false;
     }
     // this.isAssignableFrom(that)  =>  this is same or super to that
     //								=>	this is at least as general as that
     //								=>	that may be subtype of this
     if (!(getLineClass().IsAssignableFrom(info.getLineClass())))
     {
         return false;
     }
     return true;
 }