public static boolean parse()

in hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/parsers/BooleanParserFactory.java [40:78]


    public static boolean parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
        char ch;
        int i = start;
        int end = start + length;
        while (i < end && ((ch = buffer[i]) == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '\f')) {
            i++;
        }
        int remainingLength = end - i;
        boolean gotBoolean = false;
        boolean booleanValue = false;
        if (remainingLength >= 4 && ((ch = buffer[i]) == 't' || ch == 'T') && ((ch = buffer[i + 1]) == 'r' || ch == 'R')
                && ((ch = buffer[i + 2]) == 'u' || ch == 'U') && ((ch = buffer[i + 3]) == 'e' || ch == 'E')) {
            gotBoolean = true;
            booleanValue = true;
            i = i + 4;
        } else if (remainingLength >= 5 && ((ch = buffer[i]) == 'f' || ch == 'F')
                && ((ch = buffer[i + 1]) == 'a' || ch == 'A') && ((ch = buffer[i + 2]) == 'l' || ch == 'L')
                && ((ch = buffer[i + 3]) == 's' || ch == 'S') && ((ch = buffer[i + 4]) == 'e' || ch == 'E')) {
            gotBoolean = true;
            booleanValue = false;
            i = i + 5;
        }

        for (; i < end; ++i) {
            ch = buffer[i];
            if (ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\f') {
                return false;
            }
        }
        if (!gotBoolean) {
            return false;
        }
        try {
            out.writeBoolean(booleanValue);
            return true;
        } catch (IOException e) {
            throw HyracksDataException.create(e);
        }
    }