{
StringBuilder sb = new StringBuilder();
sb.append(key).append(" ").append(matcher.getCondition().toString())
- .append(" ").append(matcher.getPattern());
+ .append(" ");
+ if (matcher.getCondition().isNumeric())
+ {
+ sb.append(matcher.getPattern());
+ }
+ else
+ {
+ sb.append("'").append(matcher.getPattern()).append("'");
+ }
return sb.toString();
}
@Override
public String toString()
{
- return condition.name() + " " + pattern;
+ StringBuilder sb = new StringBuilder();
+ sb.append(condition.name()).append(" ");
+ if (condition.isNumeric())
+ {
+ sb.append(pattern);
+ }
+ else
+ {
+ sb.append("'").append(pattern).append("'");
+ }
+
+ return sb.toString();
}
}
assertEquals(km1.toString(), "AF < 1.2");
KeyedMatcher km2 = new KeyedMatcher("CLIN_SIG", Condition.NotContains, "path");
- assertEquals(km2.toString(), "CLIN_SIG Does not contain PATH");
+ assertEquals(km2.toString(), "CLIN_SIG Does not contain 'PATH'");
/*
* AND them
assertEquals(kms.toString(), "(AF < 1.2)");
kms.and(km2);
assertEquals(kms.toString(),
- "(AF < 1.2) AND (CLIN_SIG Does not contain PATH)");
+ "(AF < 1.2) AND (CLIN_SIG Does not contain 'PATH')");
/*
* OR them
assertEquals(kms.toString(), "(AF < 1.2)");
kms.or(km2);
assertEquals(kms.toString(),
- "(AF < 1.2) OR (CLIN_SIG Does not contain PATH)");
+ "(AF < 1.2) OR (CLIN_SIG Does not contain 'PATH')");
}
@Test
assertEquals(m.toString(), "LT 1.2E-6");
m = new Matcher(Condition.NotMatches, "ABC");
- assertEquals(m.toString(), "NotMatches ABC");
+ assertEquals(m.toString(), "NotMatches 'ABC'");
m = new Matcher(Condition.Contains, -1.2f);
- assertEquals(m.toString(), "Contains -1.2");
+ assertEquals(m.toString(), "Contains '-1.2'");
}
@Test