コード例 #1
0
ファイル: XContract.cs プロジェクト: zhuyue1314/CodeContracts
 /// <summary>
 /// Creates a new package for an ITypeInvariant contract.
 /// </summary>
 public XInvariant(IMetadataHost host, ITypeInvariant invariant, DocTracker docTracker)
     : base(host, null, null, docTracker)
 {
     Contract.Requires(invariant != null);
     Contract.Requires(docTracker != null);
     this.invariant = invariant;
 }
コード例 #2
0
 /// <summary>
 ///     Traverses the type invariant.
 /// </summary>
 public void Traverse(ITypeInvariant typeInvariant)
 {
     Contract.Requires(typeInvariant != null);
     preorderVisitor.Visit(typeInvariant);
     if (StopTraversal)
     {
         return;
     }
     TraverseChildren(typeInvariant);
 }
コード例 #3
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 public void Visit(ITypeInvariant typeInvariant)
 {
     this.result = this.copier.Copy(typeInvariant);
 }
コード例 #4
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Makes a shallow copy of the given type invariant.
 /// </summary>
 public virtual TypeInvariant Copy(ITypeInvariant typeInvariant)
 {
     return new TypeInvariant(typeInvariant);
 }
コード例 #5
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Visits the specified type invariant.
 /// </summary>
 /// <param name="typeInvariant">The type invariant.</param>
 public virtual ITypeInvariant Visit(ITypeInvariant typeInvariant)
 {
     TypeInvariant mutableTypeInvariant = typeInvariant as TypeInvariant;
       if (!this.copyOnlyIfNotAlreadyMutable || mutableTypeInvariant == null)
     mutableTypeInvariant = new TypeInvariant(typeInvariant);
       return this.Visit(mutableTypeInvariant);
 }
コード例 #6
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 /// <summary>
 /// Visits the given type invariant.
 /// </summary>
 public virtual void Visit(ITypeInvariant typeInvariant)
 {
     this.Visit((IContractElement)typeInvariant);
 }
コード例 #7
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 /// <summary>
 /// Traverses the children of the type invariant.
 /// </summary>
 public virtual void TraverseChildren(ITypeInvariant typeInvariant)
 {
     Contract.Requires(typeInvariant != null);
       this.TraverseChildren((IContractElement)typeInvariant);
 }
コード例 #8
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 /// <summary>
 /// Visits the given type invariant.
 /// </summary>
 public virtual void Visit(ITypeInvariant typeInvariant)
 {
 }
コード例 #9
0
ファイル: Copier.cs プロジェクト: Refresh06/visualmutator
    /// <summary>
    /// Makes a shallow copy of the given type invariant.
    /// </summary>
    public virtual TypeInvariant Copy(ITypeInvariant typeInvariant) {
      Contract.Requires(typeInvariant != null);
      Contract.Ensures(Contract.Result<TypeInvariant>() != null);

      return new TypeInvariant(typeInvariant);
    }
コード例 #10
0
 /// <summary>
 ///     Traverses the children of the type invariant.
 /// </summary>
 public virtual void TraverseChildren(ITypeInvariant typeInvariant)
 {
     Contract.Requires(typeInvariant != null);
     TraverseChildren((IContractElement)typeInvariant);
 }
コード例 #11
0
 public void Visit(ITypeInvariant typeInvariant)
 {
     traverser.Traverse(typeInvariant);
 }
コード例 #12
0
 /// <summary>
 /// Creates a type invariant that shares all of the information in <paramref name="typeInvariant"/>.
 /// </summary>
 /// <param name="typeInvariant"></param>
 public TypeInvariant(ITypeInvariant typeInvariant)
     : base(typeInvariant)
 {
     this.isAxiom = typeInvariant.IsAxiom;
     this.name    = typeInvariant.Name;
 }
コード例 #13
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Rewrites the given type invariant.
 /// </summary>
 public virtual ITypeInvariant Rewrite(ITypeInvariant typeInvariant)
 {
     var mutableTypeInvariant = typeInvariant as TypeInvariant;
       if (mutableTypeInvariant == null) return typeInvariant;
       this.RewriteChildren(mutableTypeInvariant);
       return mutableTypeInvariant;
 }
コード例 #14
0
 public void Visit(ITypeInvariant typeInvariant)
 {
     Contract.Assert(typeInvariant != null);
     Visit((IContractElement)typeInvariant);
 }
