protected void SetInOperator(LogicalOperator op) { if (InOperators.Count() > 0) { throw new TranspilerInternalErrorException("InOperator is already set"); } op.AddOutOperator(this); AddInOperator(op); }
protected void SetInOperators(LogicalOperator opLeft, LogicalOperator opRight) { if (InOperators.Count() > 0) { throw new TranspilerInternalErrorException("InOperatorLeft or InOperatorRight is already set."); } opLeft.AddOutOperator(this); opRight.AddOutOperator(this); AddInOperator(opLeft); AddInOperator(opRight); }
/// <summary> /// Operator graph traverse: get all upstream operators of a particular type /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public IEnumerable <T> GetAllUpstreamOperatorsOfType <T>() where T : LogicalOperator { var opList = new List <T>(); if (InOperators.Count() > 0) { opList.AddRange( InOperators .SelectMany(op => op.GetAllUpstreamOperatorsOfType <T>()) .Distinct() // we do have multiplexing (multiple output) for operators in some scenarios, so we need to distinct here ); } if (this is T) { opList.Add(this as T); } return(opList); }