// Path: rsql-api-parent/rsql-api-core/src/main/java/com/github/vineey/rql/core/util/StringUtils.java
// public class StringUtils {
//     public static boolean isEmpty(String time) {
//       return time == null || time.isEmpty();
//     }
// 
//     public static boolean isNotEmpty(String time) {
//         return !isEmpty(time);
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/SelectContext.java
// public class SelectContext<T, E extends SelectParam> {
// 
//     private SelectBuilder<T, E> selectBuilder;
//     private E selectParam;
// 
//     public static <T, E extends SelectParam> SelectContext<T, E> withBuilderAndParam(SelectBuilder<T, E> builder, E sortParam) {
//         return new SelectContext<T, E>()
//                 .setSelectBuilder(builder)
//                 .setSelectParam(sortParam);
//     }
// 
//     public SelectBuilder<T, E> getSelectBuilder() {
//         return selectBuilder;
//     }
// 
//     public SelectContext setSelectBuilder(SelectBuilder<T, E> selectBuilder) {
//         this.selectBuilder = selectBuilder;
//         return this;
//     }
// 
//     public E getSelectParam() {
//         return selectParam;
//     }
// 
//     public SelectContext<T, E> setSelectParam(E sortParam) {
//         this.selectParam = sortParam;
//         return this;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/SelectParam.java
// public class SelectParam {
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/parser/ast/SelectNodeList.java
// public class SelectNodeList {
//     private List<String> fields = new ArrayList<>();
// 
//     public SelectNodeList(List<String> fields) {
//         this.fields = fields;
//     }
// 
//     public List<String> getFields() {
//         return fields;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/parser/ast/SelectTokenParserAdapter.java
// public class SelectTokenParserAdapter {
//     public SelectNodeList parse(String sortExpression) {
//         try {
//             return new SelectNodeList(createParser(sortExpression).parse());
//         } catch (ParseException | Error e) {
//             throw new SelectParsingException(e);
//         }
//     }
// 
//     private SelectTokenParser createParser(String expression) {
//         ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(expression.getBytes(StandardCharsets.UTF_8));
//         return new SelectTokenParser(byteArrayInputStream, StandardCharsets.UTF_8.name());
// 
//     }
// 
// }


import java.util.Collections;
import com.github.vineey.rql.core.util.StringUtils;
import com.github.vineey.rql.select.SelectContext;
import com.github.vineey.rql.select.SelectParam;
import com.github.vineey.rql.select.parser.ast.SelectNodeList;
import com.github.vineey.rql.select.parser.ast.SelectTokenParserAdapter;
/*
* MIT License
* 
* Copyright (c) 2016 John Michael Vincent S. Rustia
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* 
*/
package com.github.vineey.rql.select.parser;



/**
 * @author vrustia - 5/9/16.
 */
public class DefaultSelectParser implements SelectParser {
    @Override
    public <T, E extends SelectParam> T parse(String selectExpression, SelectContext<T, E> selectContext) {
        E selectParam = selectContext.getSelectParam();
// Path: rsql-api-parent/rsql-api-core/src/main/java/com/github/vineey/rql/core/util/StringUtils.java
// public class StringUtils {
//     public static boolean isEmpty(String time) {
//       return time == null || time.isEmpty();
//     }
// 
//     public static boolean isNotEmpty(String time) {
//         return !isEmpty(time);
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/SelectContext.java
// public class SelectContext<T, E extends SelectParam> {
// 
//     private SelectBuilder<T, E> selectBuilder;
//     private E selectParam;
// 
//     public static <T, E extends SelectParam> SelectContext<T, E> withBuilderAndParam(SelectBuilder<T, E> builder, E sortParam) {
//         return new SelectContext<T, E>()
//                 .setSelectBuilder(builder)
//                 .setSelectParam(sortParam);
//     }
// 
//     public SelectBuilder<T, E> getSelectBuilder() {
//         return selectBuilder;
//     }
// 
//     public SelectContext setSelectBuilder(SelectBuilder<T, E> selectBuilder) {
//         this.selectBuilder = selectBuilder;
//         return this;
//     }
// 
//     public E getSelectParam() {
//         return selectParam;
//     }
// 
//     public SelectContext<T, E> setSelectParam(E sortParam) {
//         this.selectParam = sortParam;
//         return this;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/SelectParam.java
// public class SelectParam {
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/parser/ast/SelectNodeList.java
// public class SelectNodeList {
//     private List<String> fields = new ArrayList<>();
// 
//     public SelectNodeList(List<String> fields) {
//         this.fields = fields;
//     }
// 
//     public List<String> getFields() {
//         return fields;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/parser/ast/SelectTokenParserAdapter.java
// public class SelectTokenParserAdapter {
//     public SelectNodeList parse(String sortExpression) {
//         try {
//             return new SelectNodeList(createParser(sortExpression).parse());
//         } catch (ParseException | Error e) {
//             throw new SelectParsingException(e);
//         }
//     }
// 
//     private SelectTokenParser createParser(String expression) {
//         ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(expression.getBytes(StandardCharsets.UTF_8));
//         return new SelectTokenParser(byteArrayInputStream, StandardCharsets.UTF_8.name());
// 
//     }
// 
// }


// Path: rsql-api-parent/rsql-api-select/src/main/java/com/github/vineey/rql/select/parser/DefaultSelectParser.java
import java.util.Collections;
import com.github.vineey.rql.core.util.StringUtils;
import com.github.vineey.rql.select.SelectContext;
import com.github.vineey.rql.select.SelectParam;
import com.github.vineey.rql.select.parser.ast.SelectNodeList;
import com.github.vineey.rql.select.parser.ast.SelectTokenParserAdapter;

/*
* MIT License
* 
* Copyright (c) 2016 John Michael Vincent S. Rustia
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* 
*/
package com.github.vineey.rql.select.parser;



/**
 * @author vrustia - 5/9/16.
 */
public class DefaultSelectParser implements SelectParser {
    @Override
    public <T, E extends SelectParam> T parse(String selectExpression, SelectContext<T, E> selectContext) {
        E selectParam = selectContext.getSelectParam();
        SelectNodeList selectNodeList = StringUtils.isNotEmpty(selectExpression) ? new SelectTokenParserAdapter().parse(selectExpression) : new SelectNodeList(Collections.EMPTY_LIST);