text:
namespace kp19pp{
    namespace scanner{
        template<class Iter>
        struct iterator{
            using value_type = typename Iter::value_type;
            iterator() = default;
            iterator(const iterator &other) :
                place(other.place),
                char_count(other.char_count), line_count(other.line_count)
            {}

            iterator(const Iter &iter) :
                place(iter),
                char_count(0), line_count(0)
            {}

            ~iterator() = default;

            iterator &operator =(const iterator &other){
                place = other.place;
                char_count = other.char_count, line_count = other.line_count;
                return *this;
            }

            iterator &advance(std::size_t n){
                place += n;
                return *this;
            }

            iterator &operator --(){
                {
                    bool first_flag = place == first;
                    --place;
                    if(first_flag){ return *this; }
                }
                unsigned char c = static_cast<unsigned char>(*place);
                if(c >= 0x00 && c <= 0x7F){
                    return *this;
                }
                while(true){
                    if(c >= 0x80 && c <= 0xBF){
                        c = static_cast<unsigned char>(*(place--));
                    }else if(c >= 0xC0 && c <= 0xFF){
                        break;
                    }
                }
                std::size_t count_tail = 0;
                Iter i = place;
                while(true){
                    if(i == first){ break; }
                    c = static_cast<unsigned char>(*(i--));
                    if(c == '\n'){ break; }
                    ++count_tail;
                }
                char_count = count_tail;
                return *this;
            }

            iterator &operator ++(){
                unsigned char c = static_cast<unsigned char>(*place);
                if(c >= 0x00 && c <= 0x7F){
                    if(c == '\n'){
                        char_count = 0;
                        ++line_count;
                    } else{
                        ++char_count;
                    }
                    ++place;
                } else{
                    int n;
                    if(c >= 0xC0 && c <= 0xDF){
                        n = 1;
                    } else if(c >= 0xE0 && c <= 0xEF){
                        n = 2;
                    } else if(c >= 0xF0 && c <= 0xFF){
                        n = 3;
                    } else{
                        throw exception("lexical error.", 0, line_count);
                    }
                    ++place;
                    if(place == last){
                        ++char_count;
                        return *this;
                    }
                    c = static_cast<unsigned char>(*place);
                    while(place != last || c >= 0x80 && c <= 0xBF){
                        --n;
                        ++place;
                        c = static_cast<unsigned char>(*place);
                    }
                    if(n > 0){
                        throw exception("lexical error.", 0, line_count);
                    }
                    ++char_count;
                }
                return *this;
            }

            value_type operator *() const{
                return *place;
            }

            bool operator ==(const Iter &other) const{
                Iter last = place;
                return last == other;
            }

            bool operator ==(const iterator &other) const{
                return place == other.place;
            }

            template<class Other>
            bool operator !=(const Other &other) const{
                return !(*this == other);
            }

            Iter place, first, last;
            std::size_t char_count, line_count;
        };

