Blame view

BRIC/.svn/pristine/90/901b9e2b65789b9a50f022587c9eb17b616a909f.svn-base 6.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package CREATOR_CONDICTIONS_RULES;
  
  import LOGIC.Instance;
  import LOGIC.Protocols;
  import java.util.LinkedList;
  
  /**
   *
   * @author sarah
   */
  public class CreatorCondition_D6 {
  
      private String condiction = "";
      private LinkedList<Protocols> prot;
      private LinkedList<Instance> instance;
      private CreatorNamesOfProcessCSP creatNamePcsp;
      private LinkedList<String> pegarProtRIO;
      private CreatorNamesOfProcessCSP creatorNameProcessCsp;
      private LinkedList<String> pegarDualProtRIO;
      //private LinkedList<String> pegarDualProt;
      private LinkedList<String> nomecanal;
      private String eventoprotocol1 = "";
      private String eventoprotocol2 = "";
      private String canal1 = "";
      private String canal2 = "";
  
      public CreatorCondition_D6(LinkedList<Instance> i, LinkedList<Protocols> p) {
  
          this.instance = i;
          this.prot = p;
  
          nomecanal = new LinkedList<>();
          nomecanal.add(p.get(0).getCanal().getName().replace(".", "_"));
          nomecanal.add(p.get(1).getCanal().getName().replace(".", "_"));
  
          creatNamePcsp = new CreatorNamesOfProcessCSP(i, p);
          pegarProtRIO = new LinkedList<>();
          creatorNameProcessCsp = new CreatorNamesOfProcessCSP(i, p);
  
          //pegando o nome do evento que passei por paramentro no protocolo 
          int pr1, pr2, pr3, pr4;
  
          pr1 = p.get(0).getProtocol().indexOf("(");
          pr2 = p.get(0).getProtocol().lastIndexOf(")");
          eventoprotocol1 = p.get(0).getProtocol().substring(pr1 + 1, pr2);
  
          pr3 = p.get(1).getProtocol().indexOf("(");
          pr4 = p.get(1).getProtocol().lastIndexOf(")");
          eventoprotocol2 = p.get(1).getProtocol().substring(pr3 + 1, pr4);
  
  
          pegarProtRIO = creatorNameProcessCsp.CreatorProt_RIO();
  
          pegarDualProtRIO = creatorNameProcessCsp.CreatorDual_Prot_RIO();
          //pegando o nome do canal 
          int can1, can2, can3, can4;
  
          can1 = p.get(0).getProtocol().indexOf("(");
          can2 = p.get(0).getProtocol().lastIndexOf(".");
          canal1 = p.get(0).getProtocol().substring(can1 + 1, can2);
  
          can3 = p.get(1).getProtocol().indexOf("(");
          can4 = p.get(1).getProtocol().lastIndexOf(".");
          canal2 = p.get(1).getProtocol().substring(can3 + 1, can4);
      }
  
      public String implementationCondition_D6_1() {
  
  
  
          condiction = condiction + "---- D.6: Protocols are Strong Compatible";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert " + pegarProtRIO.get(0)
                  + " :[deadlock free [FD]]";
          condiction = condiction + "
  
  ";
  
  
          condiction = condiction + "----	 * D.6.2: Protocols are communication protocols";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert not Test(subseteq(inputs("
                  + pegarProtRIO.get(0) + "), {| "
                  + canal1 + "|})) [T= ERROR";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert not Test(subseteq(outputs("
                  + pegarProtRIO.get(0) + "), {|"
                  + canal2 + "|})) [T= ERROR";
          condiction = condiction + "
  ";
  
  
  
          condiction = condiction + "assert not Test(inputs("
                  + pegarProtRIO.get(0) + ") == outputs("
                  + pegarDualProtRIO.get(0) + ")) [T= ERROR";
          condiction = condiction + "
  
  ";
  
  
  
          condiction = condiction + "assert not Test(outputs("
                  + pegarProtRIO.get(0) + ") == inputs("
                  + pegarDualProtRIO.get(0) + ")) [T= ERROR";
          condiction = condiction + "
  
  ";
  
  
          condiction = condiction + "assert " + pegarDualProtRIO.get(0)
                  + " [T= " + pegarProtRIO.get(0);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarProtRIO.get(0)
                  + " [T= " + pegarDualProtRIO.get(0);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarDualProtRIO.get(0)
                  + " [F= " + pegarProtRIO.get(1);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarProtRIO.get(1)
                  + " [F= " + pegarDualProtRIO.get(0);
          condiction = condiction + "
  
  ";
  
  
          return condiction;
  
  
  
      }
  
      public String implementationCondition_D6_2() {
  
  
          condiction = condiction + "assert " + pegarProtRIO.get(1)
                  + " :[deadlock free [FD]]";
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert not Test(subseteq(inputs("
                  + pegarProtRIO.get(1) + "), {| "
                  + canal2 + "|})) [T= ERROR";
          condiction = condiction + "
  ";
  
  
          condiction = condiction + "assert not Test(subseteq(outputs("
                  + pegarProtRIO.get(1) + "), {| "
                  + canal1 + "|})) [T= ERROR";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert not Test(inputs("
                  + pegarProtRIO.get(1) + ") == outputs("
                  + pegarDualProtRIO.get(1) + ")) [T= ERROR";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert not Test(outputs("
                  + pegarProtRIO.get(1) + ") == inputs("
                  + pegarDualProtRIO.get(1) + ")) [T= ERROR";
          condiction = condiction + "
  ";
  
          condiction = condiction + "assert " + pegarDualProtRIO.get(1)
                  + " [T= " + pegarProtRIO.get(1);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarProtRIO.get(1)
                  + " [T= " + pegarDualProtRIO.get(1);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarDualProtRIO.get(1)
                  + " [F= " + pegarProtRIO.get(0);
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "
  
  ";
  
          condiction = condiction + "assert " + pegarProtRIO.get(0)
                  + " [F= " + pegarDualProtRIO.get(1);
          condiction = condiction + "
  
  ";
  
  
          return condiction;
  
      }
  }