MCPcopy Create free account
hub / github.com/Gecode/gecode / count

Function count

gecode/int/count.cpp:39–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37namespace Gecode {
38
39 void
40 count(Home home, const IntVarArgs& x, int n,
41 IntRelType irt, int m, IntPropLevel) {
42 using namespace Int;
43 Limits::check(n,"Int::count");
44 Limits::check(m,"Int::count");
45
46 GECODE_POST;
47
48 ViewArray<IntView> xv(home,x);
49 ConstIntView y(n);
50
51 switch (irt) {
52 case IRT_EQ:
53 GECODE_ES_FAIL((Count::EqInt<IntView,ConstIntView>
54 ::post(home,xv,y,m)));
55 break;
56 case IRT_NQ:
57 {
58 IntVar z(home,0,x.size());
59 GECODE_ME_FAIL(IntView(z).nq(home,m));
60 GECODE_ES_FAIL((Count::EqView<IntView,ConstIntView,IntView,true,false>
61 ::post(home,xv,y,z,0)));
62 }
63 break;
64 case IRT_LE:
65 m--; // FALL THROUGH
66 case IRT_LQ:
67 GECODE_ES_FAIL((Count::LqInt<IntView,ConstIntView>
68 ::post(home,xv,y,m)));
69 break;
70 case IRT_GR:
71 m++; // FALL THROUGH
72 case IRT_GQ:
73 GECODE_ES_FAIL((Count::GqInt<IntView,ConstIntView>
74 ::post(home,xv,y,m)));
75 break;
76 default:
77 throw UnknownRelation("Int::count");
78 }
79 }
80
81 void
82 count(Home home, const IntVarArgs& x, IntVar y,

Callers

nothing calls this directly

Calls 8

IntViewClass · 0.70
OffsetViewClass · 0.70
checkFunction · 0.50
postFunction · 0.50
sizeMethod · 0.45
nqMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected