org.vertexium.cypher.functions.math.SignFunction Maven / Gradle / Ivy
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;
}
}