Skip to main content
summaryrefslogtreecommitdiffstats
blob: 93794d61e7af433ecc02912c6161f11d343bf723 (plain) (blame)
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
package org.eclipse.osee.coverage.dispo;

import java.util.Collection;
import org.eclipse.osee.coverage.merge.MatchType;
import org.eclipse.osee.coverage.model.ICoverage;

public class ImportMatch {

   private final ImportMatchType matchType;
   private final ICoverage fromItem;
   private final ICoverage toItem;
   private final String description;

   public ImportMatch(ImportMatchType matchType, ICoverage packageItem, ICoverage importItem) {
      this(matchType, packageItem, importItem, "");
   }

   public ImportMatch(ImportMatchType matchType, ICoverage fromItem, ICoverage toItem, String description, Object... parms) {
      this.matchType = matchType;
      this.fromItem = fromItem;
      this.toItem = toItem;
      this.description = String.format(description, parms);
   }

   public String getDescription() {
      return description;
   }

   public ImportMatchType getMatchType() {
      return matchType;
   }

   public ICoverage getFromItem() {
      return fromItem;
   }

   public ICoverage getToItem() {
      return toItem;
   }

   @Override
   public String toString() {
      return "Match Type>> " + matchType.toString() + "(" + description + ") - From Item>>" + fromItem.toString() + ") - To Item>>(" + (toItem != null ? fromItem.toString() : "[null])");
   }

   public static boolean isAllMatchType(Collection<MatchType> matchTypes, Collection<ImportMatch> matchItems) {
      for (ImportMatch matchItem : matchItems) {
         if (!matchTypes.contains(matchItem.getMatchType())) {
            return false;
         }
      }
      return true;
   }

   public boolean isMatch() {
      if (matchType == ImportMatchType.Match) {
         return true;
      }
      return false;
   }

   public boolean isMatchType(Collection<ImportMatchType> matchTypes) {
      if (!matchTypes.contains(matchType)) {
         return false;
      }
      return true;
   }
}

Back to the top