// Path: src/main/java/com/presidentio/testdatagenerator/cons/PropConst.java
// public class PropConst {
// 
//     public static final String TYPE = "type";
//     public static final String VALUE = "value";
//     public static final String SIZE = "size";
//     public static final String DOMAIN = "domain";
//     public static final String EXPR = "expr";
//     public static final String FILE = "file";
//     public static final String DELIMITER = "delimiter";
//     public static final String ITEMS = "items";
//     public static final String INDEX = "index";
//     public static final String HOST = "host";
//     public static final String PORT = "port";
//     public static final String CLUSTER_NAME = "clusterName";
//     public static final String CONNECTION_URL = "connectionUrl";
//     public static final String JDBC_DRIVER = "jdbcDriver";
//     public static final String DEPTH = "depth";
//     public static final String FIELD = "field";
//     public static final String VAR = "var";
//     public static final String OP = "op";
//     public static final String FORMAT = "format";
//     public static final String HEADER = "header";
//     public static final String SUFFIX = "suffix";
//     public static final String PREFIX = "prefix";
//     public static final String PATH_PROVIDER = "pathProvider";
//     public static final String BROKER_LIST = "brokerList";
//     public static final String GENDER = "gender";
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/context/Context.java
// public class Context {
// 
//     private Parent parent;
// 
//     private Map<String, Template> templates;
// 
//     private Map<String, Object> variables;
// 
//     private Sink sink;
// 
//     public Context(Map<String, Template> templates, Map<String, Object> variables, Sink sink) {
//         this.templates = templates;
//         this.variables = variables;
//         this.sink = sink;
//     }
// 
//     public Context(Context parentContext, Map<String, Object> entity) {
//         parent = new Parent(entity, parentContext.getParent());
//         templates = parentContext.getTemplates();
//         variables = parentContext.getVariables();
//         sink = parentContext.getSink();
//     }
// 
//     public Parent getParent() {
//         return parent;
//     }
// 
//     public Map<String, Object> getVariables() {
//         return variables;
//     }
// 
//     public Sink getSink() {
//         return sink;
//     }
// 
//     public Map<String, Template> getTemplates() {
//         return templates;
//     }
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/model/Field.java
// public class Field {
// 
//     private String name;
// 
//     private String type;
// 
//     private Provider provider;
// 
//     public Field() {
//     }
// 
//     public Field(String name, String type, Provider provider) {
//         this.name = name;
//         this.type = type;
//         this.provider = provider;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Provider getProvider() {
//         return provider;
//     }
// 
//     public void setProvider(Provider provider) {
//         this.provider = provider;
//     }
// }


import com.presidentio.testdatagenerator.context.Context;
import com.presidentio.testdatagenerator.model.Field;
import java.util.Map;
import com.presidentio.testdatagenerator.cons.PropConst;
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.presidentio.testdatagenerator.provider;



public class CounterProvider implements ValueProvider {

    public static final String INC = "++";
    public static final String DEC = "--";
    public static final String EQ = "==";

    private String var;

    private String op = "++";

    @Override
    public void init(Map<String, String> props) {
        if (props.containsKey(PropConst.OP)) {
            op = props.get(PropConst.OP);
        }
        var = props.get(PropConst.VAR);
        if (var == null) {
            throw new IllegalArgumentException("Var does not specified or null");
        }
    }

    @Override
    public Object nextValue(Context context, Field field) {
        Map<String, Object> vars = context.getVariables();
        Long varVal;
        synchronized (context.getVariables()) {
            varVal = Long.valueOf(vars.get(var).toString());
            if (varVal == null) {
                varVal = 0L;
            }
            Long newVal;

// Path: src/main/java/com/presidentio/testdatagenerator/cons/PropConst.java
// public class PropConst {
// 
//     public static final String TYPE = "type";
//     public static final String VALUE = "value";
//     public static final String SIZE = "size";
//     public static final String DOMAIN = "domain";
//     public static final String EXPR = "expr";
//     public static final String FILE = "file";
//     public static final String DELIMITER = "delimiter";
//     public static final String ITEMS = "items";
//     public static final String INDEX = "index";
//     public static final String HOST = "host";
//     public static final String PORT = "port";
//     public static final String CLUSTER_NAME = "clusterName";
//     public static final String CONNECTION_URL = "connectionUrl";
//     public static final String JDBC_DRIVER = "jdbcDriver";
//     public static final String DEPTH = "depth";
//     public static final String FIELD = "field";
//     public static final String VAR = "var";
//     public static final String OP = "op";
//     public static final String FORMAT = "format";
//     public static final String HEADER = "header";
//     public static final String SUFFIX = "suffix";
//     public static final String PREFIX = "prefix";
//     public static final String PATH_PROVIDER = "pathProvider";
//     public static final String BROKER_LIST = "brokerList";
//     public static final String GENDER = "gender";
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/context/Context.java
// public class Context {
// 
//     private Parent parent;
// 
//     private Map<String, Template> templates;
// 
//     private Map<String, Object> variables;
// 
//     private Sink sink;
// 
//     public Context(Map<String, Template> templates, Map<String, Object> variables, Sink sink) {
//         this.templates = templates;
//         this.variables = variables;
//         this.sink = sink;
//     }
// 
//     public Context(Context parentContext, Map<String, Object> entity) {
//         parent = new Parent(entity, parentContext.getParent());
//         templates = parentContext.getTemplates();
//         variables = parentContext.getVariables();
//         sink = parentContext.getSink();
//     }
// 
//     public Parent getParent() {
//         return parent;
//     }
// 
//     public Map<String, Object> getVariables() {
//         return variables;
//     }
// 
//     public Sink getSink() {
//         return sink;
//     }
// 
//     public Map<String, Template> getTemplates() {
//         return templates;
//     }
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/model/Field.java
// public class Field {
// 
//     private String name;
// 
//     private String type;
// 
//     private Provider provider;
// 
//     public Field() {
//     }
// 
//     public Field(String name, String type, Provider provider) {
//         this.name = name;
//         this.type = type;
//         this.provider = provider;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Provider getProvider() {
//         return provider;
//     }
// 
//     public void setProvider(Provider provider) {
//         this.provider = provider;
//     }
// }


// Path: src/main/java/com/presidentio/testdatagenerator/provider/CounterProvider.java
import com.presidentio.testdatagenerator.context.Context;
import com.presidentio.testdatagenerator.model.Field;
import java.util.Map;
import com.presidentio.testdatagenerator.cons.PropConst;

/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.presidentio.testdatagenerator.provider;



public class CounterProvider implements ValueProvider {

    public static final String INC = "++";
    public static final String DEC = "--";
    public static final String EQ = "==";

    private String var;

    private String op = "++";

    @Override
    public void init(Map<String, String> props) {
        if (props.containsKey(PropConst.OP)) {
            op = props.get(PropConst.OP);
        }
        var = props.get(PropConst.VAR);
        if (var == null) {
            throw new IllegalArgumentException("Var does not specified or null");
        }
    }

    @Override
    public Object nextValue(Context context, Field field) {
        Map<String, Object> vars = context.getVariables();
        Long varVal;
        synchronized (context.getVariables()) {
            varVal = Long.valueOf(vars.get(var).toString());
            if (varVal == null) {
                varVal = 0L;
            }
            Long newVal;

            switch (op) {