Package: JmlAnnotationComparator

JmlAnnotationComparator

nameinstructionbranchcomplexitylinemethod
JmlAnnotationComparator()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
compare(ClonableString, ClonableString)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getOrder(String)
M: 4 C: 22
85%
M: 2 C: 6
75%
M: 2 C: 3
60%
M: 2 C: 7
78%
M: 0 C: 1
100%

Coverage

1: package org.overture.codegen.vdm2jml.util;
2:
3: import java.util.Comparator;
4:
5: import org.overture.ast.util.ClonableString;
6: import org.overture.codegen.vdm2jml.JmlGenerator;
7:
8: public class JmlAnnotationComparator implements Comparator<ClonableString>
9: {
10:         @Override
11:         public int compare(ClonableString left, ClonableString right)
12:         {
13:                 int leftOrder = getOrder(left.value);
14:                 int rightOrder = getOrder(right.value);
15:
16:                 return leftOrder - rightOrder;
17:         }
18:
19:         public int getOrder(String annotation)
20:         {
21:•                if (annotation.equals(JmlGenerator.JML_NULLABLE_BY_DEFAULT))
22:                 {
23:                         return 10;
24:•                } else if (annotation.equals(JmlGenerator.JML_SPEC_PUBLIC))
25:                 {
26:                         return 9;
27:•                } else if (annotation.equals(JmlGenerator.JML_HELPER))
28:                 {
29:                         return 8;
30:•                } else if (annotation.equals(JmlGenerator.JML_PURE))
31:                 {
32:                         return 7;
33:                 } else
34:                 {
35:                         return 0;
36:                 }
37:         }
38: }