Ejemplo n.º 1
0
        /**
         * Provides an iterator pointing after the last APElement
         * in the subset represented by the APMonom <i>m</i>.
         * @param ap_set the underlying APSet
         * @param m the APMonom over which we iterate
         * @return the iterator.
         */
        public static APMonom2APElements end(APSet ap_set, APMonom m)
        {
            APMonom2APElements m2e = new APMonom2APElements(ap_set, m);

            m2e._end_marker = true;
            return(m2e);
        }
Ejemplo n.º 2
0
 /**
  * Constructor that generates an iterator pointing
  * to a specific APElement.
  * @param ap_set the underlying APSet
  * @param m the APMonom over which we iterate
  * @param cur_e the current APElement
  */
 public APMonom2APElements(APSet ap_set, APMonom m, APElement cur_e)
 {
     _ap_set = ap_set;
     _m = m;
     _cur_e = cur_e;
     _end_marker = false;
     if (m.isFalse())
     {
         _end_marker = true;
     }
 }
Ejemplo n.º 3
0
 /**
  * Constructor that generates an iterator pointing
  * to a specific APElement.
  * @param ap_set the underlying APSet
  * @param m the APMonom over which we iterate
  * @param cur_e the current APElement
  */
 public APMonom2APElements(APSet ap_set, APMonom m, APElement cur_e)
 {
     _ap_set     = ap_set;
     _m          = m;
     _cur_e      = cur_e;
     _end_marker = false;
     if (m.isFalse())
     {
         _end_marker = true;
     }
 }
Ejemplo n.º 4
0
        /**
         * Constructor that generates an iterator pointing to the first
         * APElement.
         * @param ap_set the underlying APSet
         * @param m the APMonom over which we iterate
         */
        public APMonom2APElements(APSet ap_set, APMonom m)
        {
            _ap_set = ap_set;
            _m = m;
            _cur_e = new APElement(m.getValueBits());
            _end_marker = false;

            if (m.isFalse())
            {
                _end_marker = true;
            }
        }
Ejemplo n.º 5
0
        /**
         * Constructor that generates an iterator pointing to the first
         * APElement.
         * @param ap_set the underlying APSet
         * @param m the APMonom over which we iterate
         */
        public APMonom2APElements(APSet ap_set, APMonom m)
        {
            _ap_set     = ap_set;
            _m          = m;
            _cur_e      = new APElement(m.getValueBits());
            _end_marker = false;

            if (m.isFalse())
            {
                _end_marker = true;
            }
        }
Ejemplo n.º 6
0
 /**
  * Calls Functor::operator(APMonom& m) for each monom of the formula.
  * Formula has to be in DNF!
  */
 //template <class Functor>
 public void forEachMonom(EdgeCreator f)
 {
     if (getType() == type_t.T_OR)
     {
         getLeft().forEachMonom(f);
         getRight().forEachMonom(f);
     }
     else
     {
         APMonom m = this.toMonom();
         f.apply(m);
     }
 }
Ejemplo n.º 7
0
        /** Add an edge. */
        public void addEdge(APMonom label, NBA_State state)
        {
            APSet ap_set = _state.getGraph().getAPSet();

            APMonom2APElements start = APMonom2APElements.begin(ap_set, label);

            //for (APMonom2APElements it=APMonom2APElements::begin(ap_set, label);it!=APMonom2APElements::end(ap_set, label);++it)
            while (!start.equal(APMonom2APElements.end(ap_set, label)))///////////////***********note sth wrong here don't skip sth extra
            {
                APElement it = start._cur_e;
                addEdge(it, state);
                start.increment();
            }
        }
Ejemplo n.º 8
0
        /** Returns an APMonom representing the formula rooted at
         * this node. Formula has to be in DNF. */
        APMonom toMonom()
        {
            APMonom result = APMonom.TRUE;

            switch (getType())
            {
            case type_t.T_AND:
            {
                APMonom left  = getLeft().toMonom();
                APMonom right = getRight().toMonom();

                result = left & right;
                return(result);
            }

            case type_t.T_NOT:
                switch (getLeft().getType())
                {
                case type_t.T_AP:
                    result.setValue(getLeft().getAP(), false);
                    return(result);

                case type_t.T_FALSE:
                    result = APMonom.TRUE;
                    return(result);

                case type_t.T_TRUE:
                    result = APMonom.FALSE;
                    return(result);

                default:
                    throw new Exception("Formula not in DNF!");
                }

            case type_t.T_AP:
                result.setValue(getAP(), true);
                return(result);

            case type_t.T_FALSE:
                result = APMonom.FALSE;
                return(result);

            case type_t.T_TRUE:
                result = APMonom.TRUE;
                return(result);

            default:
                throw new Exception("Formula not in DNF!");
            }
        }
