// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ILogger.java
// public interface ILogger {
// 
// 	public void writeInfoMessage(String context, String infoMessage);
// 
// 	public void writeWarningMessage(String context, String warningMessage);
// 
// 	public void writeErrorMessage(String context, String errorMessage);
// 
// 	public void close();
// 
// 	public void close(String path);
// }
// 
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ProcessingException.java
// public class ProcessingException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	public ProcessingException(Throwable e) {
// 		super(e);
// 	}
// 
// 	public ProcessingException(String msg, Throwable th) {
// 		super(msg, th);
// 	}
// 
// 	public ProcessingException(String string) {
// 		super(string);
// 	}
// 
// }


import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Stack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.ocl.Environment;
import org.eclipse.ocl.ecore.CallOperationAction;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.ecore.EcoreEnvironmentFactory;
import org.eclipse.ocl.ecore.SendSignalAction;
import org.eclipse.ocl.expressions.BooleanLiteralExp;
import org.eclipse.ocl.expressions.CollectionItem;
import org.eclipse.ocl.expressions.CollectionLiteralExp;
import org.eclipse.ocl.expressions.IfExp;
import org.eclipse.ocl.expressions.IntegerLiteralExp;
import org.eclipse.ocl.expressions.IteratorExp;
import org.eclipse.ocl.expressions.NullLiteralExp;
import org.eclipse.ocl.expressions.OperationCallExp;
import org.eclipse.ocl.expressions.PropertyCallExp;
import org.eclipse.ocl.expressions.RealLiteralExp;
import org.eclipse.ocl.expressions.StringLiteralExp;
import org.eclipse.ocl.expressions.TypeExp;
import org.eclipse.ocl.expressions.Variable;
import org.eclipse.ocl.expressions.VariableExp;
import org.eclipse.ocl.types.BagType;
import org.eclipse.ocl.types.OrderedSetType;
import org.eclipse.ocl.types.PrimitiveType;
import org.eclipse.ocl.types.SequenceType;
import org.eclipse.ocl.types.SetType;
import org.eclipse.ocl.util.TypeUtil;
import org.eclipse.ocl.utilities.AbstractVisitor;
import org.eclipse.ocl.utilities.ExpressionInOCL;
import org.eclipse.ocl.utilities.PredefinedType;
import org.eclipse.ocl.utilities.TypedElement;
import org.eclipse.ocl.utilities.UMLReflection;
import fr.inria.atlanmod.emftocsp.ILogger;
import fr.inria.atlanmod.emftocsp.ProcessingException;
  }

  @Override
  protected String handleConstraint(Constraint constraint, String specificationResult) {
    return "";
  }

  @Override
  protected String handleExpressionInOCL(ExpressionInOCL<EClassifier, EParameter> callExp, String contextResult, String resultResult, List<String> parameterResults, String bodyResult) {
    String predName = constraintName.substring(0,1).toLowerCase().concat(constraintName.substring(1, constraintName.length()));
    setConstraintFirstPredicate(bodyResult); 
    oclTranslation.append(predName);
    oclTranslation.append("(Instances):-");
    oclTranslation.append("\n\t");
    oclTranslation.append(bodyResult);
    oclTranslation.append("(Instances, [], Result),");
    oclTranslation.append("\n\t");
    oclTranslation.append("Result #=1.\n");    
    return oclTranslation.toString();     
  }
  
  private void setConstraintFirstPredicate(String firstPredicate) {
    this.firstPredicate = firstPredicate;
  }
  
  public String getConstraintFirstPredicate() {
    return firstPredicate;
  }

  
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ILogger.java
// public interface ILogger {
// 
// 	public void writeInfoMessage(String context, String infoMessage);
// 
// 	public void writeWarningMessage(String context, String warningMessage);
// 
// 	public void writeErrorMessage(String context, String errorMessage);
// 
// 	public void close();
// 
// 	public void close(String path);
// }
// 
// Path: plugins/fr.inria.atlanmod.emftocsp/src/fr/inria/atlanmod/emftocsp/ProcessingException.java
// public class ProcessingException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	public ProcessingException(Throwable e) {
// 		super(e);
// 	}
// 
// 	public ProcessingException(String msg, Throwable th) {
// 		super(msg, th);
// 	}
// 
// 	public ProcessingException(String string) {
// 		super(string);
// 	}
// 
// }


// Path: plugins/fr.inria.atlanmod.emftocsp.emftoecl/src/fr/inria/atlanmod/emftocsp/emftoecl/OclToEcl.java
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Stack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.ocl.Environment;
import org.eclipse.ocl.ecore.CallOperationAction;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.ecore.EcoreEnvironmentFactory;
import org.eclipse.ocl.ecore.SendSignalAction;
import org.eclipse.ocl.expressions.BooleanLiteralExp;
import org.eclipse.ocl.expressions.CollectionItem;
import org.eclipse.ocl.expressions.CollectionLiteralExp;
import org.eclipse.ocl.expressions.IfExp;
import org.eclipse.ocl.expressions.IntegerLiteralExp;
import org.eclipse.ocl.expressions.IteratorExp;
import org.eclipse.ocl.expressions.NullLiteralExp;
import org.eclipse.ocl.expressions.OperationCallExp;
import org.eclipse.ocl.expressions.PropertyCallExp;
import org.eclipse.ocl.expressions.RealLiteralExp;
import org.eclipse.ocl.expressions.StringLiteralExp;
import org.eclipse.ocl.expressions.TypeExp;
import org.eclipse.ocl.expressions.Variable;
import org.eclipse.ocl.expressions.VariableExp;
import org.eclipse.ocl.types.BagType;
import org.eclipse.ocl.types.OrderedSetType;
import org.eclipse.ocl.types.PrimitiveType;
import org.eclipse.ocl.types.SequenceType;
import org.eclipse.ocl.types.SetType;
import org.eclipse.ocl.util.TypeUtil;
import org.eclipse.ocl.utilities.AbstractVisitor;
import org.eclipse.ocl.utilities.ExpressionInOCL;
import org.eclipse.ocl.utilities.PredefinedType;
import org.eclipse.ocl.utilities.TypedElement;
import org.eclipse.ocl.utilities.UMLReflection;
import fr.inria.atlanmod.emftocsp.ILogger;
import fr.inria.atlanmod.emftocsp.ProcessingException;

  }

  @Override
  protected String handleConstraint(Constraint constraint, String specificationResult) {
    return "";
  }

  @Override
  protected String handleExpressionInOCL(ExpressionInOCL<EClassifier, EParameter> callExp, String contextResult, String resultResult, List<String> parameterResults, String bodyResult) {
    String predName = constraintName.substring(0,1).toLowerCase().concat(constraintName.substring(1, constraintName.length()));
    setConstraintFirstPredicate(bodyResult); 
    oclTranslation.append(predName);
    oclTranslation.append("(Instances):-");
    oclTranslation.append("\n\t");
    oclTranslation.append(bodyResult);
    oclTranslation.append("(Instances, [], Result),");
    oclTranslation.append("\n\t");
    oclTranslation.append("Result #=1.\n");    
    return oclTranslation.toString();     
  }
  
  private void setConstraintFirstPredicate(String firstPredicate) {
    this.firstPredicate = firstPredicate;
  }
  
  public String getConstraintFirstPredicate() {
    return firstPredicate;
  }

  
  private String getType(TypedElement<EClassifier> exp) throws ProcessingException {