A condition that must be true at the start of every iteration of a loop.
Inheritance: ContractElement, ILoopInvariant
示例#1
0
 /// <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;
 }
示例#2
0
 /// <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;
 }