Ejemplo n.º 9
0
        /**
         * Performs an intersection check.
         * @param m1 the first APMonom
         * @param m2 the second APMonom
         * @return <b>true</b> if the intersection of <i>m1</i> and <i>m2</i> is empty.
         */
        public static bool isIntersectionEmpty(APMonom m1, APMonom m2)
        {
            // check if there are contradicting values
            int set_in_both = m1.getSetBits().bitset & m2.getSetBits().bitset;

            if ((m1.getValueBits().bitset & set_in_both) != (m2.getValueBits().bitset & set_in_both))
            {
                // contradiction
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 10
0
 public void apply(APMonom m)
 {
     _nba.nba_i_addEdge(_from, m, _to);
 }
Ejemplo n.º 11
0
        /** 
 * Add edge(s) from this state to the other state
 * @param monom an APMonom for the label(s)
 * @param to_state the target state
 */
        public void addEdge(APMonom monom, NBA_State to_state)
        {
            _edge_manager.addEdge(monom, to_state);
        }
Ejemplo n.º 12
0
 public void apply(APMonom m)
 {
     _nba.nba_i_addEdge(_from, m, _to);
 }
Ejemplo n.º 13
0
  /** Add an edge. */
  public void addEdge(APMonom label, NBA_State state) {
    APSet ap_set=_state.getGraph().getAPSet();

      APMonom2APElements start = APMonom2APElements.begin(ap_set, label);
        //for (APMonom2APElements it=APMonom2APElements::begin(ap_set, label);it!=APMonom2APElements::end(ap_set, label);++it) 
      while (!start.equal(APMonom2APElements.end(ap_set, label)))///////////////***********note sth wrong here don't skip sth extra
      {
          APElement it = start._cur_e;
          addEdge(it, state);
          start.increment();
      }
  }
Ejemplo n.º 14
0
 /**
  * Constructor.
  * @param set_bits integer representation of the bits which are set
  * @param value_bits integer representation of the value bits
  */
 public void SetAPMonom(APMonom AP)
 {
     //APMonmType = AP.APMonmType;
     bits_set.set(AP.bits_set.bitset);
     bits_value.set(AP.bits_value.bitset);
 }
Ejemplo n.º 15
0
 /**
  * Add an edge from state <i>from</i> to state <i>to</i>
  * for the edges covered by the APMonom.
  * @param from the index of the 'from' state
  * @param m the APMonom
  * @param to the index of the 'to' state
  */
 public void nba_i_addEdge(int from, APMonom m, int to)
 {
     this[from].addEdge(m, this[to]);
 }
Ejemplo n.º 16
0
 /**
  * Add edge(s) from this state to the other state
  * @param monom an APMonom for the label(s)
  * @param to_state the target state
  */
 public void addEdge(APMonom monom, NBA_State to_state)
 {
     _edge_manager.addEdge(monom, to_state);
 }
Ejemplo n.º 17
0
        /**
           * Performs an intersection check.
           * @param m1 the first APMonom
           * @param m2 the second APMonom
           * @return <b>true</b> if the intersection of <i>m1</i> and <i>m2</i> is empty.
           */
        public static bool isIntersectionEmpty(APMonom m1, APMonom m2)
        {
            // check if there are contradicting values
            int set_in_both = m1.getSetBits().bitset & m2.getSetBits().bitset;

            if ((m1.getValueBits().bitset & set_in_both) != (m2.getValueBits().bitset & set_in_both))
            {
                // contradiction
                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 18
0
 /**
  * Provides an iterator pointing to the first APElement
  * in the subset represented by the APMonom <i>m</i>.
  * @param ap_set the underlying APSet
  * @param m the APMonom over which we iterate
  * @return the iterator.
  */
 public static APMonom2APElements begin(APSet ap_set, APMonom m)
 {
     return new APMonom2APElements(ap_set, m);
 }
Ejemplo n.º 19
0
 /**
  * Add an edge from state <i>from</i> to state <i>to</i>
  * for the edges covered by the APMonom.
  * @param from the index of the 'from' state
  * @param m the APMonom
  * @param to the index of the 'to' state
  */
 public void nba_i_addEdge(int from, APMonom m, int to)
 {
     this[from].addEdge(m, this[to]);
 }
Ejemplo n.º 20
0
 /**
  * Provides an iterator pointing after the last APElement
  * in the subset represented by the APMonom <i>m</i>.
  * @param ap_set the underlying APSet
  * @param m the APMonom over which we iterate
  * @return the iterator.
  */
 public static APMonom2APElements end(APSet ap_set, APMonom m)
 {
     APMonom2APElements m2e = new APMonom2APElements(ap_set, m);
     m2e._end_marker = true;
     return m2e;
 }
Ejemplo n.º 21
0
 /**
 * Constructor.
 * @param set_bits integer representation of the bits which are set
 * @param value_bits integer representation of the value bits
 */
 public void SetAPMonom(APMonom AP)
 {
     //APMonmType = AP.APMonmType;
     bits_set.set(AP.bits_set.bitset);
     bits_value.set(AP.bits_value.bitset);
 }
Ejemplo n.º 22
0
 /**
  * Provides an iterator pointing to the first APElement
  * in the subset represented by the APMonom <i>m</i>.
  * @param ap_set the underlying APSet
  * @param m the APMonom over which we iterate
  * @return the iterator.
  */
 public static APMonom2APElements begin(APSet ap_set, APMonom m)
 {
     return(new APMonom2APElements(ap_set, m));
 }