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

iot.jcypher.query.values.JcNumber Maven / Gradle / Ivy

Go to download

Provides seamlessly integrated Java access to graph databases (Neo4J) at different levels of abstraction.

There is a newer version: 4.2.0
Show newest version
/************************************************************************
 * Copyright (c) 2014 IoT-Solutions e.U.
 * 
 * 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 iot.jcypher.query.values;

import iot.jcypher.domainquery.internal.QueryRecorder;
import iot.jcypher.query.values.functions.FUNCTION;
import iot.jcypher.query.values.operators.OPERATOR;

public class JcNumber extends JcPrimitive {

	JcNumber() {
		super();
	}
	
	/**
	 * 
JCYPHER
*
create a number initialized with a value
*
*/ public JcNumber(Number number) { this(number, null, null); } /** *
JCYPHER
*
create a number which is identified by a name
*
*/ public JcNumber(String name) { this(name, null, null, null); } /** *
JCYPHER
*
create a number which is identified by a name and initialized with a value
*
*/ public JcNumber(String name, Number number) { this(name, number, null, null); } JcNumber(Object val, ValueElement predecessor, IOperatorOrFunction opf) { this(null, val, predecessor, opf); } JcNumber(String name, Object val, ValueElement predecessor, IOperatorOrFunction opf) { super(name, val, predecessor, opf); } /** *
JCYPHER
*
return the result of adding two numbers, return a JcNumber
*
*/ public JcNumber plus(Number val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.PLUS); QueryRecorder.recordInvocationConditional(this, "plus", ret, QueryRecorder.literal(val)); return ret; } /** *
JCYPHER
*
return the result of adding two numbers, return a JcNumber
*
*/ public JcNumber plus(JcNumber val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.PLUS); QueryRecorder.recordInvocationConditional(this, "plus", ret, QueryRecorder.placeHolder(val)); return ret; } /** *
JCYPHER
*
return the result of subtracting two numbers, return a JcNumber
*
*/ public JcNumber minus(Number val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MINUS); QueryRecorder.recordInvocationConditional(this, "minus", ret, QueryRecorder.literal(val)); return ret; } /** *
JCYPHER
*
return the result of subtracting two numbers, return a JcNumber
*
*/ public JcNumber minus(JcNumber val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MINUS); QueryRecorder.recordInvocationConditional(this, "minus", ret, QueryRecorder.placeHolder(val)); return ret; } /** *
JCYPHER
*
return the result of multiplying two numbers, return a JcNumber
*
*/ public JcNumber mult(Number val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MULT); QueryRecorder.recordInvocationConditional(this, "mult", ret, QueryRecorder.literal(val)); return ret; } /** *
JCYPHER
*
return the result of multiplying two numbers, return a JcNumber
*
*/ public JcNumber mult(JcNumber val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MULT); QueryRecorder.recordInvocationConditional(this, "mult", ret, QueryRecorder.placeHolder(val)); return ret; } /** *
JCYPHER
*
return the result of dividing a number by another number, return a JcNumber
*
*/ public JcNumber div(Number val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.DIV); QueryRecorder.recordInvocationConditional(this, "div", ret, QueryRecorder.literal(val)); return ret; } /** *
JCYPHER
*
return the result of dividing a number by another number, return a JcNumber
*
*/ public JcNumber div(JcNumber val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.DIV); QueryRecorder.recordInvocationConditional(this, "div", ret, QueryRecorder.placeHolder(val)); return ret; } /** *
JCYPHER
*
return the remainder of dividing one number by another, return a JcNumber
*
*/ public JcNumber mod(Number val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MOD); QueryRecorder.recordInvocationConditional(this, "mod", ret, QueryRecorder.literal(val)); return ret; } /** *
JCYPHER
*
return the remainder of dividing one number by another, return a JcNumber
*
*/ public JcNumber mod(JcNumber val) { JcNumber ret = new JcNumber(val, this, OPERATOR.Number.MOD); QueryRecorder.recordInvocationConditional(this, "mod", ret, QueryRecorder.placeHolder(val)); return ret; } /** *
JCYPHER
*
return a number raised to the power of another number, return a JcNumber
*
*/ public JcNumber pow(Number exponent) { JcNumber ret = new JcNumber(exponent, this, OPERATOR.Number.POW); QueryRecorder.recordInvocationConditional(this, "pow", ret, QueryRecorder.literal(exponent)); return ret; } /** *
JCYPHER
*
return a number raised to the power of another number, return a JcNumber
*
*/ public JcNumber pow(JcNumber exponent) { JcNumber ret = new JcNumber(exponent, this, OPERATOR.Number.POW); QueryRecorder.recordInvocationConditional(this, "pow", ret, QueryRecorder.placeHolder(exponent)); return ret; } /** *
JCYPHER
*
enclose an expression with brackets
*
e.g. a.numberProperty("amount").div(b.numberProperty("amount"))
.enclose().mult(2)
*
maps to an expression (a.amount / b.amount) * 2
*
*/ public JcNumber enclose() { JcNumber ret = new JcNumber(null, this, new FunctionInstance(FUNCTION.Common.ENCLOSE, 1)); QueryRecorder.recordInvocationConditional(this, "enclose", ret); return ret; } /** *
JCYPHER
*
access mathematical functions
*
*/ public MathFunctions math() { MathFunctions ret = new MathFunctions(this); QueryRecorder.recordInvocationConditional(this, "math", ret); return ret; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy