KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > matcher > ModuleIdMatcher


1 /*
2  * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
3  * Copyright Jayasoft 2005 - All rights reserved
4  *
5  * #SNAPSHOT#
6  */

7 package fr.jayasoft.ivy.matcher;
8
9 import fr.jayasoft.ivy.ModuleId;
10
11 public class ModuleIdMatcher {
12     private Matcher _orgMatcher;
13     private Matcher _moduleMatcher;
14     private ModuleId _mid;
15     private PatternMatcher _pm;
16     
17     public ModuleIdMatcher(ModuleId mid, PatternMatcher pm) {
18         _mid = mid;
19         _pm = pm;
20         _orgMatcher = pm.getMatcher(mid.getOrganisation());
21         _moduleMatcher = pm.getMatcher(mid.getName());
22     }
23     
24     public boolean matches(ModuleId mid) {
25         return _orgMatcher.matches(mid.getOrganisation()) && _moduleMatcher.matches(mid.getName());
26     }
27     
28     public String JavaDoc toString() {
29         return _mid+" ("+_pm.getName()+")";
30     }
31 }
32
Popular Tags