public void resolveConflictsRecursively(Automaton candidateAutomaton, Constraint candidateCon) { if (isConstraintAlreadyChecked(candidateCon)) { logger.trace(candidateCon + " was already checked"); return; } else { conflictChecksPerformed++; blackboard.add(candidateCon); } logger.trace( "Checking conflict with " + candidateCon + ": Conjuncting the safe automaton with Reg.exp: " + candidateCon.getRegularExpression()); Automaton auxAutomaton = this.intersect(this.safeAutomaton, candidateAutomaton); Constraint relaxedCon = null; if (isAutomatonEmpty(auxAutomaton)) { logger.warn(candidateCon + " conflicts with the existing safe automaton!"); // logger.warn("Current set of safe constraints: " + this.safeProcess.bag); conflictingConstraints.add(candidateCon); relaxedCon = candidateCon.getConstraintWhichThisIsBasedUpon(); if (relaxedCon == null) { relaxedCon = candidateCon.suggestConstraintWhichThisShouldBeBasedUpon(); if (relaxedCon != null) { relaxedCon = candidateCon.createConstraintWhichThisShouldBeBasedUpon(); logger.trace( relaxedCon + " included in process model as relaxation, replacing " + candidateCon); } } if (relaxedCon == null || relaxedCon == candidateCon) { logger.warn(candidateCon + " has to be removed at once"); } else { logger.trace(candidateCon + " relaxed to " + relaxedCon); resolveConflictsRecursively( new RegExp(relaxedCon.getRegularExpression()).toAutomaton(), relaxedCon); } if (candidateCon.getSubFamily().equals(RelationConstraintSubFamily.COUPLING)) { MutualRelationConstraint coCandidateCon = (MutualRelationConstraint) candidateCon; Constraint forwardCon = coCandidateCon.getForwardConstraint(), backwardCon = coCandidateCon.getBackwardConstraint(); if (forwardCon != null && backwardCon != null) { logger.trace( "Splitting the coupling relation constraint " + coCandidateCon + " into " + coCandidateCon.getForwardConstraint() + " and " + coCandidateCon.getBackwardConstraint()); this.resolveConflictsRecursively( new RegExp(forwardCon.getRegularExpression()).toAutomaton(), forwardCon); this.resolveConflictsRecursively( new RegExp(backwardCon.getRegularExpression()).toAutomaton(), backwardCon); } } } else { safeAutomaton = auxAutomaton; // System.out.println("PRESENTATION -- Safe automaton so far: " + safeAutomaton.toDot()); safeProcess.bag.add(candidateCon.getBase(), candidateCon); } }