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

org.vertexium.cypher.functions.math.SignFunction Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.cypher.functions.math;

import org.vertexium.cypher.VertexiumCypherQueryContext;

public class SignFunction extends CypherUnaryMathFunction {
    @Override
    protected Object invokeDouble(VertexiumCypherQueryContext ctx, double value) {
        if (value == 0) {
            return 0;
        }
        if (value < 0) {
            return -1;
        }
        return 1;
    }

    @Override
    protected Object invokeLong(VertexiumCypherQueryContext ctx, long value) {
        if (value == 0) {
            return 0;
        }
        if (value < 0) {
            return -1;
        }
        return 1;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy