Ejemplo n.º 1
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)));
            }
Ejemplo n.º 2
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));
            }
Ejemplo n.º 3
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);
      }
Ejemplo n.º 4
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));
      }