/// <summary> /// gives the output of the connected gate /// </summary> /// <returns></returns> public override int[] calculate() { if (InputPorts.Count > 1) { throw new Exception("output has too many inputs!"); } if (!InputPorts.ContainsKey(0)) { throw new Exception("output is missing input 0!"); } Tuple <CircuitElement, int> source = InputPorts[0]; int[] childVals = source.Item1.calculate(); if (childVals == null) { return(null); } outputValues[0] = childVals[source.Item2]; return(outputValues); }