Package util.procedure

Examples of util.procedure.IntProcedure


        super(ArrayUtils.append(bvars, new IntVar[]{aVar}), PropagatorPriority.UNARY, true);
        assert aVar.hasEnumeratedDomain();
        this.n = bvars.length;
        this.offSet = offSet;
        this.idm = this.vars[n].monitorDelta(this);
        this.rem_proc = new IntProcedure() {
            @Override
            public void execute(int i) throws ContradictionException {
                vars[i - offSet].instantiateTo(0, aCause);
            }
        };
View Full Code Here


        sdm = new ISetDeltaMonitor[k + 1];
        for (int i = 0; i <= k; i++) {
            sdm[i] = this.vars[i].monitorDelta(this);
        }
        // PROCEDURES
        intersectionForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                for (int i = 0; i < k; i++) {
                    vars[i].addToKernel(element, aCause);
                }
            }
        };
        intersectionRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                int mate = -1;
                for (int i = 0; i < k; i++)
                    if (vars[i].envelopeContains(element)) {
                        if (!vars[i].kernelContains(element)) {
                            if (mate == -1) {
                                mate = i;
                            } else {
                                mate = -2;
                                break;
                            }
                        }
                    } else {
                        mate = -2;
                        break;
                    }
                if (mate == -1) {
                    contradiction(vars[k], "");
                } else if (mate != -2) {
                    vars[mate].removeFromEnvelope(element, aCause);
                }
            }
        };
        setForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                boolean allKer = true;
                for (int i = 0; i < k; i++) {
                    if (!vars[i].envelopeContains(element)) {
                        vars[k].removeFromEnvelope(element, aCause);
                        allKer = false;
                        break;
                    } else if (!vars[i].kernelContains(element)) {
                        allKer = false;
                    }
                }
                if (allKer) {
                    vars[k].addToKernel(element, aCause);
                }
            }
        };
        setRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                vars[k].removeFromEnvelope(element, aCause);
            }
        };
View Full Code Here

        this.iv = (IntVar) vars[1];
        this.sdm = set.monitorDelta(this);
        IEnvironment environment = solver.getEnvironment();
        watchLit1 = environment.makeInt(iv.getLB() - 1);
        watchLit2 = environment.makeInt(iv.getLB() - 1);
        elemRem = new IntProcedure() {
            @Override
            public void execute(int i) throws ContradictionException {
                iv.removeValue(i, aCause);
            }
        };
View Full Code Here

        sdm = new ISetDeltaMonitor[k + 1];
        for (int i = 0; i <= k; i++) {
            sdm[i] = this.vars[i].monitorDelta(this);
        }
        // PROCEDURES
        unionForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                int mate = -1;
                for (int i = 0; i < k && mate != -2; i++) {
                    if (vars[i].envelopeContains(element)) {
                        if (mate == -1) {
                            mate = i;
                        } else {
                            mate = -2;
                        }
                    }
                }
                if (mate == -1) {
                    contradiction(vars[k], "");
                } else if (mate != -2) {
                    vars[mate].addToKernel(element, aCause);
                }
            }
        };
        unionRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                for (int i = 0; i < k; i++) {
                    vars[i].removeFromEnvelope(element, aCause);
                }
            }
        };
        setForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                vars[k].addToKernel(element, aCause);
            }
        };
        setRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                if (vars[k].envelopeContains(element)) {
                    int mate = -1;
                    for (int i = 0; i < k && mate != -2; i++) {
View Full Code Here

        // delta monitors
        sdm = new ISetDeltaMonitor[n + n2];
        for (int i = 0; i < n + n2; i++) {
            sdm[i] = this.vars[i].monitorDelta(this);
        }
        elementForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                toFilter[element - offSet].addToKernel(idx, aCause);
            }
        };
        elementRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                toFilter[element - offSet].removeFromEnvelope(idx, aCause);
            }
        };
View Full Code Here

        }
        this.set = (SetVar) vars[n];
        this.sdm = this.set.monitorDelta(this);
        this.offSet = offSet;
        // PROCEDURES
        setForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                bools[element - offSet].setToTrue(aCause);
            }
        };
        setRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                bools[element - offSet].setToFalse(aCause);
            }
        };
View Full Code Here

        // delta monitors
        sdm = new ISetDeltaMonitor[2];
        for (int i = 0; i < 2; i++) {
            sdm[i] = this.vars[i].monitorDelta(this);
        }
        elementForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                vars[1].addToKernel(element, aCause);
            }
        };
        elementRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                vars[0].removeFromEnvelope(element, aCause);
            }
        };
View Full Code Here

        for (int i = 0; i < nSets; i++) {
            this.sets[i] = (SetVar) vars[i];
            this.sdm[i] = this.sets[i].monitorDelta(this);
        }
        // procedures
        elementForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                ints[element - offSet2].instantiateTo(idx, aCause);
            }
        };
        elementRemoved = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                ints[element - offSet2].removeValue(idx, aCause);
            }
        };
        valRem = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                sets[element - offSet1].removeFromEnvelope(idx, aCause);
            }
        };
View Full Code Here

        super(new SetVar[]{set1, set2}, PropagatorPriority.UNARY, true);
        this.offSet = offSet;
        sdm = new ISetDeltaMonitor[2];
        sdm[0] = vars[0].monitorDelta(this);
        sdm[1] = vars[1].monitorDelta(this);
        this.forced = new IntProcedure() {
            @Override
            public void execute(int i) throws ContradictionException {
                tmpSet.addToKernel(i + tmp, aCause);
            }
        };
        this.removed = new IntProcedure() {
            @Override
            public void execute(int i) throws ContradictionException {
                tmpSet.removeFromEnvelope(i + tmp, aCause);
            }
        };
View Full Code Here

        // delta monitors
        sdm = new ISetDeltaMonitor[n];
        for (int i = 0; i < n; i++) {
            sdm[i] = this.vars[i].monitorDelta(this);
        }
        elementForced = new IntProcedure() {
            @Override
            public void execute(int element) throws ContradictionException {
                for (int i = 0; i < n; i++) {
                    if (i != currentSet) {
                        vars[i].removeFromEnvelope(element, aCause);
View Full Code Here

TOP

Related Classes of util.procedure.IntProcedure

Copyright © 2018 www.massapicom. 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.