// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/SortContext.java
// public class SortContext<T, E extends SortParam> {
//     private SortBuilder<T, E> sortBuilder;
//     private E sortParam;
// 
//     public static <T, E extends SortParam> SortContext<T, E> withBuilderAndParam(SortBuilder<T, E> builder, E sortParam) {
//         return new SortContext<T, E>()
//                 .setSortBuilder(builder)
//                 .setSortParam(sortParam);
//     }
// 
//     public SortBuilder<T, E> getSortBuilder() {
//         return sortBuilder;
//     }
// 
//     public SortContext setSortBuilder(SortBuilder<T, E> sortBuilder) {
//         this.sortBuilder = sortBuilder;
//         return this;
//     }
// 
//     public E getSortParam() {
//         return sortParam;
//     }
// 
//     public SortContext setSortParam(E sortParam) {
//         this.sortParam = sortParam;
//         return this;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/SortParam.java
// public class SortParam {
// }
// 
// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/parser/ast/SortTokenParserAdapter.java
// public class SortTokenParserAdapter {
//     public SortNodeList parse(String sortExpression) {
//         try {
//             return createParser(sortExpression).parse();
//         } catch (ParseException | Error e) {
//             throw new SortParsingException(e);
//         }
//     }
// 
//     private SortTokenParser createParser(String expression) {
//         ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(expression.getBytes(StandardCharsets.UTF_8));
//         return new SortTokenParser(byteArrayInputStream, StandardCharsets.UTF_8.name());
// 
//     }
// }


import com.github.vineey.rql.sort.SortContext;
import com.github.vineey.rql.sort.SortParam;
import com.github.vineey.rql.sort.parser.ast.SortTokenParserAdapter;
/*
* 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.sort.parser;


/**
 * @author vrustia - 4/10/16.
 */
public class DefaultSortParser implements SortParser {

    @Override
// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/SortContext.java
// public class SortContext<T, E extends SortParam> {
//     private SortBuilder<T, E> sortBuilder;
//     private E sortParam;
// 
//     public static <T, E extends SortParam> SortContext<T, E> withBuilderAndParam(SortBuilder<T, E> builder, E sortParam) {
//         return new SortContext<T, E>()
//                 .setSortBuilder(builder)
//                 .setSortParam(sortParam);
//     }
// 
//     public SortBuilder<T, E> getSortBuilder() {
//         return sortBuilder;
//     }
// 
//     public SortContext setSortBuilder(SortBuilder<T, E> sortBuilder) {
//         this.sortBuilder = sortBuilder;
//         return this;
//     }
// 
//     public E getSortParam() {
//         return sortParam;
//     }
// 
//     public SortContext setSortParam(E sortParam) {
//         this.sortParam = sortParam;
//         return this;
//     }
// }
// 
// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/SortParam.java
// public class SortParam {
// }
// 
// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/parser/ast/SortTokenParserAdapter.java
// public class SortTokenParserAdapter {
//     public SortNodeList parse(String sortExpression) {
//         try {
//             return createParser(sortExpression).parse();
//         } catch (ParseException | Error e) {
//             throw new SortParsingException(e);
//         }
//     }
// 
//     private SortTokenParser createParser(String expression) {
//         ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(expression.getBytes(StandardCharsets.UTF_8));
//         return new SortTokenParser(byteArrayInputStream, StandardCharsets.UTF_8.name());
// 
//     }
// }


// Path: rsql-api-parent/rsql-api-sort/src/main/java/com/github/vineey/rql/sort/parser/DefaultSortParser.java
import com.github.vineey.rql.sort.SortContext;
import com.github.vineey.rql.sort.SortParam;
import com.github.vineey.rql.sort.parser.ast.SortTokenParserAdapter;

/*
* 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.sort.parser;


/**
 * @author vrustia - 4/10/16.
 */
public class DefaultSortParser implements SortParser {

    @Override
    public <T, E extends SortParam> T parse(String sortExpression, SortContext<T, E> sortContext) {