1 package org.lsst.ccs.plugin.jas3.console;
2
3 import java.util.regex.Pattern;
4 import org.lsst.ccs.bus.BusMessage;
5
6
7
8
9
10
11
12 public class RegularExpressionMessageFilter implements MessageFilter {
13
14 private Pattern veto;
15 private Pattern accept;
16
17 @Override
18 public boolean accept(BusMessage message) {
19 String str = message.toString();
20 if (veto != null) {
21 if (veto.matcher(str).find()) {
22 return false;
23 }
24 }
25 if (accept != null) {
26 return accept.matcher(str).find();
27 }
28 return true;
29 }
30
31 public Pattern getVeto() {
32 return veto;
33 }
34
35
36
37
38
39
40 public void setVeto(Pattern veto) {
41 this.veto = veto;
42 }
43
44 public Pattern getAccept() {
45 return accept;
46 }
47
48
49
50
51
52
53 public void setAccept(Pattern accept) {
54 this.accept = accept;
55 }
56 }