drools-eclipse/org.guvnor.eclipse.webdav/src/kernel/org/eclipse/webdav/internal/kernel/ConditionFactor.java
public static ConditionFactor create(StreamTokenizer tokenizer) throws WebDAVException {
        boolean not = false;
        ConditionFactor factor = null;
        try {
            int token = tokenizer.ttype;
            if (token == StreamTokenizer.TT_WORD) {
                if (tokenizer.sval.equalsIgnoreCase("Not")) { //$NON-NLS-1$
                    not = true;
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingNot")); //$NON-NLS-1$
                }
                token = tokenizer.nextToken();
            }
            switch (token) {
                case '<' :
                    factor = StateToken.create(tokenizer);
                    break;
                case '[' :
                    factor = EntityTag.create(tokenizer);
                    break;
                default :
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingOpen", String.valueOf(token))); //$NON-NLS-1$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        factor.setNot(not);
        return factor;
    }
public static ConditionFactor create(StreamTokenizer tokenizer) throws WebDAVException {
        boolean not = false;
        ConditionFactor factor = null;
        try {
            int token = tokenizer.ttype;
            if (token == StreamTokenizer.TT_WORD) {
                if (tokenizer.sval.equalsIgnoreCase("Not")) { //$NON-NLS-1$
                    not = true;
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingNot")); //$NON-NLS-1$
                }
                token = tokenizer.nextToken();
            }
            switch (token) {
                case '<' :
                    factor = StateToken.create(tokenizer);
                    break;
                case '[' :
                    factor = EntityTag.create(tokenizer);
                    break;
                default :
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingOpen", String.valueOf(token))); //$NON-NLS-1$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        factor.setNot(not);
        return factor;
    }
public static ConditionFactor create ( StreamTokenizer tokenizer ) throws WebDAVException { boolean not = false ; ConditionFactor factor = null ; try { int token = tokenizer . ttype ; if ( token == StreamTokenizer . TT_WORD ) { if ( tokenizer . sval . equalsIgnoreCase ( "Not" ) ) { //$NON-NLS-1$ not = true ; } else { throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingNot" ) ) ; //$NON-NLS-1$ } token = tokenizer . nextToken ( ) ; } switch ( token ) { case ' ' : factor = StateToken . create ( tokenizer ) ; break ; case ' ' : factor = EntityTag . create ( tokenizer ) ; break ; default : throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingOpen" , String . valueOf ( token ) ) ) ; //$NON-NLS-1$ } } catch ( IOException exc ) { // ignore or log? } factor . setNot ( not ) ; return factor ; }
Create a ConditionFactor (either a StateToken or EntityTag) by parsing
the tokenizer contining an If header value.

@param tokenizer a StreamTokenizer containing the contents of a state token or entity tag
from a WebDAV If header
@return the parsed ConditionFactor
@exception WebDAVException thrown if there is a syntax error in the If header
Create a ConditionFactor ( either a StateToken or EntityTag ) by parsing the tokenizer contining an If header value .