/// <summary> /// Visits the specified loop invariant. /// </summary> /// <param name="loopInvariant">The loop invariant.</param> /// <returns></returns> protected virtual ILoopInvariant DeepCopy(LoopInvariant loopInvariant) { loopInvariant.Condition = this.Substitute(loopInvariant.Condition); if (loopInvariant.Description != null) loopInvariant.Description = this.Substitute(loopInvariant.Description); return loopInvariant; }
/// <summary> /// Get the mutable copy of a loop invariant. /// </summary> /// <param name="loopInvariant"></param> /// <returns></returns> public virtual LoopInvariant GetMutableCopy(ILoopInvariant loopInvariant) { object cachedValue; if (this.cache.TryGetValue(loopInvariant, out cachedValue)) return (LoopInvariant)cachedValue; var result = new LoopInvariant(loopInvariant); // Probably not necessary, no two loop invariants are shared. this.cache.Add(loopInvariant, result); this.cache.Add(result, result); return result; }