コード例 #1
0
ファイル: VariableMapLattice.cs プロジェクト: omaragb/tlp182
 public VariableMapLattice(IPropExprFactory /*!*/ propExprFactory, IValueExprFactory /*!*/ valueExprFactory, MicroLattice /*!*/ microLattice, /*maybe null*/ IComparer variableComparer)
     : base(valueExprFactory)
 {
     Contract.Requires(microLattice != null);
     Contract.Requires(valueExprFactory != null);
     Contract.Requires(propExprFactory != null);
     this.propExprFactory  = propExprFactory;
     this.microLattice     = microLattice;
     this.variableComparer = variableComparer;
     // base(valueExprFactory);
 }
コード例 #2
0
ファイル: VariableMapLattice.cs プロジェクト: omaragb/tlp182
 public Elt /*!*/ Remove(IVariable /*!*/ var, MicroLattice microLattice)
 {
     Contract.Requires(var != null);
     Contract.Ensures(Contract.Result <Elt>() != null);
     if (this.IsBottom)
     {
         return(this);
     }
     Contract.Assume(this.constraints != null);
     return(new Elt(this.constraints.Remove(var)));
 }
コード例 #3
0
ファイル: VariableMapLattice.cs プロジェクト: omaragb/tlp182
            /// <summary>
            /// Add a new entry in the functional map: var --> value.
            /// If the variable is already there, throws an exception
            /// </summary>
            public Elt /*!*/ Add(IVariable /*!*/ var, Element /*!*/ value, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(value != null);
                Contract.Requires(var != null);
                Contract.Requires((!this.IsBottom));
                Contract.Ensures(Contract.Result <Elt>() != null);
                Contract.Assume(this.constraints != null);
                Contract.Assert(!this.constraints.Contains(var));

                if (microLattice.IsBottom(value))
                {
                    return(Bottom);
                }
                if (microLattice.IsTop(value))
                {
                    return(this.Remove(var, microLattice));
                }

                return(new Elt(this.constraints.Add(var, value)));
            }
コード例 #4
0
ファイル: VariableMapLattice.cs プロジェクト: omaragb/tlp182
            /// <summary>
            /// Set the value of the variable in the functional map
            /// If the variable is not already there, throws an exception
            /// </summary>
            public Elt /*!*/ Set(IVariable /*!*/ var, Element /*!*/ value, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(value != null);
                Contract.Requires(var != null);
                Contract.Ensures(Contract.Result <Elt>() != null);
                if (microLattice.IsBottom(value))
                {
                    return(Bottom);
                }
                if (microLattice.IsTop(value))
                {
                    return(this.Remove(var, microLattice));
                }

                Contract.Assume(this.constraints != null);
                Contract.Assert(this.constraints.Contains(var));

                // this.constraints[var] = value;
                IFunctionalMap newMap = this.constraints.Set(var, value);

                return(new Elt(newMap));
            }
コード例 #5
0
 public VariableMapLattice(IPropExprFactory/*!*/ propExprFactory, IValueExprFactory/*!*/ valueExprFactory, MicroLattice/*!*/ microLattice, /*maybe null*/IComparer variableComparer)
   : base(valueExprFactory) {
   Contract.Requires(microLattice != null);
   Contract.Requires(valueExprFactory != null);
   Contract.Requires(propExprFactory != null);
   this.propExprFactory = propExprFactory;
   this.microLattice = microLattice;
   this.variableComparer = variableComparer;
   // base(valueExprFactory);
 }
コード例 #6
0
 public Elt/*!*/ Rename(IVariable/*!*/ oldName, IVariable/*!*/ newName, MicroLattice/*!*/ microLattice) {
   Contract.Requires(microLattice != null);
   Contract.Requires(newName != null);
   Contract.Requires(oldName != null);
   Contract.Requires((!this.IsBottom));
   Contract.Ensures(Contract.Result<Elt>() != null);
   Element value = this[oldName];
   if (value == null) {
     return this;
   } // 'oldName' isn't in the map, so neither will be 'newName'
   Contract.Assume(this.constraints != null);
   IFunctionalMap newMap = this.constraints.Remove(oldName);
   newMap = newMap.Add(newName, value);
   return new Elt(newMap);
 }
コード例 #7
0
 public Elt/*!*/ Remove(IVariable/*!*/ var, MicroLattice microLattice) {
   Contract.Requires(var != null);
   Contract.Ensures(Contract.Result<Elt>() != null);
   if (this.IsBottom) {
     return this;
   }
   Contract.Assume(this.constraints != null);
   return new Elt(this.constraints.Remove(var));
 }
コード例 #8
0
      /// <summary>
      /// Set the value of the variable in the functional map
      /// If the variable is not already there, throws an exception
      /// </summary>
      public Elt/*!*/ Set(IVariable/*!*/ var, Element/*!*/ value, MicroLattice/*!*/ microLattice) {
        Contract.Requires(microLattice != null);
        Contract.Requires(value != null);
        Contract.Requires(var != null);
        Contract.Ensures(Contract.Result<Elt>() != null);
        if (microLattice.IsBottom(value)) {
          return Bottom;
        }
        if (microLattice.IsTop(value)) {
          return this.Remove(var, microLattice);
        }

        Contract.Assume(this.constraints != null);
        Contract.Assert(this.constraints.Contains(var));

        // this.constraints[var] = value;
        IFunctionalMap newMap = this.constraints.Set(var, value);

        return new Elt(newMap);
      }
コード例 #9
0
      /// <summary>
      /// Add a new entry in the functional map: var --> value.
      /// If the variable is already there, throws an exception
      /// </summary>
      public Elt/*!*/ Add(IVariable/*!*/ var, Element/*!*/ value, MicroLattice/*!*/ microLattice) {
        Contract.Requires(microLattice != null);
        Contract.Requires(value != null);
        Contract.Requires(var != null);
        Contract.Requires((!this.IsBottom));
        Contract.Ensures(Contract.Result<Elt>() != null);
        Contract.Assume(this.constraints != null);
        Contract.Assert(!this.constraints.Contains(var));

        if (microLattice.IsBottom(value)) {
          return Bottom;
        }
        if (microLattice.IsTop(value)) {
          return this.Remove(var, microLattice);
        }

        return new Elt(this.constraints.Add(var, value));
      }
コード例 #10
0
ファイル: VariableMapLattice.cs プロジェクト: omaragb/tlp182
            public Elt /*!*/ Rename(IVariable /*!*/ oldName, IVariable /*!*/ newName, MicroLattice /*!*/ microLattice)
            {
                Contract.Requires(microLattice != null);
                Contract.Requires(newName != null);
                Contract.Requires(oldName != null);
                Contract.Requires((!this.IsBottom));
                Contract.Ensures(Contract.Result <Elt>() != null);
                Element value = this[oldName];

                if (value == null)
                {
                    return(this);
                } // 'oldName' isn't in the map, so neither will be 'newName'
                Contract.Assume(this.constraints != null);
                IFunctionalMap newMap = this.constraints.Remove(oldName);

                newMap = newMap.Add(newName, value);
                return(new Elt(newMap));
            }