        class lexer{
        public:
            template<class InputIter>
            static std::pair<bool, InputIter> reg_whitespace(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter == last){ match = false; } else{
                            InputIter iter_prime = iter;
                            const char *str = " ";
                            std::size_t n = sizeof(" ") / sizeof(char);
                            std::size_t i = 0;
                            while(str[i]){
                                if(str[i] != *iter){ break; }
                                ++i, ++iter;
                            }
                            match = str[i] == '\0';
                        }
                        if(match){ break; } else{ iter = iter_prime; }
                        if(iter != last && *iter == '\t'){
                            ++iter;
                            match = true;
                        } else{ match = false; }
                        if(!match){ iter = iter_prime; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_end_of_line(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter != last && *iter == '\n'){
                            ++iter;
                            match = true;
                        } else{ match = false; }
                        if(match){ break; } else{ iter = iter_prime; }
                        if(iter == last){ match = false; } else{
                            InputIter iter_prime = iter;
                            do{
                                if(iter == last){ match = false; } else{
                                    InputIter iter_prime = iter;
                                    const char *str = "//";
                                    std::size_t n = sizeof("//") / sizeof(char);
                                    std::size_t i = 0;
                                    while(str[i]){
                                        if(str[i] != *iter){ break; }
                                        ++i, ++iter;
                                    }
                                    match = str[i] == '\0';
                                }
                                if(!match){ iter = iter_prime; break; }
                                {
                                    InputIter iter_prime = iter;
                                    while(iter != last){
                                        if(iter == last){ match = false; } else{
                                            char c = *iter;
                                            if(
                                                (c != '\n')
                                                ){
                                                ++iter;
                                                match = true;
                                            } else{ match = false; }
                                        }
                                        if(match){ iter_prime = iter; } else{
                                            iter = iter_prime;
                                            match = true;
                                            break;
                                        }
                                    }
                                }
                                if(!match){ iter = iter_prime; break; }
                                if(iter != last && *iter == '\n'){
                                    ++iter;
                                    match = true;
                                } else{ match = false; }
                                if(!match){ iter = iter_prime; break; }
                            } while(false);
                        }
                        if(!match){ iter = iter_prime; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_first_line(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter == last){ match = false; } else{
                            InputIter iter_prime = iter;
                            const char *str = "#!";
                            std::size_t n = sizeof("#!") / sizeof(char);
                            std::size_t i = 0;
                            while(str[i]){
                                if(str[i] != *iter){ break; }
                                ++i, ++iter;
                            }
                            match = str[i] == '\0';
                        }
                        if(!match){ iter = iter_prime; break; }
                        {
                            InputIter iter_prime = iter;
                            while(iter != last){
                                if(iter == last){ match = false; } else{
                                    char c = *iter;
                                    if(
                                        (c != '\n')
                                        ){
                                        ++iter;
                                        match = true;
                                    } else{ match = false; }
                                }
                                if(match){ iter_prime = iter; } else{
                                    iter = iter_prime;
                                    match = true;
                                    break;
                                }
                            }
                        }
                        if(!match){ iter = iter_prime; break; }
                        if(iter != last && *iter == '\n'){
                            ++iter;
                            match = true;
                        } else{ match = false; }
                        if(!match){ iter = iter_prime; break; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_value(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter == last){ match = false; } else{
                            InputIter iter_prime = iter;
                            do{
                                if(iter == last){ match = false; } else{
                                    char c = *iter;
                                    if(
                                        ((c >= '1') && (c <= '9'))
                                        ){
                                        ++iter;
                                        match = true;
                                    } else{ match = false; }
                                }
                                if(!match){ iter = iter_prime; break; }
                                {
                                    InputIter iter_prime = iter;
                                    while(iter != last){
                                        if(iter == last){ match = false; } else{
                                            char c = *iter;
                                            if(
                                                ((c >= '0') && (c <= '9'))
                                                ){
                                                ++iter;
                                                match = true;
                                            } else{ match = false; }
                                        }
                                        if(match){ iter_prime = iter; } else{
                                            iter = iter_prime;
                                            match = true;
                                            break;
                                        }
                                    }
                                }
                                if(!match){ iter = iter_prime; break; }
                            } while(false);
                        }
                        if(match){ break; } else{ iter = iter_prime; }
                        if(iter == last){ match = false; } else{
                            InputIter iter_prime = iter;
                            const char *str = "0";
                            std::size_t n = sizeof("0") / sizeof(char);
                            std::size_t i = 0;
                            while(str[i]){
                                if(str[i] != *iter){ break; }
                                ++i, ++iter;
                            }
                            match = str[i] == '\0';
                        }
                        if(!match){ iter = iter_prime; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_comma(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ",";
                    std::size_t n = sizeof(",") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_dot(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ".";
                    std::size_t n = sizeof(".") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_question(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "?";
                    std::size_t n = sizeof("?") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_plus(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "+";
                    std::size_t n = sizeof("+") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_asterisk(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "*";
                    std::size_t n = sizeof("*") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_ampersand(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "&";
                    std::size_t n = sizeof("&") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_double_colon(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "::";
                    std::size_t n = sizeof("::") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_semicolon(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ";";
                    std::size_t n = sizeof(";") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_l_square_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "[";
                    std::size_t n = sizeof("[") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_r_square_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "]";
                    std::size_t n = sizeof("]") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_l_curly_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "{";
                    std::size_t n = sizeof("{") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_r_curly_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "}";
                    std::size_t n = sizeof("}") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_l_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "<";
                    std::size_t n = sizeof("<") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_r_bracket(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ">";
                    std::size_t n = sizeof(">") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_l_round_pare(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "(";
                    std::size_t n = sizeof("(") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_r_round_pare(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ")";
                    std::size_t n = sizeof(")") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_symbol_or(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "|";
                    std::size_t n = sizeof("|") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_symbol_colon(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = ":";
                    std::size_t n = sizeof(":") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_equal(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    const char *str = "=";
                    std::size_t n = sizeof("=") / sizeof(char);
                    std::size_t i = 0;
                    while(str[i]){
                        if(str[i] != *iter){ break; }
                        ++i, ++iter;
                    }
                    match = str[i] == '\0';
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_str(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter != last && *iter == '"'){
                            ++iter;
                            match = true;
                        } else{ match = false; }
                        if(!match){ iter = iter_prime; break; }
                        do{
                            if(iter == last){ match = false; } else{
                                InputIter iter_prime = iter;
                                do{
                                    if(iter == last){ match = false; } else{
                                        char c = *iter;
                                        if(
                                            (c != '"')
                                            ){
                                            ++iter;
                                            match = true;
                                        } else{ match = false; }
                                    }
                                    if(match){ break; } else{ iter = iter_prime; }
                                    if(iter != last && *iter == '"'){
                                        ++iter;
                                        match = true;
                                    } else{ match = false; }
                                    if(!match){ iter = iter_prime; }
                                } while(false);
                            }
                            if(!match){ break; }
                            InputIter iter_prime = iter;
                            while(iter != last){
                                if(iter == last){ match = false; } else{
                                    InputIter iter_prime = iter;
                                    do{
                                        if(iter == last){ match = false; } else{
                                            char c = *iter;
                                            if(
                                                (c != '"')
                                                ){
                                                ++iter;
                                                match = true;
                                            } else{ match = false; }
                                        }
                                        if(match){ break; } else{ iter = iter_prime; }
                                        if(iter != last && *iter == '"'){
                                            ++iter;
                                            match = true;
                                        } else{ match = false; }
                                        if(!match){ iter = iter_prime; }
                                    } while(false);
                                }
                                if(match){ iter_prime = iter; } else{
                                    iter = iter_prime;
                                    match = true;
                                    break;
                                }
                            }
                        } while(false);
                        if(!match){ iter = iter_prime; break; }
                        if(iter != last && *iter == '"'){
                            ++iter;
                            match = true;
                        } else{ match = false; }
                        if(!match){ iter = iter_prime; break; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<bool, InputIter> reg_identifier(InputIter first, InputIter last){
                InputIter iter = first;
                bool match = true;
                if(iter == last){ match = false; } else{
                    InputIter iter_prime = iter;
                    do{
                        if(iter == last){ match = false; } else{
                            char c = *iter;
                            if(
                                ((c >= 'a') && (c <= 'z')) ||
                                ((c >= 'A') && (c <= 'Z')) ||
                                (c == '_')
                                ){
                                ++iter;
                                match = true;
                            } else{ match = false; }
                        }
                        if(!match){ iter = iter_prime; break; }
                        {
                            InputIter iter_prime = iter;
                            while(iter != last){
                                if(iter == last){ match = false; } else{
                                    char c = *iter;
                                    if(
                                        ((c >= '0') && (c <= '9')) ||
                                        ((c >= 'a') && (c <= 'z')) ||
                                        ((c >= 'A') && (c <= 'Z')) ||
                                        (c == '_')
                                        ){
                                        ++iter;
                                        match = true;
                                    } else{ match = false; }
                                }
                                if(match){ iter_prime = iter; } else{
                                    iter = iter_prime;
                                    match = true;
                                    break;
                                }
                            }
                        }
                        if(!match){ iter = iter_prime; break; }
                    } while(false);
                }
                return std::make_pair(match, iter);
            }

            template<class InputIter>
            static std::pair<token, InputIter> apply(InputIter first, InputIter last){
                InputIter iter = first;
                std::pair<bool, iterator<InputIter>> result;
                result = reg_whitespace(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_whitespace, iter);
                }
                result = reg_end_of_line(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_end_of_line, iter);
                }
                result = reg_first_line(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_first_line, iter);
                }
                result = reg_value(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_value, iter);
                }
                result = reg_comma(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_comma, iter);
                }
                result = reg_dot(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_dot, iter);
                }
                result = reg_question(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_question, iter);
                }
                result = reg_plus(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_plus, iter);
                }
                result = reg_asterisk(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_asterisk, iter);
                }
                result = reg_ampersand(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_ampersand, iter);
                }
                result = reg_double_colon(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_double_colon, iter);
                }
                result = reg_semicolon(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_semicolon, iter);
                }
                result = reg_l_square_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_l_square_bracket, iter);
                }
                result = reg_r_square_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_r_square_bracket, iter);
                }
                result = reg_l_curly_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_l_curly_bracket, iter);
                }
                result = reg_r_curly_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_r_curly_bracket, iter);
                }
                result = reg_l_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_l_bracket, iter);
                }
                result = reg_r_bracket(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_r_bracket, iter);
                }
                result = reg_l_round_pare(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_l_round_pare, iter);
                }
                result = reg_r_round_pare(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_r_round_pare, iter);
                }
                result = reg_symbol_or(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_symbol_or, iter);
                }
                result = reg_symbol_colon(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_symbol_colon, iter);
                }
                result = reg_equal(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_equal, iter);
                }
                result = reg_str(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_str, iter);
                }
                result = reg_identifier(iter, last);
                if(result.first){
                    iter = result.second.place;
                    return std::make_pair(token_identifier, iter);
                }
                return std::make_pair(token_0, iter);
            }

            template<class Iter, class InsertFunctor>
            static std::pair<bool, iterator<Iter>> tokenize(Iter first, Iter last, const InsertFunctor &f){
                iterator<Iter> iter = first, end = last;
                std::pair<bool, iterator<Iter>> result;
                while(iter != last){
                    result = reg_whitespace(iter, end);
                    if(result.first){
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_end_of_line(iter, end);
                    if(result.first){
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_first_line(iter, end);
                    if(result.first){
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_value(iter, end);
                    if(result.first){
                        f(token_value, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_comma(iter, end);
                    if(result.first){
                        f(token_comma, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_dot(iter, end);
                    if(result.first){
                        f(token_dot, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_question(iter, end);
                    if(result.first){
                        f(token_question, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_plus(iter, end);
                    if(result.first){
                        f(token_plus, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_asterisk(iter, end);
                    if(result.first){
                        f(token_asterisk, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_ampersand(iter, end);
                    if(result.first){
                        f(token_ampersand, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_double_colon(iter, end);
                    if(result.first){
                        f(token_double_colon, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_semicolon(iter, end);
                    if(result.first){
                        f(token_semicolon, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_l_square_bracket(iter, end);
                    if(result.first){
                        f(token_l_square_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_r_square_bracket(iter, end);
                    if(result.first){
                        f(token_r_square_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_l_curly_bracket(iter, end);
                    if(result.first){
                        f(token_l_curly_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_r_curly_bracket(iter, end);
                    if(result.first){
                        f(token_r_curly_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_l_bracket(iter, end);
                    if(result.first){
                        f(token_l_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_r_bracket(iter, end);
                    if(result.first){
                        f(token_r_bracket, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_l_round_pare(iter, end);
                    if(result.first){
                        f(token_l_round_pare, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_r_round_pare(iter, end);
                    if(result.first){
                        f(token_r_round_pare, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_symbol_or(iter, end);
                    if(result.first){
                        f(token_symbol_or, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_symbol_colon(iter, end);
                    if(result.first){
                        f(token_symbol_colon, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_equal(iter, end);
                    if(result.first){
                        f(token_equal, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_str(iter, end);
                    if(result.first){
                        f(token_str, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    result = reg_identifier(iter, end);
                    if(result.first){
                        f(token_identifier, iter, result.second);
                        iter = result.second.place;
                        continue;
                    }
                    break;
                }
                return result;
            }
        };
    } // namespace scanner
}

#endif // SCANNER_LEXER_HPP_


text:
Package.describe({
  name: 'wilybear:meteor-tesseract',
  version: '0.0.1',
  summary: 'Server side optical character recognition (OCR) using Tesseract',
  git: 'https://github.com/awylie199/meteor-tesseract.git',
  documentation: 'README.md'
});

Npm.depends({
    "node-tesseract"    : "0.2.7"
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use('ecmascript');
  api.use('meteorhacks:async@1.0.0', 'server');
  api.addFiles(['meteor-tesseract.js'], 'server');
  api.export('tesseract', 'server');
});

redpajama_set_name: RedPajamaGithub


text:
JWTKeeper.configure do |config|
  # The time to expire for the tokens
  # config.expiry           = 1.hour

  # The hashing method to for the tokens
  # Options:
  #   HS256 - HMAC using SHA-256 hash algorithm (default)
  #   HS384 - HMAC using SHA-384 hash algorithm
  #   HS512 - HMAC using SHA-512 hash algorithm
  #   RS256 - RSA using SHA-256 hash algorithm
  #   RS384 - RSA using SHA-384 hash algorithm
  #   RS512 - RSA using SHA-512 hash algorithm
  #   ES256 - ECDSA using P-256 and SHA-256
  #   ES384 - ECDSA using P-384 and SHA-384
  #   ES512 - ECDSA using P-521 and SHA-512
  # config.algorithm        = 'HS512'

  # the secret in which you data is hash with
  # config.secret           = 'secret'

  # the issuer of the tokens
  # config.issuer           = 'api.example.com'

  # the default audience of the tokens
  # config.audience         = 'example.com'

  # the location of redis config file
  # config.redis_connection = Redis.new(connection_options)

  # A unique idenfitier for the token version.
  # config.version          = 1

  # Use a httponly/secure cookie secret to prevent session hijacking
  # config.cookie_lock      = true

  # Used to turn off TLS only mode on the cookie, for development mode. Defaults to true
  # config.cookie_secure    = !(Rails.env.test? || Rails.env.development?)

  # Used to limit or lock down the allowed domains for the jwt/cookie
  # http://api.rubyonrails.org/classes/ActionDispatch/Cookies.html
  # Defaults the value of :all
  # config.cookie_domain    = :all
end


text:
package config

import (
	"time"

	"github.com/spf13/pflag"
)

const (
	flagBackoffTime      = "backoff-time"
	flagTickInterval     = "tick-interval"
	flagFullScanDiffTick = "full-scan-tick"
	flagAdvancingByCache = "advancing-by-cache"

	DefaultConsistencyCheckTick = 5
	DefaultTryAdvanceThreshold  = 3 * time.Minute
	DefaultBackOffTime          = 5 * time.Second
	DefaultTickInterval         = 12 * time.Second
	DefaultFullScanTick         = 4
	DefaultAdvanceByCache       = true
)

var (
	DefaultMaxConcurrencyAdvance = 8
)

type Config struct {
	// The gap between two retries.
	BackoffTime time.Duration `toml:"backoff-time" json:"backoff-time"`
	// The gap between calculating checkpoints.
	TickDuration time.Duration `toml:"tick-interval" json:"tick-interval"`
	// The backoff time of full scan.
	FullScanTick int `toml:"full-scan-tick" json:"full-scan-tick"`

	// Whether enable the optimization -- use a cached heap to advancing the global checkpoint.
	// This may reduce the gap of checkpoint but may cost more CPU.
	AdvancingByCache bool `toml:"advancing-by-cache" json:"advancing-by-cache"`
}

func DefineFlagsForCheckpointAdvancerConfig(f *pflag.FlagSet) {
	f.Duration(flagBackoffTime, DefaultBackOffTime, "The gap between two retries.")
	f.Duration(flagTickInterval, DefaultTickInterval, "From how long we trigger the tick (advancing the checkpoint).")
	f.Bool(flagAdvancingByCache, DefaultAdvanceByCache, "Whether enable the optimization -- use a cached heap to advancing the global checkpoint.")
	f.Int(flagFullScanDiffTick, DefaultFullScanTick, "The backoff of full scan.")
}

func Default() Config {
	return Config{
		BackoffTime:      DefaultBackOffTime,
		TickDuration:     DefaultTickInterval,
		FullScanTick:     DefaultFullScanTick,
		AdvancingByCache: DefaultAdvanceByCache,
	}
}

func (conf *Config) GetFromFlags(f *pflag.FlagSet) error {
	var err error
	conf.BackoffTime, err = f.GetDuration(flagBackoffTime)
	if err != nil {
		return err
	}
	conf.TickDuration, err = f.GetDuration(flagTickInterval)
	if err != nil {
		return err
	}
	conf.FullScanTick, err = f.GetInt(flagFullScanDiffTick)
	if err != nil {
		return err
	}
	conf.AdvancingByCache, err = f.GetBool(flagAdvancingByCache)
	if err != nil {
		return err
	}
	return nil
}


text:
package remoteworkers

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// BotsClient is the client API for Bots service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type BotsClient interface {
	// CreateBotSession is called when the bot first joins the farm, and
	// establishes a session ID to ensure that multiple machines do not register
	// using the same name accidentally.
	CreateBotSession(ctx context.Context, in *CreateBotSessionRequest, opts ...grpc.CallOption) (*BotSession, error)
	// UpdateBotSession must be called periodically by the bot (on a schedule
	// determined by the server) to let the server know about its status, and to
	// pick up new lease requests from the server.
	UpdateBotSession(ctx context.Context, in *UpdateBotSessionRequest, opts ...grpc.CallOption) (*BotSession, error)
}

type botsClient struct {
	cc grpc.ClientConnInterface
}

func NewBotsClient(cc grpc.ClientConnInterface) BotsClient {
	return &botsClient{cc}
}

func (c *botsClient) CreateBotSession(ctx context.Context, in *CreateBotSessionRequest, opts ...grpc.CallOption) (*BotSession, error) {
	out := new(BotSession)
	err := c.cc.Invoke(ctx, "/google.devtools.remoteworkers.v1test2.Bots/CreateBotSession", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *botsClient) UpdateBotSession(ctx context.Context, in *UpdateBotSessionRequest, opts ...grpc.CallOption) (*BotSession, error) {
	out := new(BotSession)
	err := c.cc.Invoke(ctx, "/google.devtools.remoteworkers.v1test2.Bots/UpdateBotSession", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// BotsServer is the server API for Bots service.
// All implementations must embed UnimplementedBotsServer
// for forward compatibility
type BotsServer interface {
	// CreateBotSession is called when the bot first joins the farm, and
	// establishes a session ID to ensure that multiple machines do not register
	// using the same name accidentally.
	CreateBotSession(context.Context, *CreateBotSessionRequest) (*BotSession, error)
	// UpdateBotSession must be called periodically by the bot (on a schedule
	// determined by the server) to let the server know about its status, and to
	// pick up new lease requests from the server.
	UpdateBotSession(context.Context, *UpdateBotSessionRequest) (*BotSession, error)
	mustEmbedUnimplementedBotsServer()
}

// UnimplementedBotsServer must be embedded to have forward compatible implementations.
type UnimplementedBotsServer struct {
}

func (UnimplementedBotsServer) CreateBotSession(context.Context, *CreateBotSessionRequest) (*BotSession, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateBotSession not implemented")
}
func (UnimplementedBotsServer) UpdateBotSession(context.Context, *UpdateBotSessionRequest) (*BotSession, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UpdateBotSession not implemented")
}
func (UnimplementedBotsServer) mustEmbedUnimplementedBotsServer() {}

// UnsafeBotsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BotsServer will
// result in compilation errors.
type UnsafeBotsServer interface {
	mustEmbedUnimplementedBotsServer()
}

func RegisterBotsServer(s grpc.ServiceRegistrar, srv BotsServer) {
	s.RegisterService(&Bots_ServiceDesc, srv)
}

func _Bots_CreateBotSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateBotSessionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(BotsServer).CreateBotSession(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/google.devtools.remoteworkers.v1test2.Bots/CreateBotSession",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(BotsServer).CreateBotSession(ctx, req.(*CreateBotSessionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Bots_UpdateBotSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(UpdateBotSessionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(BotsServer).UpdateBotSession(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/google.devtools.remoteworkers.v1test2.Bots/UpdateBotSession",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(BotsServer).UpdateBotSession(ctx, req.(*UpdateBotSessionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Bots_ServiceDesc is the grpc.ServiceDesc for Bots service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Bots_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "google.devtools.remoteworkers.v1test2.Bots",
	HandlerType: (*BotsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateBotSession",
			Handler:    _Bots_CreateBotSession_Handler,
		},
		{
			MethodName: "UpdateBotSession",
			Handler:    _Bots_UpdateBotSession_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "go.chromium.org/luci/swarming/internal/remoteworkers/bots.proto",
}


text:
It is a search engine for searching gourmet food reviews. The data set for the reviews is taken from [Amazon Fine Foods reviews](http://snap.stanford.edu/data/web-FineFoods.html) which has 568,454 reviews given by 256,059 users.
You can checkout the live demo [here](http://prashkr.com/tastysearch/).

### Running instructions

Clone this repo:
```sh
$ git clone https://github.com/prashkr/tasty-search.git
```
Before running the following command make sure you have the dataset file (Amazon reviews) in the resources folder.

Now move into the cloned directory and run:
```sh
$ ./gradlew run
```
**Make sure you have JDK 8 installed**

Your application will be up and running on the port specified in the tastysearch.yml file which is the global configuration file for our application. Access your application as follows:
```sh
http://localhost:[port]/tastysearch
```

### Dropwizard Configuration
The configuration has the following fields which can be changed according to needs.
* **port** : port on which you want to run your application
* **sampleSize** : number of samples to collect out of all the reviews
* **indexType** : type of index to use. 1 for Hash map index. 2 for Radix tree index
* **resultSize** : number of results to emit
* **fileName** : name of the data file
*  **testSetSize** : number of queries to generate for load test
*   **maxTestTokens** : max number of tokens in the generated query (for load test)
*   **testSetFileName** : name of the test set file

### Tools, Libraries and Frameworks Used
* [Dropwizard](https://github.com/dropwizard/dropwizard)
* [AngularJS](https://github.com/angular/angular.js)
* [Concurrent-Trees](https://github.com/npgall/concurrent-trees)

### Load Test Results

Entries in the table correspond to the tuple (Average Latency, Throughput in requests/sec). Ran the tests for 10 minutes each.

|              **Structure \ Threads**             |  **1 Thread**  |  **10 Threads** |  **20 Threads**  |
|:------------------------------------------------:|:--------------:|:---------------:|:----------------:|
|                  **Radix Tree**                  | (2ms, 452/sec) | (9ms, 1064/sec) | (16ms, 1177/sec) |
|                   **Hash Map**                   | (1ms, 470/sec) | (8ms, 1152/sec) | (15ms, 1295/sec) |
|              **Concurrent Hash Map**             | (1ms, 578/sec) | (7ms, 1317/sec) | (13ms, 1418/sec) |
| **Hash Map with Heap Optimization during query** | (1ms, 640/sec) | (6ms, 1403/sec) | (10ms, 1837/sec) |
|              **Brute Force Search**              | (167ms, 6/sec) |        NA       |        NA        |

License
----
MIT


text:
function CardDependencies() {
  this.requiredJavaScriptURLs = [];
  this.requiredCSSURLs = [];
}

CardDependencies.prototype = {
  requireJavaScript: function(url) {
    this.requiredJavaScriptURLs.push(url);
  },
  requireCSS: function(url) {
    this.requiredCSSURLs.push(url);
  }
};

export default CardDependencies;


text:
<?php
use Behat\Behat\Context\BehatContext;
use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode;
use bdd_videoannotator\stub_php\stringArrayArray;
use bdd_videoannotator\stub_php\stringArray;

/**
 *  SubContext-Class for behat_support.feature
 *
 *  PHP version 5
 *
 * @category Class
 * @package  Features/
 * @author   Stefan Hell <stefan.hell88@gmail.com>
 * @license  The Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt
 * @link     https://github.com/shell88/bdd_videoannotator
 */

class BehatAdapterTestContext extends BehatContext
{
    private $_adapterWithoutServerConnection;
    private $_mockedClient;
    private $_subTestDirectory;
    private $_classNameFeatureContext;
    private $_tempString;

    private $_cntScenariosToBeStopped = 0;

    /**
     * @Given /^I have an instance of the BDD-Adapter for Behat without a server connection$/
     */
    public function iHaveAnInstanceOfTheBddAdapterForBehatWithoutAServerConnection()
    {
        $mockedServerConnector = Phake::mock("bdd_videoannotator\bddadapters\ServerConnector");
        $this->_mockedClient = Phake::mock("bdd_videoannotator\stub_php\AnnotationServiceService");
        Phake::when($mockedServerConnector)->startServer->thenReturn($this->_mockedClient);
        $this->_adapterWithoutServerConnection = new \bdd_videoannotator\bddadapters\BehatReportingAdapter ($mockedServerConnector);
        Phake::verify($mockedServerConnector)->startServer();
    }

    /**
     * @When /^the Adapter reports "([^"]*)" with exception "([^"]*)" it should be converted to "([^"]*)"$/
     */
    public function theAdapterReportsWithExceptionItShouldBeConvertedTo($behatResult, $exceptionType, $expected)
    {
        $mockedStepEvent = $this->getMockForStepEvent($behatResult, $exceptionType);
        $this->verifyResultConversion($mockedStepEvent, $expected);
        Phake::verify($mockedStepEvent)->getException();
    }

    /**
     * @When /^the Adapter reports "([^"]*)" with exception - it should be converted to "([^"]*)"$/
     */
    public function theAdapterReportsWithoutExceptionItShouldBeConvertedTo($behatResult, $expected)
    {
        $mockedStepEvent = $this->getMockForStepEvent($behatResult);
        $this->verifyResultConversion($mockedStepEvent, $expected);
    }

    private function getMockForStepEvent($behatResult, $exceptionType = null)
    {
        $mockedStepEvent = Phake::mock("Behat\Behat\Event\StepEvent");
        $resultCode = constant("Behat\Behat\Event\StepEvent::{$behatResult}");
        Phake::when($mockedStepEvent)->getResult->thenReturn($resultCode);

        if (isset($exceptionType)) {
            Phake::when($mockedStepEvent)->hasException->thenReturn(true);
            $mockedException = Phake::mock($exceptionType);
            Phake::when($mockedStepEvent)->getException->thenReturn($mockedException);
        } else {
            Phake::when($mockedStepEvent)->hasException->thenReturn(false);
        }
        return $mockedStepEvent;
    }

    private function verifyResultConversion($mockedStepEvent, $expectedResult)
    {
        $actualRes = $this->_adapterWithoutServerConnection->convertResultToStepResult($mockedStepEvent);
        PHPUnit_Framework_Assert::assertEquals($expectedResult, $actualRes);
        Phake::verify($mockedStepEvent)->getResult();
    }

    /**
     * @When /^I convert a pystringObject with:$/
     */
    public function iConvertAPystringobjectWith(PyStringNode $pyObject)
    {
        $this->_tempString = $this->_adapterWithoutServerConnection->convertPyStringToNormalString($pyObject);
    }

    /**
     * @Then /^I should get a string "([^"]*)" with pystring delimiters and a single intent$/
     */
    public function iShouldGetAStringWithPystringDelimiters($expectedString)
    {
        $intent = " ";
        $expected = "$intent\"\"\"" . "\n" . $intent . $expectedString . "\n$intent\"\"\"";
        PHPUnit_Framework_Assert::assertEquals($expected, $this->_tempString);
    }

    /**
     * @Given /^I have a feature file:$/
     */
    public function iHaveAFeatureFile(PyStringNode $content)
    {
        $this->_subTestDirectory = SubTestHelper::getNewSubTestDirectory();
        $this->_classNameFeatureContext = strtoupper(basename($this->_subTestDirectory));
        $featureDirectory = $this->_subTestDirectory . DIRECTORY_SEPARATOR . "features";
        mkdir($featureDirectory);

        $fhandle = fopen($featureDirectory . DIRECTORY_SEPARATOR . "subtest.feature", "w+");
        fwrite($fhandle, $content);
        fclose($fhandle);

        // write also sample featurecontext => Behat will exit otherwise
        $bootsStrapFolder = $featureDirectory . DIRECTORY_SEPARATOR . "bootstrap";
        mkdir($bootsStrapFolder);
        $fhandle = fopen($bootsStrapFolder . DIRECTORY_SEPARATOR . $this->_classNameFeatureContext . ".php", "w+");
        // HEREDOCSYNTAX
        $contentSampleFile = <<<CODE
<?php

use Behat\Behat\Context\BehatContext;
use Behat\Behat\Exception\PendingException;

class $this->_classNameFeatureContext extends BehatContext {

};
CODE;
        fwrite($fhandle, $contentSampleFile);
        fclose($fhandle);
    }

    /**
     * @When /^I run Behat$/
     */
    public function iRunBehatWithAMockedAdapter()
    {
        $behatSubTestExecutor = new BehatSubTestExecutorProxy ($this->_subTestDirectory, $this->_classNameFeatureContext, $this->_adapterWithoutServerConnection);
        $behatSubTestExecutor->executeSubTest();
    }

    /**
     * @Then /^the Adapter should report the feature "([^"]*)"$/
     */
    public function theAdapterShouldReportTheFeature($expectedFeatureText)
    {
        Phake::verify($this->_mockedClient)->setFeatureText($expectedFeatureText);
    }

    /**
     * @Then /^the Adapter should report the scenario "([^"]*)" with following steps:$/
     */
    public function theAdapterShouldReportTheScenarioWithSteps($scenarioName, PyStringNode $expected_steps)
    {
        Phake::verify($this->_mockedClient, Phake::atLeast(1))->startScenario($scenarioName);

        // some steptext might be more than once in the result array
        $timesOccured = array_count_values($expected_steps->getLines());

        foreach ($expected_steps->getLines() as $steptext) {
            $times_expected = $timesOccured [$steptext];
            Phake::verify($this->_mockedClient, Phake::times($times_expected))->addStepToBuffer($steptext, null);
        }
        $this->_cntScenariosToBeStopped++;
        Phake::verify($this->_mockedClient, Phake::atLeast($this->_cntScenariosToBeStopped))->stopScenario();
    }

    /**
     * @Then /^the Adapter should send the steptext: "([^"]*)" with the datatable:$/
     */
    public function theAdapterShouldSendTheSteptextWithTheDatatable($expectedStepText, TableNode $expectedTable)
    {
        $datatableExpected = $this->convertDataTable2StringArrayArray($expectedTable);
        Phake::verify($this->_mockedClient)->addStepToBuffer($expectedStepText, $datatableExpected);
    }

    private function convertDataTable2StringArrayArray(TableNode $table)
    {
        $datatable = new stringArrayArray();
        $datatable->item = array();
        foreach ($table->getRows() as $tableRow) {
            $stringArrayRow = new stringArray();
            $stringArrayRow->item = $tableRow;
            array_push($datatable->item, $stringArrayRow);
        }
        return $datatable;
    }

    /**
     * @Given /^I have a feature file with a step "([^"]*)" and a docstring "([^"]*)"$/
     */
    public function iHaveAFeatureFileWithAStepAndADocstring($stepText, $docString)
    {
        $contentsFeatureFile = "Feature: test";
        $contentsFeatureFile .= "\nScenario: test";
        $contentsFeatureFile .= "\n" . $stepText;
        $contentsFeatureFile .= "\n\"\"\"\n" . $docString . "\n\"\"\"";
        $this->iHaveAFeatureFile(new PyStringNode ($contentsFeatureFile));
    }

    /**
     * @Then /^the Adapter should report the step as follows:$/
     */
    public function theAdapterShouldReportTheStepAsFollows(PyStringNode $expected)
    {
        $expectedText = ( string )$expected;
        $expectedText = str_replace("<DOCSTRING>", '"""', $expectedText);
        Phake::verify($this->_mockedClient)->addStepToBuffer($expectedText, null);
    }

    /**
     * @Given /^the Adapter should send "([^"]*)" (\d+) times to the server$/
     */
    public function theAdapterShouldSendTimesToTheServer($expectedResult, $cntTimes)
    {
        Phake::verify($this->_mockedClient, Phake::times($cntTimes))->addResultToBufferStep($expectedResult);
    }
}


text:
package org.codehaus.griffon.runtime.core;

import griffon.core.GriffonApplication;
import griffon.core.GriffonClass;
import griffon.core.GriffonModelClass;

/**
 * Handler for 'Model' artifacts.
 *
 * @author Andres Almiray
 */
public class ModelArtifactHandler extends ArtifactHandlerAdapter {
    public ModelArtifactHandler(GriffonApplication app) {
        super(app, GriffonModelClass.TYPE, GriffonModelClass.TRAILING);
    }

    protected GriffonClass newGriffonClassInstance(Class clazz) {
        return new DefaultGriffonModelClass(getApp(), clazz);
    }
}


text:
package pt.up.fe.comp.fsa;

import junit.framework.TestCase;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.junit.Test;
import pt.up.fe.comp.dot.DotVisitor;
import pt.up.fe.comp.dot.ir.DotGraph;
import pt.up.fe.comp.dot.parser.dotLexer;
import pt.up.fe.comp.dot.parser.dotParser;

import java.io.FileInputStream;

import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class FSABuildTest {
    @Test
    public void LoadFromFile() {
        try {
            ANTLRInputStream input = new ANTLRInputStream(new FileInputStream("dot_dfa_examples/fsm.gv"));
            dotLexer lex = new dotLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lex);
            dotParser parser = new dotParser(tokens);
            ParseTree tree = parser.graph();

            DotVisitor eval = new DotVisitor();
            DotGraph graph = eval.visit(tree);

            FSA automaton = FSABuilder.buildFrom(graph);

            assertTrue(automaton.getName().equals(graph.name));

            assertTrue(automaton.getFinalStates().contains("LR_0"));
            assertTrue(automaton.getFinalStates().contains("LR_3"));
            assertTrue(automaton.getFinalStates().contains("LR_4"));
            assertTrue(automaton.getFinalStates().contains("LR_8"));

            assertTrue(automaton.getNodes().containsAll(graph.getNodes()));

            assertTrue(automaton.getInitialState().equals("LR_0"));

            assertTrue(automaton.isDeterministic());

        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }
    }

    @Test
    public void LoadFromFileWithRegex() {
        try {
            ANTLRInputStream input = new ANTLRInputStream(new FileInputStream("dot_dfa_examples/COMP_HW1_REGEX.gv"));
            dotLexer lex = new dotLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lex);
            dotParser parser = new dotParser(tokens);
            ParseTree tree = parser.graph();

            DotVisitor eval = new DotVisitor();
            DotGraph graph = eval.visit(tree);

            FSA automaton = FSABuilder.buildFrom(graph);

            TestCase.assertTrue(automaton.accepts("ef"));
            TestCase.assertTrue(automaton.accepts("abc"));
            TestCase.assertTrue(automaton.accepts("aaabccccc"));
            TestCase.assertTrue(automaton.accepts("aaabbbbbb"));
            TestCase.assertTrue(automaton.accepts("abbbb"));
            TestCase.assertTrue(automaton.accepts("bbbb"));

            assertFalse(automaton.accepts(""));
            assertFalse(automaton.accepts("e"));
            assertFalse(automaton.accepts("eff"));
            assertFalse(automaton.accepts("abbc"));
            assertFalse(automaton.accepts("bcccc"));
            assertFalse(automaton.accepts("sfgddd"));
            assertFalse(automaton.accepts("aaacccc"));

        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }
    }
}


text:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- YAMLtoJSON Wide Sky -->
<ins class="adsbygoogle"
     style="display:inline-block;width:160px;height:600px"
     data-ad-client="ca-pub-8389988710887724"
     data-ad-slot="1503061440"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


text:
package com.stickycoding.rokon;

import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.Shape;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;

/**
 * PhysicalObject.java
 * An object which can undergo collisions through Box2D
 *
 * @author Richard
 *
 */
public class PhysicalSprite extends Sprite implements Updateable {

	/**
	 * The Body associated with this Sprite, for Box2D
	 */
	public Body body;

	/**
	 * The BodyDef associated with this Sprite, for Box2D
	 */
	public BodyDef bodyDef;

	protected boolean usePhysics;

	public PhysicalSprite(float x, float y, float width, float height) {
		super(x, y, width, height);
	}

	/**
	 * Creates a Body for Box2D collisions
	 *
	 * @param bodyDef valid BodyDef object
	 * @param fixture valid FixtureDef object
	 */
	public void createBody(BodyDef bodyDef, FixtureDef fixture) {
		body = Physics.world.createBody(bodyDef);
		body.createFixture(fixture);
		this.bodyDef = bodyDef;
		usePhysics = true;
	}

	/**
	 * Creates a Body for Box2D collisions, given by a Shape
	 *
	 * @param bodyDef valid BodyDef object
	 * @param shape valid Shape object
	 */
	public void createBody(BodyDef bodyDef, Shape shape) {
		body = Physics.world.createBody(bodyDef);
		body.createFixture(shape, 1f);
		this.bodyDef = bodyDef;
		usePhysics = true;
	}

	/**
	 * Creates and applies a circular Body for this PhysicalSprite
	 * @return
	 */
	public CircleShape createCircleShape() {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		return circle;
	}

	/**
	 * Creates and applies a rectangular Body for this PhysicalSprite
	 * @return
	 */
	public PolygonShape createBoxShape() {
		PolygonShape poly = new PolygonShape();
		poly.setAsBox(width / 2f, height / 2f);
		return poly;
	}

	/**
	 * Creates and applies a dynamic Body from a FixtureDef
	 *
	 * @param fixture valid FixtureDef object
	 */
	public void createDynamicBody(FixtureDef fixture) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.DynamicBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, fixture);
	}

	/**
	 * Creates and applies a dynamic Body from a Shape
	 *
	 * @param shape valid Shape object
	 */
	public void createDynamicBody(Shape shape) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.DynamicBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, shape);
	}

	/**
	 * Creates and applies a static Body from a FixtureDef
	 *
	 * @param fixture valid FixtureDef object
	 */
	public void createStaticBody(FixtureDef fixture) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.StaticBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, fixture);
	}

	/**
	 * Creates and applies a static Body from a Shape
	 *
	 * @param shape valid Shape object
	 */
	public void createStaticBody(Shape shape) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.StaticBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, shape);
	}

	/**
	 * Creates and applies a kinematic Body from a FixtureDef
	 *
	 * @param fixture valid FixtureDef object
	 */
	public void createKinematicBody(FixtureDef fixture) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.KinematicBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, fixture);
	}

	/**
	 * Creates and applies a kinematic Body from a Shape
	 *
	 * @param shape valid Shape object
	 */
	public void createKinematicBody(Shape shape) {
		bodyDef = new BodyDef();
		bodyDef.type = BodyType.KinematicBody;
		bodyDef.position.x = getX() + width / 2f;
		bodyDef.position.y = getY() + height / 2f;
		bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
		createBody(bodyDef, shape);
	}

	/**
	 * Creates and applies a circular dynamic Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createDynamicCircle(FixtureDef fixtureDef) {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		fixtureDef.shape = circle;
		createDynamicBody(fixtureDef);
		circle.dispose();
	}

	/**
	 * Creates and applies a dynamic circular Body
	 */
	public void createDynamicCircle() {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		createDynamicBody(circle);
		circle.dispose();
	}

	/**
	 * Creates and applies a static circular Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createStaticCircle(FixtureDef fixtureDef) {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		fixtureDef.shape = circle;
		createStaticBody(fixtureDef);
		circle.dispose();
	}

	/**
	 * Creates and applies a static circular Body
	 */
	public void createStaticCircle() {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		createStaticBody(circle);
		circle.dispose();
	}

	/**
	 * Creates and applies a kinematic circular Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createKinematicCircle(FixtureDef fixtureDef) {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		fixtureDef.shape = circle;
		createKinematicBody(fixtureDef);
		circle.dispose();
	}

	/**
	 * Creates and applies a kinematic circular Body
	 */
	public void createKinematicCircle() {
		CircleShape circle = new CircleShape();
		circle.setRadius(width / 2f);
		createKinematicBody(circle);
		circle.dispose();
	}

	/**
	 * Creates and applies a dynamic rectangular Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createDynamicBox(FixtureDef fixtureDef) {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2f, height / 2f);
		fixtureDef.shape = boxPoly;
		createDynamicBody(fixtureDef);
		boxPoly.dispose();
	}

	/**
	 * Creates and applies a dynamic rectangular Body
	 */
	public void createDynamicBox() {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2f, height / 2f);
		createDynamicBody(boxPoly);
		boxPoly.dispose();
	}

	/**
	 * Creates and applies a static rectangular Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createStaticBox(FixtureDef fixtureDef) {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2f, height / 2f);
		fixtureDef.shape = boxPoly;
		createStaticBody(fixtureDef);
		boxPoly.dispose();
	}

	/**
	 * Creates and applies a static rectangular Body
	 */
	public void createStaticBox() {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2, height / 2f);
		createStaticBody(boxPoly);
		boxPoly.dispose();
	}

	/**
	 * Creates and applies a kinematic rectangular Body from a FixtureDef
	 *
	 * @param fixtureDef valid FixtureDef object
	 */
	public void createKinematicBox(FixtureDef fixtureDef) {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2, height / 2f);
		fixtureDef.shape = boxPoly;
		createKinematicBody(fixtureDef);
		boxPoly.dispose();
	}

	/**
	 * Creates and applies a kinematic rectangular Body
	 */
	public void createKinematicBox() {
		PolygonShape boxPoly = new PolygonShape();
		boxPoly.setAsBox(width / 2, height / 2f);
		createKinematicBody(boxPoly);
		boxPoly.dispose();
	}

	/**
	 * Returns the Body associated with this PhysicalObject
	 *
	 * @return NULL if none set
	 */
	public Body getBody() {
		return body;
	}

	/**
	 * Sets the Body for this PhysicalObject
	 * Automatically flags usePhysics as TRUE
	 * Stops any kinematics from Sprite
	 *
	 * @param body valid Body object
	 */
	public void setBody(Body body) {
		this.body = body;
		usePhysics = true;
		stop();
	}

	/**
	 * Flags the PhysicalObject to use the Box2D physics engine
	 * If the Body object is not set, this will raise an exception on next redraw
	 * Stops any kinematics from Sprite
	 */
	public void usePhysics() {
		usePhysics = true;
		stop();
	}

	/**
	 * Flags the PhysicalObject to ignore the physics engine for now
	 */
	public void noPhysics() {
		usePhysics = false;
	}

	/* (non-Javadoc)
	 * @see com.stickycoding.rokon.Sprite#onUpdate()
	 */
	@Override
	public void onUpdate() {
		super.onUpdate();
		if(usePhysics) {
			setX(body.getPosition().x - width / 2);
			setY(body.getPosition().y - height / 2);
			rotation = (body.getAngle() * MathHelper.RAD_TO_DEG) % 360;
		}
	}

	/* (non-Javadoc)
	 * @see com.stickycoding.rokon.Sprite#onRemove()
	 */
	@Override
	public void onRemove() {
		super.onRemove();
		if(body != null) {
			Physics.world.destroyBody(body);
			body = null;
		}
	}

}


text:
title: Exists Document API
short_title: Exists API
---

The _Exists Index API_ allows to check for the existence of a document using
`HEAD` method.

For example:

{% capture req %}

```json
HEAD /twitter/tweet/1
```
{% endcapture %}
{% include curl.html req=req %}

The result of the above get operation is a `200 OK` HTTP response code with the
no body.

{: .note .warning }
[Trailing slashes are important]({{ '/docs/reference-guide/api#trailing-slashes-are-important' | relative_url }}).


text:
// AND WE DANCED!!!!!
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.DigitalIOButton;
import edu.wpi.first.wpilibj.buttons.InternalButton;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.templates.commands.CollectorDoNothing;
import edu.wpi.first.wpilibj.templates.commands.DeployLifter;
import edu.wpi.first.wpilibj.templates.commands.Flinger.FlingerPyrimidSpeed;
import edu.wpi.first.wpilibj.templates.commands.Flinger.FlingerNormal;
import edu.wpi.first.wpilibj.templates.commands.Flinger.FlingerOff;
import edu.wpi.first.wpilibj.templates.commands.Flinger.FlingerPowerSavingMode;
import edu.wpi.first.wpilibj.templates.commands.LEDBlingControl;
import edu.wpi.first.wpilibj.templates.commands.Lift;
import edu.wpi.first.wpilibj.templates.commands.PickUp;
import edu.wpi.first.wpilibj.templates.commands.Drive.ScaleShift;
import edu.wpi.first.wpilibj.templates.commands.Drive.Shift;
import edu.wpi.first.wpilibj.templates.commands.Shoot;
import edu.wpi.first.wpilibj.templates.commands.SpitOut;
import edu.wpi.first.wpilibj.templates.commands.StowArms;
import edu.wpi.first.wpilibj.templates.commands.TiltNormal;
import edu.wpi.first.wpilibj.templates.commands.TiltDown;
import edu.wpi.first.wpilibj.templates.commands.TiltUp;
import edu.wpi.first.wpilibj.templates.commands.testCommands.LogCommand;
import edu.wpi.first.wpilibj.templates.commands.testCommands.ResetDeadReckoner;
import edu.wpi.first.wpilibj.templates.commands.testCommands.TunePID;
import edu.wpi.first.wpilibj.templates.subsystems.Bling;
import edu.wpi.first.wpilibj.templates.subsystems.Flinger;
import team.util.JoystickTrigger;
import team.util.LogDebugger;
import team.util.XboxController;
import team.util.joystick.Axis;
import team.util.joystick.AxisSide;

/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */
public class OI {
//    boolean speedScaleState = false;
//    boolean lastspeedScaleButtonState = false;
    //// CREATING BUTTONS
    // One type of button is a joystick button which is any button on a joystick.
    // You create one by telling it which joystick it's on and which button
    // number it is.
    // Joystick stick = new Joystick(port);
    // Button button = new JoystickButton(stick, buttonNumber);

    Joystick stick = new Joystick(1);

    Button btnA = new JoystickButton(stick, XboxController.A);
    Button btnB = new JoystickButton(stick, XboxController.B);
    Button btnX = new JoystickButton(stick, XboxController.X);
    Button btnY = new JoystickButton(stick, XboxController.Y);
    //Button btnLB = new JoystickButton(stick, XboxController.LB);
    //Button commandTestLog = new JoystickButton(stick, XboxController.RB);
    Button btnLB = new JoystickButton(stick, XboxController.LB);
    Button btnRB = new JoystickButton(stick, XboxController.RB);
    Button btnLSC = new JoystickButton(stick, XboxController.LeftStickClick);
    Button btnLT = new JoystickTrigger(stick, Axis.triggers, AxisSide.left);
    Button btnRT = new JoystickTrigger(stick, Axis.triggers, AxisSide.right);

    Joystick otherStick = new Joystick(2);

    Button btnOtherA = new JoystickButton(otherStick, XboxController.A);
    Button btnOtherB = new JoystickButton(otherStick, XboxController.B);
    Button btnOtherX = new JoystickButton(otherStick, XboxController.X);
    Button btnOtherY = new JoystickButton(otherStick, XboxController.Y);
    Button btnOtherLB = new JoystickButton(otherStick, XboxController.LB);
    Button btnOtherRB = new JoystickButton(otherStick, XboxController.RB);
    Button btnOtherLT = new JoystickTrigger(otherStick, Axis.triggers, AxisSide.left);
    Button btnOtherRT = new JoystickTrigger(otherStick, Axis.triggers, AxisSide.right);

    InternalButton bi1 = new InternalButton();
    InternalButton bi2 = new InternalButton();
    InternalButton bi3 = new InternalButton();
    InternalButton bi4 = new InternalButton();
    InternalButton resetLocation = new InternalButton();

    // Another type of button you can create is a DigitalIOButton, which is
    // a button or switch hooked up to the cypress module. These are useful if
    // you want to build a customized operator interface.
    // Button button = new DigitalIOButton(1);

    // There are a few additional built in buttons you can use. Additionally,
    // by subclassing Button you can create custom triggers and bind those to
    // commands the same as any other Button.

    //// TRIGGERING COMMANDS WITH BUTTONS
    // Once you have a button, it's trivial to bind it to a button in one of
    // three ways:

    // Start the command when the button is pressed and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenPressed(new ExampleCommand());

    // Run the command while the button is being held down and interrupt it once
    // the button is released.
    // button.whileHeld(new ExampleCommand());

    // Start the command when the button is released  and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenReleased(new ExampleCommand());

    public OI(){
         LogDebugger.log("OI constructor");

//        btnA.whenPressed(new Lift());
//        btnB.whenPressed(new DeployLifter());
//        btnX.whenPressed(new StowArms());
//        btnLB.whenPressed(new PickUp());
//        btnLB.whenReleased(new CollectorDoNothing());
//        btnRB.whenActive(new SpitOut());
//        btnRB.whenInactive(new CollectorDoNothing());
        btnLT.whenPressed(new PickUp());
        btnLT.whenReleased(new CollectorDoNothing());
        btnRT.whenActive(new SpitOut());
        btnRT.whenInactive(new CollectorDoNothing());
        btnRB.whenReleased(new Shift());
        btnX.whenPressed(new DeployLifter());
        btnY.whenPressed(new Lift());
        btnB.whenPressed(new StowArms());
        btnLB.whenPressed(new ScaleShift());

        btnOtherA.whenPressed(new FlingerNormal());
        btnOtherB.whenPressed(new FlingerOff());
        btnOtherX.whenPressed(new FlingerPowerSavingMode());
        btnOtherY.whenPressed(new FlingerPyrimidSpeed());
        btnOtherRT.whenPressed(new Shoot());
//        btnOtherA.whenPressed(new LEDBlingControl(Bling.MARCH_RWB));
//        btnOtherB.whenPressed(new LEDBlingControl(Bling.METEOR));
//        btnOtherX.whenPressed(new LEDBlingControl(Bling.SHOOT));
//        btnOtherY.whenPressed(new LEDBlingControl(Bling.FADE_PG));
        btnOtherLB.whenPressed(new TiltUp());
        btnOtherLB.whenReleased(new TiltNormal());
        btnOtherRB.whenPressed(new TiltDown());
        btnOtherRB.whenReleased(new TiltNormal());

        bi1.whenPressed(new LEDBlingControl(Bling.MARCH_RWB));
        bi2.whenPressed(new LEDBlingControl(Bling.METEOR));
        bi3.whenPressed(new LEDBlingControl(Bling.SHOOT));
        bi4.whenPressed(new LEDBlingControl(Bling.FADE_PG));
        resetLocation.whenPressed(new ResetDeadReckoner());
        //commandTestLog.whenPressed(new LogCommand())

        //SmartDashboard.putData("Command Test Log", commandTestLog);
        SmartDashboard.putData("Reset Location", resetLocation);
        SmartDashboard.putData("MARCH_RWB", bi1);
        SmartDashboard.putData("METEOR", bi2);
        SmartDashboard.putData("SHOOT", bi3);
        SmartDashboard.putData("FADE_PG", bi4);
        SmartDashboard.putData("flinger Normal", new FlingerNormal());
        SmartDashboard.putData("flinger power saving mode", new FlingerPowerSavingMode());
        SmartDashboard.putData("Flinger off", new FlingerOff());
        SmartDashboard.putData("flinger Pyramid mode", new FlingerPyrimidSpeed());
	SmartDashboard.putData("Tune PID", new TunePID());

    }

    public double leftUpDown () {
        SmartDashboard.putNumber("Stick Axis Left", stick.getRawAxis(2));
        return stick.getRawAxis(2);

    }
    public double rightUpDown () {
        SmartDashboard.putNumber("Stick Axis Right", stick.getRawAxis(5));
        return stick.getRawAxis(5);
    }

}


text:
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';

import { BadgeComponent } from './badge/badge.component';
import { BannerComponent } from './banner/banner.component';

import { BreadcrumbsComponent } from './breadcrumbs/breadcrumbs.component';

import { ButtonComponent } from './button/button.component';
import { ButtonGroupComponent } from './button/button.group.component';

import { CardComponent } from './card/card.component';

import { CardSectionComponent } from './card/card.section.component';

import { CheckboxComponent } from './checkbox/checkbox.component';
import { ChoiceComponent } from './choice/choice.component';
import { ChoiceListComponent } from './choice.list/choice.list.component';

import { HeaderComponent } from './card/header.component';

import { IconComponent } from './icon/icon.component';

import { LabelComponent } from './label/label.component';
import { LabelledComponent } from './labelled/labelled.component';

import { LayoutComponent, SectionedLayoutComponent } from './layout/layout.component';
import { LayoutAnnotatedSectionComponent } from './layout/layout.annotated.section.component';
import { SectionComponent } from './layout/section.component';

import { PageComponent } from './page/page.component';
import { PageHeaderComponent } from './page/page.header.component';

import { PaginationComponent } from './pagination/pagination.component';

import { RadioButtonComponent } from './radio.button';

import { ResourceListComponent } from './resource.list/resource.list.component';
import { ResourceListItemComponent } from './resource.list/resource.list.item.component';

import { SelectComponent } from './select/select.component';

import { StackComponent } from './stack/stack.component';
import { StackItemComponent } from './stack/stack.item.component';

import { TextFieldComponent } from './text.field/text.field.component';
import { SpinnerComponent } from './text.field/spinner.component';
import { ResizerComponent } from './text.field/resizer.component';

import { TemplateOrStringComponent } from './utilities/template.or.string.component';

import { ThumbnailComponent } from './thumbnail/thumbnail.component';

import { VisuallyHiddenComponent } from './visually.hidden/visually.hidden.component';

import { UnstyledLinkComponent } from './unstyled.link/unstyled.link.component';

import { WysiwygComponent } from './wysiwyg/wysiwyg.component';

export * from './types';

const components = [
    BadgeComponent,
    BannerComponent,
    BreadcrumbsComponent,
    ButtonComponent,
    ButtonGroupComponent,
    CardComponent,
    CardSectionComponent,
    CheckboxComponent,
    ChoiceComponent,
    ChoiceListComponent,
    HeaderComponent,
    IconComponent,
    LabelComponent,
    LabelledComponent,
    LayoutAnnotatedSectionComponent,
    LayoutComponent,
    PageComponent,
    PageHeaderComponent,
    PaginationComponent,
    RadioButtonComponent,
    ResizerComponent,
    ResourceListComponent,
    ResourceListItemComponent,
    SectionComponent,
    SectionedLayoutComponent,
    SelectComponent,
    SpinnerComponent,
    StackComponent,
    StackItemComponent,
    TemplateOrStringComponent,
    TextFieldComponent,
    ThumbnailComponent,
    UnstyledLinkComponent,
    VisuallyHiddenComponent,
    WysiwygComponent,
];

@NgModule({
    imports: [
        CommonModule,
        RouterModule,
        FormsModule,
    ],
    declarations: components,
    exports: components
})
export class AngularPolarisModule {
    // static forRoot(): ModuleWithProviders {
    //     return {
    //         ngModule: AngularPolarisModule,
    //         providers: []
    //     };
    // }
}


text:
<?php declare(strict_types = 1);

namespace Nextras\Orm\Collection\Functions;

use function array_sum;

class SumAggregateFunction extends BaseAggregateFunction
{
	public function __construct()
	{
		parent::__construct('SUM');
	}

	protected function calculateAggregation(array $values)
	{
		return array_sum($values);
	}
}


text:
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from . import settings as dju_settings

def validate_email_domain(email):
    """ Validates email domain by blacklist. """
    try:
        domain = email.split('@', 1)[1].lower().strip()
    except IndexError:
        return
    if domain in dju_settings.DJU_EMAIL_DOMAIN_BLACK_LIST:
        raise ValidationError(_(u'Email with domain "%(domain)s" is disallowed.'),
                              code='banned_domain', params={'domain': domain})


text:
create extension hstore;

create table face_local_data
(
	id serial not null
		constraint face_local_data_pkey
			primary key,
	name varchar not null,
	feature integer[],
	status integer default 0 not null,
	face_img varchar,
	attended_at integer
)
;

create unique index face_local_data_name_uindex
	on face_local_data (name)
;

# face distance compare
# only useful when you use Postgresql
CREATE EXTENSION IF NOT EXISTS cube;

DROP FUNCTION IF EXISTS rogue_public_compare_face(target_feature INTEGER[128], OUT target_id INTEGER, OUT targer_diff NUMERIC);
CREATE FUNCTION rogue_public_compare_face(target_feature INTEGER[128], OUT target_id INTEGER, OUT targer_diff NUMERIC) AS $$
DECLARE
    face_recrod RECORD;
BEGIN
    SELECT id, feature INTO face_recrod FROM public.face_local_data ORDER BY cube(feature) <-> cube(target_feature) LIMIT 1;
    target_id = face_recrod.id;
    targer_diff = cube(face_recrod.feature) <-> cube(target_feature);
END;
$$ LANGUAGE plpgsql;

# random face vector
DROP FUNCTION IF EXISTS random_face(line_count INTEGER);
CREATE FUNCTION random_face(line_count INTEGER) RETURNS void AS $$
DECLARE
    random_array INTEGER[128];
BEGIN
    FOR line IN 1..$1 LOOP
        FOR i IN 1..128 LOOP
            random_array[i] = random() * (5000 - (-5000) +1) + (-5000);
        END LOOP;
        INSERT INTO public.face_local_data(name, feature) VALUES ('test' || line, random_array);
    END LOOP;
END;
$$ LANGUAGE plpgsql;


text:
package avonbo.snippets.java.ruleengine.simplerules;

public class Person {

	int age;

	String name;

	public int getAge() {
		return age;
	}

	public String getName() {
		return name;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "Person [age=" + age + ", name=" + name + "]";
	}

}