| @@ 88-115 (lines=28) @@ | ||
| 85 | /** |
|
| 86 | * |
|
| 87 | */ |
|
| 88 | @Override |
|
| 89 | public Set<Flaw> check() { |
|
| 90 | ||
| 91 | // filtered set |
|
| 92 | Set<Flaw> set = new HashSet<>(); |
|
| 93 | // get domain knowledge |
|
| 94 | DomainKnowledge knowledge = this.pdb.getDomainKnowledge(); |
|
| 95 | // get the hierarchy |
|
| 96 | List<DomainComponent>[] hierarchy = knowledge.getDomainHierarchy(); |
|
| 97 | // check domain hierarchy first |
|
| 98 | for (int index = 0; index < hierarchy.length && set.isEmpty(); index++) { |
|
| 99 | // check specified flaw preferences |
|
| 100 | for (int pndex = 0; pndex < this.preferences.length && set.isEmpty(); pndex++) { |
|
| 101 | // get current flaw type |
|
| 102 | FlawType type = this.preferences[pndex]; |
|
| 103 | ||
| 104 | // get components at the current level of the hierarchy |
|
| 105 | for (DomainComponent component : hierarchy[index]) { |
|
| 106 | // check flaws on the current component |
|
| 107 | set.addAll(component.checkFlaws(new FlawType[] { |
|
| 108 | type |
|
| 109 | })); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | // get flaws |
|
| 115 | return set; |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| @@ 55-82 (lines=28) @@ | ||
| 52 | /** |
|
| 53 | * |
|
| 54 | */ |
|
| 55 | @Override |
|
| 56 | public Set<Flaw> detectFlaws() |
|
| 57 | throws UnsolvableFlawException { |
|
| 58 | ||
| 59 | // filtered set |
|
| 60 | Set<Flaw> set = new HashSet<>(); |
|
| 61 | // get domain knowledge |
|
| 62 | DomainKnowledge knowledge = this.pdb.getDomainKnowledge(); |
|
| 63 | // get the hierarchy |
|
| 64 | List<DomainComponent>[] hierarchy = knowledge.getDomainHierarchy(); |
|
| 65 | // check domain hierarchy first |
|
| 66 | for (int index = 0; index < hierarchy.length && set.isEmpty(); index++) { |
|
| 67 | // check specified flaw preferences |
|
| 68 | for (int pndex = 0; pndex < this.preferences.length && set.isEmpty(); pndex++) { |
|
| 69 | // get current flaw type |
|
| 70 | FlawType type = this.preferences[pndex]; |
|
| 71 | ||
| 72 | // get components at the current level of the hierarchy |
|
| 73 | for (DomainComponent component : hierarchy[index]) { |
|
| 74 | // detect flaws on the current component |
|
| 75 | set.addAll(component.detectFlaws(type)); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | ||
| 81 | // get detected flaws |
|
| 82 | return set; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|