+
+ /**
+ * Performs a numerical comparison match condition test against an integer
+ * value
+ *
+ * @param compareTo
+ * @return
+ */
+ boolean matchesLong(String compareTo)
+ {
+ if (!condition.isNumeric())
+ {
+ // failsafe, shouldn't happen
+ return matches(String.valueOf(compareTo));
+ }
+
+ long val = 0L;
+ try
+ {
+ val = Long.valueOf(compareTo);
+ } catch (NumberFormatException e)
+ {
+ /*
+ * try the presented value as a float instead
+ */
+ return matchesFloat(compareTo, longValue);
+ }
+
+ boolean matched = false;
+ switch (condition)
+ {
+ case LT:
+ matched = val < longValue;
+ break;
+ case LE:
+ matched = val <= longValue;
+ break;
+ case EQ:
+ matched = val == longValue;
+ break;
+ case NE:
+ matched = val != longValue;
+ break;
+ case GT:
+ matched = val > longValue;
+ break;
+ case GE:
+ matched = val >= longValue;
+ break;
+ default:
+ break;
+ }
+
+ return matched;
+ }
+
+ /**
+ * Tests whether a null value matches the condition. The rule is that any
+ * numeric condition is failed, and only 'negative' string conditions are
+ * matched. So for example <br>
+ * {@code null contains "damaging"}<br>
+ * fails, but <br>
+ * {@code null does not contain "damaging"}</br>
+ * passes.
+ */
+ boolean matchesNull()
+ {
+ if (condition.isNumeric())
+ {
+ return false;
+ }
+ else
+ {
+ return condition == Condition.NotContains
+ || condition == Condition.NotMatches
+ || condition == Condition.NotPresent;
+ }
+ }