public bool Equals(LongByte p) { // Return true if the fields match. // Note that the base class is not invoked because it is // System.Object, which defines Equals as reference equality. return(Value == p.Value); }
public NodeData(INode node, DataSourceBuilder builder, Evaluation e = null) { if (builder is null) { throw new ArgumentNullException(nameof(builder)); } if (node is null) { throw new ArgumentNullException(nameof(node)); } double ColumnInstances = e != null ? e.Scores[node.Key].ColumnInstances : builder.Result.ColumnInstances[node.Key]; Node = node ?? throw new ArgumentNullException(nameof(node)); Score = Node.GetScore(builder.Result.BaseRate); Weight = builder.Result.GraphInstances / ColumnInstances; LongByte Key = new LongByte(Node.Key); Data = new Dictionary <string, object>() { ["Accuracy"] = node.Accuracy.Current, ["Next Accuracy"] = node.Accuracy.Next, ["Weight"] = Weight, ["Score"] = Score, ["Weighted Score"] = Score * Weight, ["GraphInstances"] = builder.Result.GraphInstances, ["ColumnInstances"] = ColumnInstances, ["Match None"] = node[MatchResult.None], ["Match Route"] = node[MatchResult.Route], ["Match Predictor"] = node[MatchResult.Output], ["Match Both"] = node[MatchResult.Both], ["Key"] = new LongByte(Node.Key), ["Name"] = builder.GetNodeName(node) }; if (e != null) { int h = 0; foreach (string s in e.CalculatedData.Keys) { Data.Add(s, Key.HasBitAt(h++) ? e.CalculatedData[s] : ""); } } int i = 0; foreach (string s in builder.Registrations.Select(r => r.Header)) { Data.Add($"{s}_Bit", Key.HasBitAt(i++) ? 1 : 0); } }
public void MatchRoute(INode n, long Key) { if (n is null) { throw new ArgumentNullException(nameof(n)); } if (Key == 0) { throw new ArgumentException("Can not match node with key = 0", nameof(n)); } if (!this.MatchedRoutes.ContainsKey(Key)) { this.MatchedRoutes.TryAdd(Key, n); if (this.AnalysisResults.ColumnInstances.ContainsKey(Key)) { if (!this.Scores.TryGetValue(Key, out AnalysisScore score)) { score = new AnalysisScore(); this.Scores.TryAdd(Key, score); } score.Value = n.GetScore(this.Result.BaseRate); score.OldCount = (double)this.AnalysisResults.GraphInstances / this.AnalysisResults.ColumnInstances[Key]; score.OldValue = n.GetScore(this.Result.BaseRate); score.ColumnInstances++; LongByte lb = new LongByte(Key); while (lb > 0) { if (!this.Scores.TryGetValue(lb, out AnalysisScore s)) { s = new AnalysisScore(); this.Scores.TryAdd(lb, s); } s.ColumnInstances++; lb.TrimLeft(); } } } }
public LongByte And(LongByte other) { return(Value & other); }
public ValidationResult(LongByte @checked) { IsValid = true; Checked = @checked; }
public ValidationResult(IRouteConstraint violation, LongByte @checked) { IsValid = false; Violations.Add(violation); Checked = @checked; }
public ValidationResult(string message, LongByte @checked) { IsValid = false; Message = message; Checked = @checked; }