/// <summary> /// Revokes the given computation and deletes it from the trace /// </summary> /// <param name="traceEntry">The computation that is to be revoked</param> public override void RevokeEntry(ITraceEntry traceEntry) { if (traceEntry == null) { throw new ArgumentNullException("traceEntry"); } if (published.Contains(traceEntry)) { published.Remove(traceEntry); } else { revoked.Add(traceEntry); } List <ITraceEntry> comps; if (computationsMade.TryGetValue(traceEntry.CreateInputArray(), out comps)) { comps.Remove(traceEntry); } if (computationsByTransformationRule.TryGetValue(traceEntry.TransformationRule, out comps)) { comps.Remove(traceEntry); } }
/// <summary> /// Publishes the given computation to the trace /// </summary> /// <param name="traceEntry">The computation that should be added to the trace</param> public override void PublishEntry(ITraceEntry traceEntry) { if (traceEntry == null) throw new ArgumentNullException("traceEntry"); if (!computations.Contains(traceEntry)) computations.Add(traceEntry); }
/// <summary> /// Revokes the given computation and deletes it from the trace /// </summary> /// <param name="traceEntry">The computation that is to be revoked</param> public override void RevokeEntry(ITraceEntry traceEntry) { if (traceEntry == null) { throw new ArgumentNullException("traceEntry"); } computations.Remove(traceEntry); }
private static bool IsInputArray(ITraceEntry c, object[] input) { for (int i = 0; i < input.Length; i++) { if (!object.Equals(input[i], c.GetInput(i))) { return(false); } } return(true); }
/// <summary> /// Publishes the given computation to the trace /// </summary> /// <param name="traceEntry">The computation that should be added to the trace</param> public override void PublishEntry(ITraceEntry traceEntry) { if (traceEntry == null) { throw new ArgumentNullException("traceEntry"); } if (!computations.Contains(traceEntry)) { computations.Add(traceEntry); } }
/// <summary> /// Publishes the given computation to the trace /// </summary> /// <param name="traceEntry">The computation that should be added to the trace</param> public override void PublishEntry(ITraceEntry traceEntry) { if (traceEntry == null) { throw new ArgumentNullException("traceEntry"); } if (revoked.Contains(traceEntry)) { revoked.Remove(traceEntry); } else { var success = published.Add(traceEntry); if (!success) { return; } } var box = traceEntry.CreateInputArray(); List <ITraceEntry> comps; if (!computationsMade.TryGetValue(box, out comps)) { comps = new List <ITraceEntry>(); if (!computationsMade.TryAdd(box, comps)) { comps = computationsMade[box]; } } if (!comps.Contains(traceEntry)) { comps.Add(traceEntry); var rule = traceEntry.TransformationRule; if (!computationsByTransformationRule.TryGetValue(rule, out comps)) { comps = new List <ITraceEntry>(); if (!computationsByTransformationRule.TryAdd(rule, comps)) { comps = computationsByTransformationRule[rule]; } } comps.Add(traceEntry); } else { published.Remove(traceEntry); } }
/// <summary> /// Creates a new array of input elements for the given trace entry /// </summary> /// <param name="traceEntry">The current trace entry</param> /// <returns>A new object array containing all trace entries for this trace entry</returns> public static object[] CreateInputArray(this ITraceEntry traceEntry) { if (traceEntry == null) { throw new ArgumentNullException("traceEntry"); } var inputTypes = traceEntry.TransformationRule.InputType; var array = new object[inputTypes.Length]; for (int i = 0; i < inputTypes.Length; i++) { array[i] = traceEntry.GetInput(i); } return(array); }
/// <summary> /// Publishes the given computation to the trace /// </summary> /// <param name="traceEntry">The computation that should be added to the trace</param> public abstract void PublishEntry(ITraceEntry traceEntry);
/// <summary> /// Revokes the given computation and deletes it from the trace /// </summary> /// <param name="traceEntry">The computation that is to be revoked</param> public abstract void RevokeEntry(ITraceEntry traceEntry);
/// <summary> /// Publishes the given computation to the trace /// </summary> /// <param name="traceEntry">The computation that should be added to the trace</param> public override void PublishEntry(ITraceEntry traceEntry) { if (traceEntry == null) throw new ArgumentNullException("traceEntry"); if (revoked.Contains(traceEntry)) { revoked.Remove(traceEntry); } else { var success = published.Add(traceEntry); if (!success) return; } var box = traceEntry.CreateInputArray(); List<ITraceEntry> comps; if (!computationsMade.TryGetValue(box, out comps)) { comps = new List<ITraceEntry>(); if (!computationsMade.TryAdd(box, comps)) { comps = computationsMade[box]; } } if (!comps.Contains(traceEntry)) { comps.Add(traceEntry); var rule = traceEntry.TransformationRule; if (!computationsByTransformationRule.TryGetValue(rule, out comps)) { comps = new List<ITraceEntry>(); if (!computationsByTransformationRule.TryAdd(rule, comps)) { comps = computationsByTransformationRule[rule]; } } comps.Add(traceEntry); } else { published.Remove(traceEntry); } }
/// <summary> /// Revokes the given computation and deletes it from the trace /// </summary> /// <param name="traceEntry">The computation that is to be revoked</param> public override void RevokeEntry(ITraceEntry traceEntry) { if (traceEntry == null) throw new ArgumentNullException("traceEntry"); if (published.Contains(traceEntry)) { published.Remove(traceEntry); } else { revoked.Add(traceEntry); } List<ITraceEntry> comps; if (computationsMade.TryGetValue(traceEntry.CreateInputArray(), out comps)) { comps.Remove(traceEntry); } if (computationsByTransformationRule.TryGetValue(traceEntry.TransformationRule, out comps)) { comps.Remove(traceEntry); } }
private static bool IsInputArray(ITraceEntry c, object[] input) { for (int i = 0; i < input.Length; i++) { if (!object.Equals(input[i], c.GetInput(i))) return false; } return true; }
/// <summary> /// Revokes the given computation and deletes it from the trace /// </summary> /// <param name="traceEntry">The computation that is to be revoked</param> public override void RevokeEntry(ITraceEntry traceEntry) { if (traceEntry == null) throw new ArgumentNullException("traceEntry"); computations.Remove(traceEntry); }