コード例 #15
0
ファイル: Copier.cs プロジェクト: Refresh06/visualmutator
    /// <summary>
    /// Makes a deep copy of the given type invariant.
    /// </summary>
    public TypeInvariant Copy(ITypeInvariant typeInvariant) {
      Contract.Requires(typeInvariant != null);
      Contract.Ensures(Contract.Result<TypeInvariant>() != null);

      var mutableCopy = this.shallowCopier.Copy(typeInvariant);
      this.Copy((ContractElement)mutableCopy);
      return mutableCopy;
    }
コード例 #16
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given type invariant.
 /// </summary>
 public virtual void Visit(ITypeInvariant typeInvariant)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(typeInvariant);
       this.Visit(typeInvariant.Condition);
       if (typeInvariant.Description != null)
     this.Visit(typeInvariant.Description);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not decrease this.path.Count.
       this.path.Pop();
 }
コード例 #17
0
ファイル: Contracts.cs プロジェクト: Refresh06/visualmutator
 /// <summary>
 /// Creates a type invariant that shares all of the information in <paramref name="typeInvariant"/>.
 /// </summary>
 /// <param name="typeInvariant"></param>
 public TypeInvariant(ITypeInvariant typeInvariant)
   : base(typeInvariant) {
   this.isAxiom = typeInvariant.IsAxiom;
   this.name = typeInvariant.Name;
 }
コード例 #18
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 /// <summary>
 /// Traverses the type invariant.
 /// </summary>
 public void Traverse(ITypeInvariant typeInvariant)
 {
     Contract.Requires(typeInvariant != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(typeInvariant);
       if (this.StopTraversal) return;
       this.TraverseChildren(typeInvariant);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(typeInvariant);
 }
コード例 #19
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Get the mutable copy of a type invariant.
 /// </summary>
 /// <param name="typeInvariant"></param>
 /// <returns></returns>
 public virtual TypeInvariant GetMutableCopy(ITypeInvariant typeInvariant)
 {
     object cachedValue;
       if (this.cache.TryGetValue(typeInvariant, out cachedValue))
     return (TypeInvariant)cachedValue;
       var result = new TypeInvariant(typeInvariant);
       // Probably not necessary, no two thrown exceptions are shared.
       this.cache.Add(typeInvariant, result);
       this.cache.Add(result, result);
       return result;
 }
コード例 #20
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 public void Visit(ITypeInvariant typeInvariant)
 {
     this.traverser.Traverse(typeInvariant);
 }
コード例 #21
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Returns a deep copy of the <param name="typeInvariant"/>.
 /// </summary>
 public virtual ITypeInvariant Substitute(ITypeInvariant typeInvariant)
 {
     this.coneAlreadyFixed = true;
       return this.DeepCopy(new TypeInvariant(typeInvariant));
 }
コード例 #22
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 public void Visit(ITypeInvariant typeInvariant)
 {
     Contract.Requires(typeInvariant != null);
       throw new NotImplementedException();
 }
コード例 #23
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Makes a deep copy of the given type invariant.
 /// </summary>
 public TypeInvariant Copy(ITypeInvariant typeInvariant)
 {
     var mutableCopy = this.shallowCopier.Copy(typeInvariant);
       this.Copy((ContractElement)mutableCopy);
       return mutableCopy;
 }
コード例 #24
0
 /// <summary>
 /// Creates a new package for an ITypeInvariant contract.
 /// </summary>
 public XInvariant(IMetadataHost host, ITypeInvariant invariant, DocTracker docTracker)
   : base(host, null, null, docTracker) {
   Contract.Requires(invariant != null);
   Contract.Requires(docTracker != null);
   this.invariant = invariant;
 }
コード例 #25
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Visits the specified type invariant.
 /// </summary>
 /// <param name="typeInvariant">The type invariant.</param>
 public virtual ITypeInvariant Visit(ITypeInvariant typeInvariant)
 {
     if (this.stopTraversal) return typeInvariant;
       TypeInvariant mutableTypeInvariant = typeInvariant as TypeInvariant;
       if (mutableTypeInvariant == null) return typeInvariant;
       mutableTypeInvariant.Condition = this.Visit(mutableTypeInvariant.Condition);
       if (mutableTypeInvariant.Description != null)
     mutableTypeInvariant.Description = this.Visit(mutableTypeInvariant.Description);
       return mutableTypeInvariant;
 }