1 package net.matuschek.spider; 2 3 6 7 import org.apache.regexp.RESyntaxException; 8 import org.apache.regexp.RE; 9 10 17 public class RegExpRule { 18 19 public RegExpRule() { 20 } 21 22 27 public boolean getAllow() { 28 return allow; 29 } 30 31 32 37 public void setAllow(boolean allow) { 38 this.allow = allow; 39 } 40 41 42 46 public boolean getProcessAllowed() { 47 return processAllowed && allow; 48 } 49 50 51 56 public void setProcessAllowed(boolean processAllowed) { 57 this.processAllowed = processAllowed; 58 } 59 60 64 public String getPattern() { 65 return pattern; 66 } 67 68 69 73 public void setPattern(String pattern) 74 throws RESyntaxException 75 { 76 this.expression = new RE(pattern); 77 this.pattern = pattern; 78 } 79 80 86 public boolean match(String s) { 87 return expression.match(s); 88 } 89 90 private boolean allow=true; 91 private boolean processAllowed=true; 92 private String pattern=""; 93 private RE expression=new RE(); 94 95 } | Popular Tags |