Examples of SetVar


Examples of it.stefanobertini.zebra.cpcl.config.SetVar

public class SetVarTest {

    @Test
    public void test() {
  SetVar command = new SetVar(ConfigurationKey.commBaud, "9600");

  CommandOutputBuilder output = new CommandOutputBuilder();
  output.printLn("! U1 setvar \"comm.baud\" \"9600\"");

  assertCommand(output, command);
View Full Code Here

Examples of it.stefanobertini.zebra.cpcl.config.SetVar

  assertCommand(output, command);
    }

    @Test(expected = RuntimeException.class)
    public void testBadKey() {
  new SetVar(ConfigurationKey.deviceReset, "");
    }
View Full Code Here

Examples of it.stefanobertini.zebra.cpcl.config.SetVar

  new SetVar(ConfigurationKey.deviceReset, "");
    }

    @Test(expected = RuntimeException.class)
    public void testNullKey() {
  new SetVar(null, "");
    }
View Full Code Here

Examples of it.stefanobertini.zebra.cpcl.config.SetVar

  new SetVar(null, "");
    }

    @Test
    public void testToSting() {
  new SetVar(ConfigurationKey.commBaud, "9600").toString();
    }
View Full Code Here

Examples of solver.variables.SetVar

    // METHODS
    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        SetVar intersection = vars[k];
        if (PropagatorEventType.isFullPropagation(evtmask)) {
            for (int j = vars[0].getKernelFirst(); j != SetVar.END; j = vars[0].getKernelNext()) {
                boolean all = true;
                for (int i = 1; i < k; i++) {
                    if (!vars[i].kernelContains(j)) {
                        all = false;
                        break;
                    }
                }
                if (all) {
                    intersection.addToKernel(j, aCause);
                }
            }
            for (int j = intersection.getEnvelopeFirst(); j != SetVar.END; j = intersection.getEnvelopeNext()) {
                if (intersection.kernelContains(j)) {
                    for (int i = 0; i < k; i++) {
                        vars[i].addToKernel(j, aCause);
                    }
                } else {
                    for (int i = 0; i < k; i++)
                        if (!vars[i].envelopeContains(j)) {
                            intersection.removeFromEnvelope(j, aCause);
                            break;
                        }
                }
            }
            // ------------------
View Full Code Here

Examples of solver.variables.SetVar

            for (int i = 0; i < size; i++) {
                vars[i].duplicate(solver, identitymap);
                svars[i] = (SetVar) identitymap.get(vars[i]);
            }
            vars[k].duplicate(solver, identitymap);
            SetVar I = (SetVar) identitymap.get(vars[k]);
            identitymap.put(this, new PropIntersection(svars, I));
        }
    }
View Full Code Here

Examples of solver.variables.SetVar

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            iv.duplicate(solver, identitymap);
            IntVar I = (IntVar) identitymap.get(iv);

            identitymap.put(this, new PropIntMemberSet(S,I));
View Full Code Here

Examples of solver.variables.SetVar

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            card.duplicate(solver, identitymap);
            IntVar C = (IntVar) identitymap.get(card);

            identitymap.put(this, new PropCardinality(S, C));
View Full Code Here

Examples of solver.variables.SetVar

    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        if (PropagatorEventType.isFullPropagation(evtmask)) {
            SetVar union = vars[k];
            for (int i = 0; i < k; i++) {
                for (int j = vars[i].getKernelFirst(); j != SetVar.END; j = vars[i].getKernelNext())
                    union.addToKernel(j, aCause);
                for (int j = vars[i].getEnvelopeFirst(); j != SetVar.END; j = vars[i].getEnvelopeNext())
                    if (!union.envelopeContains(j))
                        vars[i].removeFromEnvelope(j, aCause);
            }
            for (int j = union.getEnvelopeFirst(); j != SetVar.END; j = union.getEnvelopeNext()) {
                if (union.kernelContains(j)) {
                    int mate = -1;
                    for (int i = 0; i < k && mate != -2; i++) {
                        if (vars[i].envelopeContains(j)) {
                            if (mate == -1) {
                                mate = i;
                            } else {
                                mate = -2;
                            }
                        }
                    }
                    if (mate == -1) {
                        contradiction(vars[k], "");
                    } else if (mate != -2) {
                        vars[mate].addToKernel(j, aCause);
                    }
                } else {
                    int mate = -1;
                    for (int i = 0; i < k; i++) {
                        if (vars[i].envelopeContains(j)) {
                            mate = i;
                            break;
                        }
                    }
                    if (mate == -1) union.removeFromEnvelope(j, aCause);
                }
            }
            // ------------------
      for (int i = 0; i <= k; i++)
        sdm[i].unfreeze();
View Full Code Here

Examples of solver.variables.SetVar

            for (int i = 0; i < size; i++) {
                vars[i].duplicate(solver, identitymap);
                svars[i] = (SetVar) identitymap.get(vars[i]);
            }
            vars[size].duplicate(solver, identitymap);
            SetVar svar = (SetVar) identitymap.get(vars[size]);

            identitymap.put(this, new PropUnion(svars, svar));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.