public boolean isTrue()
{
boolean result = false;
StringProperty stringProperty = (StringProperty)getCandidate();
StringPropertyValueNode candidateValueNode = stringProperty.getPropertyValueNode();
ValueObjectString candidateValue = candidateValueNode.getValue();
StringOperandPropertyValueNode patternValueNode = ((StringOperandProperty)getPattern()).getPropertyValueNode();
StringLogicOperationsEnum operation = patternValueNode.getOperation();
ValueObjectString patternValue = patternValueNode.getValue();
// NOTE: for ValueObjectString we need writeValue and not toString ...
// ValueObjectString's implementation of toString returns
// "ValueObjectString = " + this.referenceValue
// while writeValue returns this.referenceValue which is the internal
// String value that ValueObjectString encapsulates.
switch (operation)
{
case EQUALS:
result = candidateValue.hasSameValue(patternValue);
break;
case LESS_THAN:
case BEFORE:
result = (candidateValue.compareTo(patternValue.writeValue()) < 0);
break;
case GREATER_THAN:
case AFTER:
result = (candidateValue.compareTo(patternValue.writeValue()) > 0);
break;
case STARTS_WITH:
result = candidateValue.startsWith(patternValue.writeValue());
break;
case MIN_LENGTH:
// TODO: is this correct? DLW
result = (candidateValue.length() >= Integer.parseInt(patternValue.writeValue()));
break;
case MAX_LENGTH:
// TODO: is this correct? DLW
result = (candidateValue.length() <= Integer.parseInt(patternValue.writeValue()));
break;
case CONTAINS:
result = candidateValue.contains(patternValue.writeValue());
break;
case REGULAR_EXPRESSION:
// TODO: To be implemented - Pattabi Doraiswamy
result = false;