Blame view

BRIC/src/CREATOR_CONDICTIONS_RULES/CreatorRenameFunction.java 2.13 KB
eeb5cac08   Madiel de Souza Conserva Filho   first
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  /*
   * 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 + "
  ";
          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 + "> 
  ";
  
              renameFunction = renameFunction + instance1.getName()
                      + " = rename(" + contract.getName() + ", Inst_"
                      + instance1.getName() + ") 
  
  ";
  
          }
  
          return renameFunction;
  
      }
  }