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

Method copy

gecode/int/bool/clause.hpp:66–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65 template<class VX, class VY>
66 Actor*
67 ClauseTrue<VX,VY>::copy(Space& home) {
68 {
69 int n = x.size();
70 if (n > 0) {
71 // Eliminate all zeros and find a one
72 for (int i=n; i--; )
73 if (x[i].one()) {
74 // Only keep the one
75 x[0]=x[i]; n=1; break;
76 } else if (x[i].zero()) {
77 // Eliminate the zero
78 x[i]=x[--n];
79 }
80 x.size(n);
81 }
82 }
83 {
84 int n = y.size();
85 if (n > 0) {
86 // Eliminate all zeros and find a one
87 for (int i=n; i--; )
88 if (y[i].one()) {
89 // Only keep the one
90 y[0]=y[i]; n=1; break;
91 } else if (y[i].zero()) {
92 // Eliminate the zero
93 y[i]=y[--n];
94 }
95 y.size(n);
96 }
97 }
98 if ((x.size() == 0) && (y.size() == 0))
99 return new (home) BinOrTrue<VX,VY>(home,*this,x0,x1);
100 else
101 return new (home) ClauseTrue<VX,VY>(home,*this);
102 }
103
104 template<class VX, class VY>
105 inline ExecStatus

Callers

nothing calls this directly

Calls 4

eliminate_zeroFunction · 0.70
sizeMethod · 0.45
oneMethod · 0.45
zeroMethod · 0.45

Tested by

no test coverage detected