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

Function vs2is

gecode/flatzinc/flatzinc.cpp:356–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354#endif
355
356 IntSet vs2is(IntVarSpec* vs) {
357 if (vs->assigned) {
358 return IntSet(vs->i,vs->i);
359 }
360 if (vs->domain()) {
361 AST::SetLit* sl = vs->domain.some();
362 if (sl->interval) {
363 return IntSet(sl->min, sl->max);
364 } else {
365 int* newdom = heap.alloc<int>(static_cast<unsigned long int>(sl->s.size()));
366 for (int i=sl->s.size(); i--;)
367 newdom[i] = sl->s[i];
368 IntSet ret(newdom, sl->s.size());
369 heap.free(newdom, static_cast<unsigned long int>(sl->s.size()));
370 return ret;
371 }
372 }
373 return IntSet(Int::Limits::min, Int::Limits::max);
374 }
375
376 int vs2bsl(BoolVarSpec* bs) {
377 if (bs->assigned) {

Callers 1

newIntVarMethod · 0.85

Calls 5

IntSetClass · 0.85
someMethod · 0.80
domainMethod · 0.45
sizeMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected