1 7 package fr.jayasoft.ivy.matcher; 8 9 import fr.jayasoft.ivy.ArtifactId; 10 import fr.jayasoft.ivy.ModuleId; 11 import fr.jayasoft.ivy.ModuleRevisionId; 12 13 public class MatcherHelper { 14 public static boolean matches(PatternMatcher m, String exp, String str) { 15 return m.getMatcher(exp).matches(str); 16 } 17 public static boolean matches(PatternMatcher m, ModuleId exp, ModuleId mid) { 18 return matches(m, exp.getOrganisation(), mid.getOrganisation()) 19 && matches(m, exp.getName(), mid.getName()); 20 } 21 22 public static boolean matches(PatternMatcher m, ModuleRevisionId exp, ModuleRevisionId mrid) { 23 return matches(m, exp.getOrganisation(), mrid.getOrganisation()) 24 && matches(m, exp.getName(), mrid.getName()) 25 && matches(m, exp.getRevision(), mrid.getRevision()); 26 } 27 public static boolean matches(PatternMatcher m, ArtifactId exp, ArtifactId aid) { 28 return matches(m, exp.getModuleId().getOrganisation(), aid.getModuleId().getOrganisation()) 29 && matches(m, exp.getModuleId().getName(), aid.getModuleId().getName()) 30 && matches(m, exp.getName(), aid.getName()) 31 && matches(m, exp.getExt(), aid.getExt()) 32 && matches(m, exp.getType(), aid.getType()) 33 ; 34 } 35 36 public static boolean isExact(PatternMatcher m, ModuleRevisionId exp) { 37 return isExact(m, exp.getOrganisation()) 38 && isExact(m, exp.getName()) 39 && isExact(m, exp.getRevision()); 40 } 41 public static boolean isExact(PatternMatcher m, ModuleId exp) { 42 return isExact(m, exp.getOrganisation()) 43 && isExact(m, exp.getName()); 44 } 45 public static boolean isExact(PatternMatcher m, String exp) { 46 return m.getMatcher(exp).isExact(); 47 } 48 } 49 | Popular Tags |