Esempio n. 1
0
        override public bool AddToOctagon(CoreOctagon oct, IMutableSet <int> affectedDimensions)
        {
            bool b1 = cachedXLeqY.AddToOctagon(oct, affectedDimensions);
            bool b2 = cachedYLeqX.AddToOctagon(oct, affectedDimensions);

            return(b1 || b2);
        }
Esempio n. 2
0
        ///<summary>
        /// Add this constraint to the octagon
        ///</summary>
        override public bool AddToOctagon(CoreOctagon oct, IMutableSet <int> affectedDimensions)
        {
            int j = 2 * this.x + 1;
            int i = 2 * this.x;

            affectedDimensions.Add(this.x);

            try
            {
                Rational c = this.c * 2;

                if (Rational.Min(c, oct.octagon[Matpos2(i, j)]) == c)
                {
                    oct.octagon[Matpos2(i, j)] = c;
                    return(true);
                }
            }
            catch (ArithmeticExceptionRational)
            {
                // We could not add the constraint because of an arithmetic exception

                return(false);
            }

            return(false);
        }
Esempio n. 3
0
        override public bool AddToOctagon(CoreOctagon oct, IMutableSet <int> affectedDimensions)
        {
            bool bInf = this.inf.AddToOctagon(oct, affectedDimensions);
            bool bSup = this.sup.AddToOctagon(oct, affectedDimensions);

            return(bInf || bSup);
        }
Esempio n. 4
0
        ///<summary>
        /// Construct an object for the equality x == c
        ///</summary>
        public OctagonConstraintXEqualConst(int i, Rational c)
        {
            this.x = i;
            this.y = -1;
            this.c = c;

            this.inf = new OctagonConstraintMinusX(i, -this.c);
            this.sup = new OctagonConstraintX(i, this.c);

            this.toAdd = new Set <OctagonConstraint>();

            this.toAdd.Add(this.inf);
            this.toAdd.Add(this.sup);
        }
Esempio n. 5
0
        override public bool AddToOctagon(CoreOctagon oct, IMutableSet <int> affectedDimensions)
        {
            int j = 2 * this.x + 1;
            int i = 2 * this.y;

            affectedDimensions.Add(this.x);
            affectedDimensions.Add(this.y);

            if (this.c <= oct.octagon[Matpos2(i, j)])
            {
                oct.octagon[Matpos2(i, j)] = this.c;
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
    ///<summary>
    /// Construct an object for the equality x == c
    ///</summary>
    public OctagonConstraintXEqualConst(int i, Rational c)
    {
      this.x = i;
      this.y = -1;
      this.c = c;

      this.inf = new OctagonConstraintMinusX(i, -this.c);
      this.sup = new OctagonConstraintX(i, this.c);

      this.toAdd = new Set<OctagonConstraint>();

      this.toAdd.Add(this.inf);
      this.toAdd.Add(this.sup);
    }
Esempio n. 7
0
    override public bool AddToOctagon(CoreOctagon oct, IMutableSet<int> affectedDimensions)
    {
      bool b1 = this.cachedXLeqY.AddToOctagon(oct, affectedDimensions);
      bool b2 = this.cachedYLeqX.AddToOctagon(oct, affectedDimensions);

      return b1 || b2;
    }
Esempio n. 8
0
    override public bool AddToOctagon(CoreOctagon oct, IMutableSet<int> affectedDimensions)
    {
      int j = 2 * this.x + 1;
      int i = 2 * this.y;

      affectedDimensions.Add(this.x);
      affectedDimensions.Add(this.y);

      if (this.c <= oct.octagon[Matpos2(i, j)])
      {
        oct.octagon[Matpos2(i, j)] = this.c;
        return true;
      }
      return false;
    }
Esempio n. 9
0
 ///<summary>
 /// Add this constraint to the octagon passed as parameter
 /// </summary>
 ///<param name="oct">the octagon where to add the constraint</param>
 ///<param name="affectedDimensions">The dimensions affected by the constraints</param>
 ///<returns>true iff the constraint has been added</returns>
 abstract public bool AddToOctagon(CoreOctagon oct, IMutableSet<int> affectedDimensions);
 public TopSortData(DSetFactory setfactory) 
 {
   this.all_nodes = setfactory();
   this.real_roots = setfactory();
 }
 public ReachableNodesData(DSetFactory setfactory) 
 {
   this.all_nodes = setfactory();
 }
Esempio n. 12
0
 public override Class VisitClass(Class Class)
 {
     fieldUsage = new NodeSet();
     return(base.VisitClass(Class));
 }
Esempio n. 13
0
 public WhereObservableMutableSet(IMutableSet <T> set, Func <T, bool> pred) : base(set, pred)
 {
 }
Esempio n. 14
0
    override public bool AddToOctagon(CoreOctagon oct, IMutableSet<int> affectedDimensions)
    {
      bool bInf = this.inf.AddToOctagon(oct, affectedDimensions);
      bool bSup = this.sup.AddToOctagon(oct, affectedDimensions);

      return bInf || bSup;
    }
Esempio n. 15
0
 private void FindReachable(IMutableSet reach, CfgBlock current, NormalFlowBlockNavigator nfnav) {
   if (reach.Contains(current)) return;
   reach.Add(current);
   foreach (CfgBlock next in nfnav.NextNodes(current)) {
     FindReachable(reach, next, nfnav);
   }
   // also follow exceptional path
   CfgBlock handler = (CfgBlock)this.b2exception_handler[current];
   if (handler != null) {
     FindReachable(reach, handler, nfnav);
   }
 }
Esempio n. 16
0
 ///<summary>
 /// Add this constraint to the octagon passed as parameter
 /// </summary>
 ///<param name="oct">the octagon where to add the constraint</param>
 ///<param name="affectedDimensions">The dimensions affected by the constraints</param>
 ///<returns>true iff the constraint has been added</returns>
 abstract public bool AddToOctagon(CoreOctagon oct, IMutableSet <int> affectedDimensions);
Esempio n. 17
0
 public ObservableMutableSet(IMutableSet <T> set)
 {
     this.set = set;
 }
Esempio n. 18
0
 public Unit Box(Expression pc, Type type, Variable dest, Expression source, IMutableSet <Expression> data)
 {
     Recurse(source, data);
     return(Unit.Value);
 }
Esempio n. 19
0
    ///<summary>
    /// Add this constraint to the octagon
    ///</summary>
    override public bool AddToOctagon(CoreOctagon oct, IMutableSet<int> affectedDimensions)
    {
      int j = 2 * this.x + 1;
      int i = 2 * this.x;

      affectedDimensions.Add(this.x);

      try
      {
        Rational c = this.c * 2;

        if (Rational.Min(c, oct.octagon[Matpos2(i, j)]) == c)
        {
          oct.octagon[Matpos2(i, j)] = c;
          return true;
        }
      }
      catch (ArithmeticExceptionRational)
      {
        // We could not add the constraint because of an arithmetic exception

        return false;
      }

      return false;
    }
Esempio n. 20
0
 public static IObservableMutableSet <T> ToObservable <T>(this IMutableSet <T> set) => new ObservableMutableSet <T>(set);