public override void Evaluate(int SpreadMax) { var update = CheckReset(); if (FInput.IsChanged && !FInput.IsAnyInvalid()) { foreach (var message in FInput) { if (!Keep.Contains(message)) { Keep.Add(message); update = true; } } } if (UpKeep()) { update = true; } if (update) { FOutput.FlushResult(Keep); } }
internal void AddKeep(KeepNode keep) { if (keep.KeepType == KeepType.Advantage || keep.KeepType == KeepType.Disadvantage) { if (Keep.Count > 0) { if (haveAdvantage) { throw new DiceException(DiceErrorCode.AdvantageOnlyOnce); } else { throw new DiceException(DiceErrorCode.NoAdvantageKeep); } } haveAdvantage = true; } else if (haveAdvantage) { throw new DiceException(DiceErrorCode.NoAdvantageKeep); } Keep.Add(keep); }
//called when data for any output pin is requested public override void Evaluate(int SpreadMax) { var update = CheckReset(); if (!FInput.IsAnyInvalid() && FInput.IsChanged) { foreach (var message in FInput) { if (!Keep.Contains(message)) { Keep.Add(message); update = true; } } } if (RemoveOldOrFlagged()) { update = true; } if (UpKeep(update)) { update = true; } }
public Message MatchOrInsert(Message message) { // inject all incoming messages and keep a list of all var idFields = from fieldName in FUseAsID select fieldName.Name; var match = MatchByField(message, idFields); if (match == null) { Keep.Add(message); // record message return(message); } else { match.InjectWith(message, true); // copy all attributes from message to matching record return(match); } }
public Message MatchOrInsert(Message message) { var matched = (from keep in Keep where keep.Topic == message.Topic select keep).ToList(); if (matched.Count == 0) { Keep.Add(message); // record message return(message); } else { var found = matched.First(); // found a matching record found.InjectWith(message, true); // copy all attributes from message to matching record found.TimeStamp = message.TimeStamp; // forceUpdate time return(found); } }