// Path: src/main/java/org/chocosolver/graphsolver/variables/delta/GraphDelta.java
// public class GraphDelta extends TimeStampedObject implements IDelta {
// 
// 	//NR NE AR AE : NodeRemoved NodeEnforced ArcRemoved ArcEnforced
// 	public final static int NR = 0;
// 	public final static int NE = 1;
// 	public final static int AR_TAIL = 2;
// 	public final static int AR_HEAD = 3;
// 	public final static int AE_TAIL = 4;
// 	public final static int AE_HEAD = 5;
// 	public final static int NB = 6;
// 
// 	//***********************************************************************************
// 	// VARIABLES
// 	//***********************************************************************************
// 
// 	private IEnumDelta[] deltaOfType;
// 
// 	//***********************************************************************************
// 	// CONSTRUCTORS
// 	//***********************************************************************************
// 
// 	public GraphDelta(IEnvironment environment) {
// 		super(environment);
// 		deltaOfType = new IEnumDelta[NB];
// 		for (int i = 0; i < NB; i++) {
// 			deltaOfType[i] = new EnumDelta(environment);
// 		}
// 	}
// 
// 	//***********************************************************************************
// 	// METHODS
// 	//***********************************************************************************
// 
// 	public int getSize(int i) {
// 		return deltaOfType[i].size();
// 	}
// 
// 	public void add(int element, int type, ICause cause) {
// 		lazyClear();
// 		deltaOfType[type].add(element, cause);
// 	}
// 
// 	public void lazyClear() {
// 		if (needReset()) {
// 			for (int i = 0; i < NB; i++) {
// 				deltaOfType[i].lazyClear();
// 			}
// 			resetStamp();
// 		}
// 	}
// 
// 	public int get(int index, int type) {
// 		return deltaOfType[type].get(index);
// 	}
// 
// 	public ICause getCause(int index, int type) {
// 		return deltaOfType[type].getCause(index);
// 	}
// }


import org.chocosolver.solver.exception.ContradictionException;
import org.chocosolver.util.objects.graphs.DirectedGraph;
import org.chocosolver.util.objects.setDataStructures.ISet;
import org.chocosolver.graphsolver.variables.delta.GraphDelta;
import org.chocosolver.solver.ICause;
import org.chocosolver.solver.Model;
	//***********************************************************************************

	@Override
	public boolean removeArc(int x, int y, ICause cause) throws ContradictionException {
		assert cause != null;
		if (LB.arcExists(x, y)) {
			this.contradiction(cause, "remove mandatory arc " + x + "->" + y);
			return false;
		}
		if (UB.removeArc(x, y)) {
			if (reactOnModification) {
				delta.add(x, GraphDelta.AR_TAIL, cause);
				delta.add(y, GraphDelta.AR_HEAD, cause);
			}
			GraphEventType e = GraphEventType.REMOVE_ARC;
			notifyPropagators(e, cause);
			return true;
		}
		return false;
	}

	@Override
	public boolean enforceArc(int x, int y, ICause cause) throws ContradictionException {
		assert cause != null;
		enforceNode(x, cause);
		enforceNode(y, cause);
		if (UB.arcExists(x, y)) {
			if (LB.addArc(x, y)) {
				if (reactOnModification) {
					delta.add(x, GraphDelta.AE_TAIL, cause);
// Path: src/main/java/org/chocosolver/graphsolver/variables/delta/GraphDelta.java
// public class GraphDelta extends TimeStampedObject implements IDelta {
// 
// 	//NR NE AR AE : NodeRemoved NodeEnforced ArcRemoved ArcEnforced
// 	public final static int NR = 0;
// 	public final static int NE = 1;
// 	public final static int AR_TAIL = 2;
// 	public final static int AR_HEAD = 3;
// 	public final static int AE_TAIL = 4;
// 	public final static int AE_HEAD = 5;
// 	public final static int NB = 6;
// 
// 	//***********************************************************************************
// 	// VARIABLES
// 	//***********************************************************************************
// 
// 	private IEnumDelta[] deltaOfType;
// 
// 	//***********************************************************************************
// 	// CONSTRUCTORS
// 	//***********************************************************************************
// 
// 	public GraphDelta(IEnvironment environment) {
// 		super(environment);
// 		deltaOfType = new IEnumDelta[NB];
// 		for (int i = 0; i < NB; i++) {
// 			deltaOfType[i] = new EnumDelta(environment);
// 		}
// 	}
// 
// 	//***********************************************************************************
// 	// METHODS
// 	//***********************************************************************************
// 
// 	public int getSize(int i) {
// 		return deltaOfType[i].size();
// 	}
// 
// 	public void add(int element, int type, ICause cause) {
// 		lazyClear();
// 		deltaOfType[type].add(element, cause);
// 	}
// 
// 	public void lazyClear() {
// 		if (needReset()) {
// 			for (int i = 0; i < NB; i++) {
// 				deltaOfType[i].lazyClear();
// 			}
// 			resetStamp();
// 		}
// 	}
// 
// 	public int get(int index, int type) {
// 		return deltaOfType[type].get(index);
// 	}
// 
// 	public ICause getCause(int index, int type) {
// 		return deltaOfType[type].getCause(index);
// 	}
// }


// Path: src/main/java/org/chocosolver/graphsolver/variables/DirectedGraphVar.java
import org.chocosolver.solver.exception.ContradictionException;
import org.chocosolver.util.objects.graphs.DirectedGraph;
import org.chocosolver.util.objects.setDataStructures.ISet;
import org.chocosolver.graphsolver.variables.delta.GraphDelta;
import org.chocosolver.solver.ICause;
import org.chocosolver.solver.Model;

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

	@Override
	public boolean removeArc(int x, int y, ICause cause) throws ContradictionException {
		assert cause != null;
		if (LB.arcExists(x, y)) {
			this.contradiction(cause, "remove mandatory arc " + x + "->" + y);
			return false;
		}
		if (UB.removeArc(x, y)) {
			if (reactOnModification) {
				delta.add(x, GraphDelta.AR_TAIL, cause);
				delta.add(y, GraphDelta.AR_HEAD, cause);
			}
			GraphEventType e = GraphEventType.REMOVE_ARC;
			notifyPropagators(e, cause);
			return true;
		}
		return false;
	}

	@Override
	public boolean enforceArc(int x, int y, ICause cause) throws ContradictionException {
		assert cause != null;
		enforceNode(x, cause);
		enforceNode(y, cause);
		if (UB.arcExists(x, y)) {
			if (LB.addArc(x, y)) {
				if (reactOnModification) {
					delta.add(x, GraphDelta.AE_TAIL, cause);
					delta.add(y, GraphDelta.AE_HEAD, cause);