1 /* Copyright (c) 2015 Regents of the University of California
3 * Author: Brian Demsky <bdemsky@uci.edu>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
10 #include "valuerecord.h"
12 #include "constraint.h"
16 ValueRecord::ValueRecord(IntHashSet *_set) : set(_set)
18 uint numvalue=set->getSize();
19 numvars=NUMBITS(numvalue-1);
22 ValueRecord::~ValueRecord() {
25 uint64_t ValueRecord::getValue(Constraint **vars, bool *satsolution) {
27 for(int j=numvars-1;j>=0;j--) {
29 if (satsolution[vars[j]->getVar()])
33 IntIterator * it=set->iterator();
34 while(it->hasNext()) {
35 uint64_t val=it->next();
50 Constraint * ValueRecord::getValueEncoding(Constraint **vars, uint64_t value) {
52 IntIterator * it=set->iterator();
53 while(it->hasNext()) {
54 if (it->next()==value) {
59 return generateConstraint(numvars, vars, i);