All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intuit.ipp.query.expr.NumberPath Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2017 Intuit
 *
 * 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
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.intuit.ipp.query.expr;

import com.intuit.ipp.query.Operation;
import com.intuit.ipp.query.Path;

/**
 * Class to generate the query string for number value
 * 
 */
public class NumberPath extends Path {

	/**
	 * Constructor NumberPath
	 * 
	 * @param path
	 *            the path
	 * @param entity
	 *            the entity
	 */
	public NumberPath(String path, String entity) {
		super(path, entity);
	}

	/**
	 * Method to construct the equals expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression eq(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the equals expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression eq(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the equals expression for integer
	 * 
	 * @param value the integer
	 * @return Expression
	 */
	public Expression eq(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the equals expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression eq(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the equals expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression eq(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the equals expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression eq(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.eq, valueString);
	}

	/**
	 * Method to construct the not equals expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression neq(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the not equals expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression neq(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the not equals expression for int
	 * 
	 * @param value the int
	 * @return Expression
	 */
	public Expression neq(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the not equals expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression neq(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the not equals expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression neq(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the not equals expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression neq(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.neq, valueString);
	}

	/**
	 * Method to construct the less than expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression lt(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression lt(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than expression for int
	 * 
	 * @param value the int
	 * @return Expression
	 */
	public Expression lt(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression lt(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression lt(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression lt(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lt, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression lte(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression lte(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for int
	 * 
	 * @param value the int
	 * @return Expression
	 */
	public Expression lte(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression lte(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression lte(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the less than or equals expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression lte(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.lte, valueString);
	}

	/**
	 * Method to construct the greater than expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression gt(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression gt(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than expression for int
	 * 
	 * @param value the int
	 * @return Expression
	 */
	public Expression gt(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression gt(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression gt(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression gt(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gt, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for byte
	 * 
	 * @param value the byte
	 * @return Expression
	 */
	public Expression gte(byte value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for short
	 * 
	 * @param value the short
	 * @return Expression
	 */
	public Expression gte(short value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for int
	 * 
	 * @param value the int
	 * @return Expression
	 */
	public Expression gte(int value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for long
	 * 
	 * @param value the long
	 * @return Expression
	 */
	public Expression gte(long value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for float
	 * 
	 * @param value the float
	 * @return Expression
	 */
	public Expression gte(float value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the greater than or equals expression for double
	 * 
	 * @param value the double
	 * @return Expression
	 */
	public Expression gte(double value) {
		String valueString = "'" + value + "'";
		return new Expression(this, Operation.gte, valueString);
	}

	/**
	 * Method to construct the in expression for byte
	 * 
	 * @param value the byte array
	 * @return Expression
	 */
	public Expression in(Byte[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Byte v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the in expression for short
	 * 
	 * @param value the short array
	 * @return Expression
	 */
	public Expression in(Short[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Short v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the in expression for integer
	 * 
	 * @param value the integer array
	 * @return Expression
	 */
	public Expression in(Integer[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Integer v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the in expression for long
	 * 
	 * @param value the long array
	 * @return Expression
	 */
	public Expression in(Long[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Long v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the in expression for float
	 * 
	 * @param value the float array
	 * @return Expression
	 */
	public Expression in(Float[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Float v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the in expression for double
	 * 
	 * @param value the double array
	 * @return Expression
	 */
	public Expression in(Double[] value) {
		String listNumberString = "";
		Boolean firstNumber = true;
		for (Double v : value) {
			if (firstNumber) {
				listNumberString = listNumberString.concat("('").concat(v.toString()).concat("'");
				firstNumber = false;
			} else {
				listNumberString = listNumberString.concat(", '").concat(v.toString()).concat("'");
			}
		}
		listNumberString = listNumberString.concat(")");
		return new Expression(this, Operation.in, listNumberString);
	}

	/**
	 * Method to construct the between expression for byte
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Byte startValue, Byte endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}

	/**
	 * Method to construct the between expression for short
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Short startValue, Short endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}

	/**
	 * Method to construct the between expression for integer
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Integer startValue, Integer endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}

	/**
	 * Method to construct the between expression for long
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Long startValue, Long endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}

	/**
	 * Method to construct the between expression for float
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Float startValue, Float endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}

	/**
	 * Method to construct the between expression for double
	 * 
	 * @param startValue the start value
	 * @param endValue the end value
	 * @return Expression
	 */
	public Expression between(Double startValue, Double endValue) {
		String valueString = "'" + startValue + "' AND '" + endValue + "'";
		return new Expression(this, Operation.between, valueString);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy