コード例 #1
0
ファイル: d.c プロジェクト: zeotrope/j7-src
static void dwrq(A w){
 if(all1(match(alp,w)))jputs(nflag?" a.":"a.");
 else{C q=CQUOTE;
  jputc(q);
  if(w){C*p=CAV(w); DO(AN(w), if(q==p[i])jputc(q); jputc(p[i]));}
  jputc(q);
}}
コード例 #2
0
ファイル: union.hpp プロジェクト: Gecode/gecode
  ExecStatus
  UnionN<View0,View1>::propagate(Space& home, const ModEventDelta& med) {    
    ModEvent me0 = View0::me(med);
    ModEvent me1 = View1::me(med);
    bool ubevent = Rel::testSetEventUB(me0, me1);
    bool lbevent = Rel::testSetEventLB(me0, me1);
    bool anybevent = Rel::testSetEventAnyB(me0, me1);
    bool cardevent = Rel::testSetEventCard(me0, me1);

    bool modified = false;
    bool oldModified = false;

    do {
      do {
        oldModified = modified;
        modified = false;
        if (modified || oldModified || ubevent)
          GECODE_ES_CHECK(unionNXiUB(home, modified, x, y,unionOfDets));
        if (modified || oldModified || ubevent)
          GECODE_ES_CHECK(partitionNYUB(home, modified, x, y,unionOfDets));
        if (modified || oldModified || anybevent)
          GECODE_ES_CHECK(partitionNXiLB(home, modified, x, y,unionOfDets));
        if (modified || oldModified || lbevent)
          GECODE_ES_CHECK(partitionNYLB(home, modified, x, y,unionOfDets));
        if (modified || oldModified || cardevent || ubevent) {
          GECODE_ES_CHECK(unionNCard(home, modified, x, y, unionOfDets));
        }
      } while (modified);

      for(int i=0;i<x.size();i++){
        //Do not reverse! Eats away the end of the array!
        while (i<x.size() && x[i].assigned()) {
          GlbRanges<View0> det(x[i]);
          unionOfDets.includeI(home,det);
          x.move_lst(i);
          modified = true;
        }
      }
      
    } while (modified);
    // When we run out of variables, make a final check and disolve:
    if (x.size()==0) {
      BndSetRanges all1(unionOfDets);
      GECODE_ME_CHECK( y.intersectI(home,all1) );
      BndSetRanges all2(unionOfDets);
      GECODE_ME_CHECK( y.includeI(home,all2) );
      unionOfDets.dispose(home);
      return home.ES_SUBSUMED(*this);
    }

    return shared ? ES_NOFIX : ES_FIX;
  }