public boolean match(Message msg) {
try {
Flags f = msg.getFlags();
if (set) { // This is easy
if (f.contains(flags))
return true;
else
return false;
}
// Return true if ALL flags in the passed in Flags
// object are NOT set in this Message.
// Got to do this the hard way ...
Flags.Flag[] sf = flags.getSystemFlags();
// Check each flag in the passed in Flags object
for (int i = 0; i < sf.length; i++) {
if (f.contains(sf[i]))
// this flag IS set in this Message, get out.
return false;
}
String[] s = flags.getUserFlags();
// Check each flag in the passed in Flags object
for (int i = 0; i < s.length; i++) {
if (f.contains(s[i]))
// this flag IS set in this Message, get out.
return false;
}
return true;
} catch (Exception e) {
return false;
}
}
|