public override void Calculate() { if (Outputs.Count == 1 && Inputs.All(i => i.State.HasValue)) { Outputs.First().State = (Inputs.Count < 2) ? false : Inputs.All(i => (bool)i.State == true); } }
public override void Calculate() { if (Outputs.Count == 1 && Inputs.All(i => i.State.HasValue)) { Outputs.First().State = Inputs.Count < 2 ? false : !Inputs.All(i => i.State == false); } }
protected DigitalLevel OrFunction() { if (Inputs.All((c) => c.Level == DigitalLevel.Low)) { return(DigitalLevel.Low); } return(DigitalLevel.High); }
public override void Calculate() { if (Inputs.Count > 0 && (Inputs.Count == Outputs.Count) && Inputs.All(i => i.State.HasValue)) { for (int i = 0; i < Inputs.Count; i++) { Outputs[i].State = Inputs[i].State; } } }
public override IList <string> GetColumnTypes() { if (Inputs.All(i => InputDict.ContainsKey(i))) { var input1 = InputDict[Inputs[0]]; var input2 = InputDict[Inputs[1]]; var result = new List <string>(); result.AddRange(input1.GetColumnTypes().Select(c => c)); result.AddRange(input2.GetColumnTypes().Select(c => c)); return(result); } else { return(new List <string>()); } }
private bool MethodFinder(MethodBase methodInfo, Type parameterType) { var parameters = methodInfo.GetParameters() .Where(pi => pi.Name != OutPrefix + BegIdxParam && pi.Name != OutPrefix + NbElementParam) .ToList(); var inParameters = parameters.Where(pi => pi.Name.StartsWith(InPrefix) && pi.ParameterType == parameterType) .Select(pi => pi.Name); var outParameters = parameters .Where(pi => pi.Name.StartsWith(OutPrefix) && (pi.ParameterType == parameterType || pi.ParameterType == typeof(int[]))) .Select(pi => pi.Name); var optInParameters = parameters.Where(pi => pi.Name.StartsWith(OptInPrefix)).Select(pi => pi.Name); var defInParameters = Inputs.Length > 1 && Inputs.All(p => p == GeneralRealParam) ? Inputs.Select((p, i) => InPrefix + p + i) : Inputs.Select(p => InPrefix + p); var defOutParameters = Outputs.Select(NormalizeOutputParameter); var defOptInParameters = Options.Select(NormalizeOptionalParameter); return(methodInfo.Name == Name && inParameters.SequenceEqual(defInParameters) && outParameters.SequenceEqual(defOutParameters) && optInParameters.SequenceEqual(defOptInParameters)); }
public IEnumerator Activate() { bool isLast = Inputs.All(x => x.IsActive); while (!Inputs.All(x => x.IsActive)) { yield return(null); } if (isLast) { ActiveRefCount++; yield return(TimingController.Instance.WaitAppropriately(Duration)); if (Duration != TimeCategory.Math) { SFXPlayer.PlaySound("ActivateNode"); } yield return(ActivateInner()); ActiveRefCount--; } }
protected override void CalculateOutput() { output = Inputs.All(x => x.Value); }
protected override bool Check() { return(Inputs.All(c => c.IsActive)); }
public override bool Eval(Dictionary <char, bool> values) { return(Inputs.All(g => g.Eval(values))); }
public override bool Output() => Inputs.All(input => input.Output());