/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package CREATOR_CONDICTIONS_RULES; import CSP_CREATOR.CreatorTypesAndChannels; import LOGIC.Channel; import LOGIC.Instance; import LOGIC.ObjectList; import LOGIC.Protocols; import java.util.LinkedList; /** * * @author sarah */ public class CreatorUnaryRule { private String rule; private String pegaComposicao; private LinkedList instance; private ObjectList obl; private CreatorTypesAndChannels typechannels; private CreatorRenameFunction renameFunction; private CreatorChannelFunctionUnary channelFunction; private CreatorInputFunctionUnary inputFunction; private CreatorOutputFunctionUnary outputFunction; public CreatorUnaryRule(Instance i, ObjectList ob, LinkedList p) { instance = new LinkedList<>(); instance.add(i); obl = ob; typechannels = new CreatorTypesAndChannels(ob); typechannels.creatorTypesChannels(); renameFunction = new CreatorRenameFunction(instance); channelFunction = new CreatorChannelFunctionUnary(i, p); inputFunction = new CreatorInputFunctionUnary(i,p);//Vai receber mais alguma coisa outputFunction = new CreatorOutputFunctionUnary(i,p); } public String getRule() { return rule; } public void setRule(String rule) { this.rule = rule; } public String getPegaComposicao() { return pegaComposicao; } public void setPegaComposicao(String pegaComposicao) { this.pegaComposicao = pegaComposicao; } public void creatorUnaryCSP() { setRule(""); setRule(getRule() + "include \"sequence_aux.csp\" \ninclude \"function_aux.csp\" \n" + "include \"auxiliar.csp\" \ninclude \"rules.csp\""); setRule(getRule() + typechannels.getTypeChannel()); //não preciso de types e channels de contrato, pois estou declarando todos os tipos e canais do ObjectList //no caso, todo canal q eu criar vai possuir algum tipo e canal dessa lista. setRule(getRule() + "\n\n"); //comportamento setRule(getRule() + instance.get(0).getContrato().getBehavior()); setRule(getRule() + "\n\n"); setRule(getRule() + "\n" + obl.getProcessosAuxiliares() + "\n\n"); //creatorRenameFunction(); setRule(getRule() + renameFunction.creatorRenameFunction()); //creatorChannelFunction(); setRule(getRule() + channelFunction.creatorChannelFunction()); // creatorInputFunction(); setRule(getRule() + inputFunction.creatorInputFunction()); //creatorOutputFunction(); setRule(getRule() + outputFunction.creatorOutputFunction()); } public void channelInstanciation(Channel Canal) { setRule(getRule() + "\nchannel " + Canal.getName() + " : "); for (int i = 0; i < Canal.getType().size(); i++) { if (i == Canal.getType().size() - 1) { setRule(getRule() + Canal.getType().get(i).getNome()); } else { setRule(getRule() + Canal.getType().get(i).getNome() + "."); } } } }