Package org.mantikhor.literal

Examples of org.mantikhor.literal.ValueObjectString


  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;
View Full Code Here


        if (!(valueObj instanceof ValueObjectString))
        {
            return false;
        }
       
        ValueObjectString strVal = (ValueObjectString) valueObj;
        // we require the String value to be exactly this long.
        return (strVal.writeValue().length() == this.valueInt);
    }
View Full Code Here

TOP

Related Classes of org.mantikhor.literal.ValueObjectString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.