drools-eclipse/org.guvnor.eclipse.webdav/src/kernel/org/eclipse/webdav/internal/kernel/ConditionTerm.java
public static ConditionTerm create(StreamTokenizer tokenizer) throws WebDAVException {
        ConditionTerm term = new ConditionTerm();
        try {
            int token = tokenizer.ttype;
            if (token == '(')
                token = tokenizer.nextToken();
            else
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "(")); //$NON-NLS-1$ //$NON-NLS-2$

            while (token == StreamTokenizer.TT_WORD || token == '<' || token == '[') {
                term.addConditionFactor(ConditionFactor.create(tokenizer));
                token = tokenizer.ttype;
            }
            if (token == ')')
                token = tokenizer.nextToken();
            else
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), ")")); //$NON-NLS-1$ //$NON-NLS-2$
        } catch (IOException exc) {
            // ignore or log?
        }
        if (!term.getConditionFactors().hasMoreElements())
            throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingStateOrEntity")); //$NON-NLS-1$
        return term;
    }
public static ConditionTerm create(StreamTokenizer tokenizer) throws WebDAVException {
        ConditionTerm term = new ConditionTerm();
        try {
            int token = tokenizer.ttype;
            if (token == '(')
                token = tokenizer.nextToken();
            else
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "(")); //$NON-NLS-1$ //$NON-NLS-2$

            while (token == StreamTokenizer.TT_WORD || token == '<' || token == '[') {
                term.addConditionFactor(ConditionFactor.create(tokenizer));
                token = tokenizer.ttype;
            }
            if (token == ')')
                token = tokenizer.nextToken();
            else
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), ")")); //$NON-NLS-1$ //$NON-NLS-2$
        } catch (IOException exc) {
            // ignore or log?
        }
        if (!term.getConditionFactors().hasMoreElements())
            throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingStateOrEntity")); //$NON-NLS-1$
        return term;
    }
public static ConditionTerm create ( StreamTokenizer tokenizer ) throws WebDAVException { ConditionTerm term = new ConditionTerm ( ) ; try { int token = tokenizer . ttype ; if ( token == ' ' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , "(" ) ) ; //$NON-NLS-1$ //$NON-NLS-2$ while ( token == StreamTokenizer . TT_WORD || token == ' ' || token == ' ' ) { term . addConditionFactor ( ConditionFactor . create ( tokenizer ) ) ; token = tokenizer . ttype ; } if ( token == ' ' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , ")" ) ) ; //$NON-NLS-1$ //$NON-NLS-2$ } catch ( IOException exc ) { // ignore or log? } if ( ! term . getConditionFactors ( ) . hasMoreElements ( ) ) throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingStateOrEntity" ) ) ; //$NON-NLS-1$ return term ; }
Create a ConditionTerm by parsing the given If header as defined by
section 9.4 in the WebDAV spec.

@param tokenizer a StreamTokenizer on the contents of a WebDAV If header
@return the parsed ConditionTerm
@exception WebDAVException thrown if there is a syntax error in the If header
Create a ConditionTerm by parsing the given If header as defined by section 9 . 4 in the WebDAV spec .