/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package CREATOR_CONDICTIONS_RULES;
import LOGIC.Contract;
import LOGIC.Instance;
import java.util.LinkedList;
/**
*
* @author sarah
*/
public class CreatorRenameFunction {
private String renameFunction = "";
private LinkedList<Instance> instance;
private Contract contract;
public CreatorRenameFunction(LinkedList<Instance> i) {
this.instance = i;
}
public String creatorRenameFunction() {
renameFunction = renameFunction + "\n";
for (Instance instance1 : instance) {
contract = instance1.getContrato();
//
System.out.println("CANAIS DA RENOMEAÇÃO");
for (int i = 0; i < contract.getChannel().size(); i++) {
System.out.println(contract.getChannel().get(i).getName());
}
System.out.println("CANAIS DA RENOMEAÇÃO- INSTANCIA");
for (int i = 0; i < instance1.getChannel().size(); i++) {
System.out.println(instance1.getChannel().get(i).getName());
}
renameFunction = renameFunction + "Inst_" + instance1.getName() + " = <";
for (int i = 0; i < contract.getChannel().size(); i++) {
if (i == contract.getChannel().size() - 1) {
renameFunction = renameFunction + "("
+ contract.getChannel().get(i).getName() + ","
+ instance1.getChannel().get(i).getName() + ")";
} else {
renameFunction = renameFunction + "("
+ contract.getChannel().get(i).getName() + ","
+ instance1.getChannel().get(i).getName() + "),";
}
}
renameFunction = renameFunction + "> \n";
renameFunction = renameFunction + instance1.getName()
+ " = rename(" + contract.getName() + ", Inst_"
+ instance1.getName() + ") \n\n";
}
return renameFunction;
}
}