示例#1
0
        /// <summary>
        /// Finds the element and pin that matched the pin target for this circuit container</summary>
        /// <param name="pinTarget">Contains pin's element and pin index</param>
        /// <param name="inputSide">True for input pin, false for output pin</param>
        /// <returns>Return a pair of element and pin. As an element instance method, if there is a match, the element is self,
        /// and pin is one of its pins defined in Type. If there is no match, both are null.</returns>
        public virtual Pair <Element, ICircuitPin> MatchPinTarget(PinTarget pinTarget, bool inputSide)
        {
            var result = new Pair <Element, ICircuitPin>();

            if (pinTarget != null && pinTarget.LeafDomNode == DomNode)  // an element must be a leaf node in a circuit hierarchy
            {
                var pin = inputSide ? ElementType.GetInputPin(pinTarget.LeafPinName)
                                        : ElementType.GetOutputPin(pinTarget.LeafPinName);
                if (pin != null)
                {
                    result.First  = this;
                    result.Second = pin;
                }
            }
            return(result);
        }
示例#2
0
 /// <summary>
 /// Gets the input pin for the given pin index.</summary>
 /// <param name="pinIndex">Pin index</param>
 /// <returns>Input pin for pin index</returns>
 public virtual ICircuitPin InputPin(int pinIndex)
 {
     return(ElementType.GetInputPin(pinIndex));
 }
示例#3
0
 /// <summary>
 /// Gets the input pin for the given pin index.</summary>
 /// <param name="pinIndex">Pin index</param>
 /// <returns>Input pin for pin index</returns>
 public virtual ICircuitPin InputPin(NameString name)
 {
     return(ElementType.GetInputPin(name));
 }