Пример #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 output pin for the given pin name.</summary>
 /// <param name="pinName">Pin name</param>
 /// <returns>Output pin for pin name</returns>
 public virtual ICircuitPin OutputPin(NameString pinName)
 {
     return(ElementType.GetOutputPin(pinName));
 }
Пример #3
0
 /// <summary>
 /// Gets the output pin for the given pin index.</summary>
 /// <param name="pinIndex">Pin index</param>
 /// <returns>Output pin for pin index</returns>
 public virtual ICircuitPin OutputPin(int pinIndex)
 {
     return(ElementType.GetOutputPin(pinIndex));
 }