Merges a test into the union test list. @param test test to be merged @param list list
(final Test test, final List<Test> list)
| 82 | * @param list list |
| 83 | */ |
| 84 | private static void merge(final Test test, final List<Test> list) { |
| 85 | final int ls = list.size(); |
| 86 | for(int l = 0; l < ls; l++) { |
| 87 | final Test t = list.get(l); |
| 88 | // skip URI-based comparisons (may not be assigned yet at parse time) |
| 89 | if(test instanceof final NameTest ntest && t instanceof final NameTest nt && ( |
| 90 | ntest.scope == NameTest.Scope.URI || nt.scope == NameTest.Scope.URI)) continue; |
| 91 | // * union A |
| 92 | if(test.instanceOf(t)) return; |
| 93 | // A union * → * |
| 94 | if(t.instanceOf(test)) { |
| 95 | list.set(l, test); |
| 96 | return; |
| 97 | } |
| 98 | } |
| 99 | // A union B → (A|B) |
| 100 | list.add(test); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Optimizes the test. |
no test coverage detected