[jOOQ/jOOQ#11061] [jOOQ/jOOQ#11070] [jOOQ/jOOQ#11091] ATAN2
This commit is contained in:
parent
d0ea8f0e82
commit
c398201671
121
jOOQ/src/main/java/org/jooq/impl/Atan2.java
Normal file
121
jOOQ/src/main/java/org/jooq/impl/Atan2.java
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
|
||||
* database integrations.
|
||||
*
|
||||
* For more information, please visit: http://www.jooq.org/licenses
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.*;
|
||||
import static org.jooq.impl.Internal.*;
|
||||
import static org.jooq.impl.Keywords.*;
|
||||
import static org.jooq.impl.Names.*;
|
||||
import static org.jooq.impl.SQLDataType.*;
|
||||
import static org.jooq.impl.Tools.*;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.*;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import org.jooq.*;
|
||||
import org.jooq.impl.*;
|
||||
import org.jooq.tools.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>ATAN2</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class Atan2
|
||||
extends
|
||||
AbstractField<BigDecimal>
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Field<? extends Number> x;
|
||||
private final Field<? extends Number> y;
|
||||
|
||||
Atan2(
|
||||
Field<? extends Number> x,
|
||||
Field<? extends Number> y
|
||||
) {
|
||||
super(N_ATAN2, allNotNull(NUMERIC, x, y));
|
||||
|
||||
this.x = nullSafeNotNull(x, INTEGER);
|
||||
this.y = nullSafeNotNull(y, INTEGER);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(function(N_ATAN2, getDataType(), x, y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof Atan2) {
|
||||
return
|
||||
StringUtils.equals(x, ((Atan2) that).x) &&
|
||||
StringUtils.equals(y, ((Atan2) that).y)
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
@ -14924,6 +14924,42 @@ public class DSL {
|
||||
return new Ascii(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>ATAN2</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Number x, Number y) {
|
||||
return new Atan2(Tools.field(x), Tools.field(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>ATAN2</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Number x, Field<? extends Number> y) {
|
||||
return new Atan2(Tools.field(x), y);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>ATAN2</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Field<? extends Number> x, Number y) {
|
||||
return new Atan2(x, Tools.field(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>ATAN2</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Field<? extends Number> x, Field<? extends Number> y) {
|
||||
return new Atan2(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>BIT_LENGTH</code> function.
|
||||
* <p>
|
||||
@ -20575,52 +20611,6 @@ public class DSL {
|
||||
return new Atan(Tools.nullSafe(field));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the atan2(field, y) function.
|
||||
*
|
||||
* @see #atan2(Field, Field)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Number x, Number y) {
|
||||
return atan2(Tools.field(x), Tools.field(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the atan2(field, y) function.
|
||||
*
|
||||
* @see #atan2(Field, Field)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Number x, Field<? extends Number> y) {
|
||||
return atan2(Tools.field(x), Tools.nullSafe(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the atan2(field, y) function.
|
||||
*
|
||||
* @see #atan2(Field, Field)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Field<? extends Number> x, Number y) {
|
||||
return atan2(Tools.nullSafe(x), Tools.field(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the atan2(field, y) function.
|
||||
* <p>
|
||||
* This renders the atan2 or atn2 function where available:
|
||||
* <code><pre>atan2([x], [y]) or
|
||||
* atn2([x], [y])</pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
public static Field<BigDecimal> atan2(Field<? extends Number> x, Field<? extends Number> y) {
|
||||
return new DefaultAggregateFunction<>(Term.ATAN2, SQLDataType.NUMERIC, Tools.nullSafe(x), Tools.nullSafe(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tangent(field) function.
|
||||
*
|
||||
|
||||
@ -67,7 +67,9 @@ final class Names {
|
||||
static final Name N_ASCII_VAL = unquotedName("ascii_val");
|
||||
static final Name N_ASIN = unquotedName("asin");
|
||||
static final Name N_ATAN = unquotedName("atan");
|
||||
static final Name N_ATAN2 = unquotedName("atan2");
|
||||
static final Name N_ATN = unquotedName("atn");
|
||||
static final Name N_ATN2 = unquotedName("atn2");
|
||||
static final Name N_BIT_COUNT = unquotedName("bit_count");
|
||||
static final Name N_BIT_LENGTH = unquotedName("bit_length");
|
||||
static final Name N_BOOL_AND = unquotedName("bool_and");
|
||||
|
||||
@ -51,21 +51,6 @@ import org.jooq.SQLDialect;
|
||||
@Deprecated
|
||||
enum Term {
|
||||
|
||||
ATAN2 {
|
||||
@Override
|
||||
public String translate(SQLDialect dialect) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return "atan2";
|
||||
}
|
||||
},
|
||||
STDDEV_POP {
|
||||
@Override
|
||||
public String translate(SQLDialect dialect) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user