Package org.mantikhor.llapi.dom

Examples of org.mantikhor.llapi.dom.DOMProperty


    public boolean isTrue()
    {
        // TODO: Check for nulls in all values.- Pattabi Doraiswamy

        boolean result = false;
        DOMProperty domProperty = (DOMProperty)getCandidate();
        DOMPropertyValueNode candidateValueNode = domProperty.getPropertyValueNode();
        DOMOPerandPropertyValueNode patternValueNode = ((DOMOperandProperty)getPattern()).getPropertyValueNode();
       
        String candidateValue = candidateValueNode.getValue().toString();
        StringLogicOperationsEnum operation = patternValueNode.getOperation();       
        Object patternValue = patternValueNode.getValue();
           
        switch (operation)
        {
            case EQUALS:
                result = candidateValue.equals(patternValue.toString());
                break;
               
            case LESS_THAN:
            case BEFORE:
                result = (candidateValue.compareTo(patternValue.toString()) < 0);
                break;
               
            case GREATER_THAN:
            case AFTER:
                result = (candidateValue.compareTo(patternValue.toString()) > 0);
                break;
           
            case STARTS_WITH:
                result = candidateValue.startsWith(patternValue.toString());
                break;
               
            case MIN_LENGTH:
                result = (candidateValue.length() >= Integer.parseInt(patternValue.toString()));
                break;
               
            case MAX_LENGTH:
                result = (candidateValue.length() <= Integer.parseInt(patternValue.toString()));
                break;
               
            case CONTAINS:
                result = candidateValue.contains(patternValue.toString());
                break;
               
            case REGULAR_EXPRESSION:
                // TODO: To be implemented - Pattabi Doraiswamy
                result = false;
                break;
               
            case HAS_CAPTION:
                result = domProperty.getCaption().equals(patternValue.toString());
                break;
               
            case HAS_SEMANTIC:
                // TODO: This is a hack for the demo - this should not be here
                result = hasSemanticDecoration(domProperty, patternValue.toString());
View Full Code Here

TOP

Related Classes of org.mantikhor.llapi.dom.DOMProperty

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.