/*
 *  Copyright (c) 2017 Otávio Santana and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   Otavio Santana
 */
package org.jnosql.artemis.graph.query;

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.jnosql.artemis.reflection.ClassRepresentation;

import static org.jnosql.artemis.graph.query.TokenProcessorType.isBetweenToken;
import static org.jnosql.artemis.graph.query.TokenProcessorType.isGraphToken;

final class GraphQueryParserUtil {

    static final String AND = "And";
    static final String EMPTY = "";


    private GraphQueryParserUtil() {
    }

    static GraphTraversal<?, ?> feedTraversal(String token,
                                              int index,
                                              Object[] args,
                                              String methodName,
                                              ClassRepresentation representation,
                                              GraphTraversal<?, ?> traversal) {

        TokenProcessor tokenProcessor = TokenProcessorType.of(token);
        return tokenProcessor.process(token, index, args, methodName, representation, traversal);
    }


    static int and(Object[] args,
                   int index,
                   String token,
                   String methodName,
                   ClassRepresentation representation,
                   GraphTraversal<?, ?> traversal) {
        String field = token.replace(AND, EMPTY);
        feedTraversal(field, index, args, methodName, representation, traversal);

        if (isBetweenToken(token)) {
            return index + 2;
        } else if (isGraphToken(token)) {
            return index;
        } else {
            return ++index;
        }
    }




}

@@ -1079,36 +1079,20 @@
  static 
-GraphTraversal%3C?, ?%3E
+void
  feedTra
@@ -1146,48 +1146,19 @@
     
-    
-            int index,%0A             
+int index,%0A
     
@@ -1183,19 +1183,16 @@
         
-   
 Object%5B%5D
@@ -1198,32 +1198,16 @@
 %5D args,%0A
-                
         
@@ -1277,32 +1277,16 @@
         
-       
-         
 ClassRep
@@ -1313,32 +1313,16 @@
 tation,%0A
-                
         
@@ -1448,24 +1448,24 @@
 token);%0A
+
         
 return t
@@ -1456,23 +1456,16 @@
         
-return 
 tokenPro

Defines return as void