MatchRule2.java
01 package gate.creole.orthomatcher;
02 
03 import java.util.HashMap;
04 
05 /**
06  * RULE #2: if the two names are listed as equivalent in the
07  * lookup table (alias) then they match
08  * Condition(s): -
09  * Applied to: all name annotations
10  */
11 public class MatchRule2 implements OrthoMatcherRule {
12 
13   OrthoMatcher orthomatcher;
14   
15   public MatchRule2(OrthoMatcher orthmatcher){
16     this.orthomatcher=orthmatcher;
17   }
18   
19   public boolean value(String s1, String s2) {
20 
21     boolean result=false;
22     
23       if (orthomatcher.alias.containsKey(s1&& orthomatcher.alias.containsKey(s2)) {
24         if (orthomatcher.alias.get(s1).toString().equals(orthomatcher.alias.get(s2).toString())) {
25           if (orthomatcher.log.isDebugEnabled()) {
26             orthomatcher.log.debug("rule 2 matched " + s1 + " to " + s2);
27           }
28           result=true;
29         }
30       }
31 
32       if(resultOrthoMatcherHelper.usedRule(2);
33       
34       return result;
35     }
36   
37   public String getId(){
38     return "MatchRule2";
39   }
40 }