Top Description Fields Constructors Methods
org.h2.expression.function

public final Class BitFunction

extends Function1_2
Class Inheritance
Static Imports
org.h2.util.Bits.LONG_VH_BE

A bitwise function.

Field Summary

Modifier and TypeField and Description
public static final int
BITAND

BITAND() (non-standard).

public static final int
BITCOUNT

BITCOUNT() (non-standard).

public static final int
BITGET

BITGET() (non-standard).

public static final int
BITNAND

BITNAND() (non-standard).

public static final int
BITNOR

BITNOR() (non-standard).

public static final int
BITNOT

BITNOT() (non-standard).

public static final int
BITOR

BITOR() (non-standard).

public static final int
BITXNOR

BITXNOR() (non-standard).

public static final int
BITXOR

BITXOR() (non-standard).

private final int
public static final int
LSHIFT

LSHIFT() (non-standard).

private static final String[]
public static final int
ROTATELEFT

ROTATELEFT() (non-standard).

public static final int
ROTATERIGHT

ROTATERIGHT() (non-standard).

public static final int
RSHIFT

RSHIFT() (non-standard).

public static final int
ULSHIFT

ULSHIFT() (non-standard).

public static final int
URSHIFT

URSHIFT() (non-standard).

Constructor Summary

AccessConstructor and Description
public
BitFunction(Expression arg1, Expression arg2, int function)

Method Summary

Modifier and TypeMethod and Description
private static ValueBigint
private static ValueBoolean
bitGet(Value v1, Value v2)

public static TypeInfo

Returns:

the type of the specified argument
checkArgType
(Expression
the argument
arg
)

Checks the type of an argument of bitwise function (one of BITAND, BITOR, BITXOR, BITNOT, BITNAND, BITNOR, BITXNOR).

private static Value
getBinaryString(int function, TypeInfo type, Value v1, Value v2)

public static Value

Returns:

the resulting value
getBitwise
(int function, TypeInfo
the type of result
type
,
Value
the value of first argument
v1
,
Value
the value of second argument, or null
v2
)

Computes the value of bitwise function.

private static TypeInfo
public String
private static Value
getNumeric(int function, TypeInfo type, Value v1, Value v2)

public Value
getValue(SessionLocal
the session
session
,
Value
the value of first argument
v1
,
Value
the value of second argument, or null
v2
)

Overrides org.h2.expression.function.Function1_2.getValue.

Returns the value of this function.

public Expression
optimize(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.optimize.

Try to optimize the expression.

private Expression
private static Value
rotate(Value v1, long offset, boolean right)

private static Value
shift(Value v1, long offset, boolean unsigned)

Inherited from org.h2.expression.function.Function1_2:
getUnenclosedSQLgetValue

Field Detail

BITANDback to summary
public static final int BITAND

BITAND() (non-standard).

BITCOUNTback to summary
public static final int BITCOUNT

BITCOUNT() (non-standard).

BITGETback to summary
public static final int BITGET

BITGET() (non-standard).

BITNANDback to summary
public static final int BITNAND

BITNAND() (non-standard).

BITNORback to summary
public static final int BITNOR

BITNOR() (non-standard).

BITNOTback to summary
public static final int BITNOT

BITNOT() (non-standard).

BITORback to summary
public static final int BITOR

BITOR() (non-standard).

BITXNORback to summary
public static final int BITXNOR

BITXNOR() (non-standard).

BITXORback to summary
public static final int BITXOR

BITXOR() (non-standard).

functionback to summary
private final int function
LSHIFTback to summary
public static final int LSHIFT

LSHIFT() (non-standard).

NAMESback to summary
private static final String[] NAMES
ROTATELEFTback to summary
public static final int ROTATELEFT

ROTATELEFT() (non-standard).

ROTATERIGHTback to summary
public static final int ROTATERIGHT

ROTATERIGHT() (non-standard).

RSHIFTback to summary
public static final int RSHIFT

RSHIFT() (non-standard).

ULSHIFTback to summary
public static final int ULSHIFT

ULSHIFT() (non-standard).

URSHIFTback to summary
public static final int URSHIFT

URSHIFT() (non-standard).

Constructor Detail

BitFunctionback to summary
public BitFunction(Expression arg1, Expression arg2, int function)

Method Detail

bitCountback to summary
private static ValueBigint bitCount(Value v1)
bitGetback to summary
private static ValueBoolean bitGet(Value v1, Value v2)
checkArgTypeback to summary
public static TypeInfo checkArgType(Expression arg)

Checks the type of an argument of bitwise function (one of BITAND, BITOR, BITXOR, BITNOT, BITNAND, BITNOR, BITXNOR).

Parameters
arg:Expression

the argument

Returns:TypeInfo

the type of the specified argument

Exceptions
DbException:
if argument type is not supported by bitwise functions
getBinaryStringback to summary
private static Value getBinaryString(int function, TypeInfo type, Value v1, Value v2)
getBitwiseback to summary
public static Value getBitwise(int function, TypeInfo type, Value v1, Value v2)

Computes the value of bitwise function.

Parameters
function:int

one of BITAND, BITOR, BITXOR, BITNOT, BITNAND, BITNOR, BITXNOR

type:TypeInfo

the type of result

v1:Value

the value of first argument

v2:Value

the value of second argument, or null

Returns:Value

the resulting value

getCommonTypeback to summary
private static TypeInfo getCommonType(Expression arg1, Expression arg2)
getNameback to summary
public String getName()

Implements org.h2.expression.function.NamedExpression.getName.

Doc from org.h2.expression.function.NamedExpression.getName.

Get the name.

Returns:String

the name in uppercase

Annotations
@Override
getNumericback to summary
private static Value getNumeric(int function, TypeInfo type, Value v1, Value v2)
getValueback to summary
public Value getValue(SessionLocal session, Value v1, Value v2)

Overrides org.h2.expression.function.Function1_2.getValue.

Doc from org.h2.expression.function.Function1_2.getValue.

Returns the value of this function.

Parameters
session:SessionLocal

the session

v1:Value

the value of first argument

v2:Value

the value of second argument, or null

Returns:Value

the resulting value

Annotations
@Override
optimizeback to summary
public Expression optimize(SessionLocal session)

Implements abstract org.h2.expression.Expression.optimize.

Doc from org.h2.expression.Expression.optimize.

Try to optimize the expression.

Parameters
session:SessionLocal

the session

Returns:Expression

the optimized expression

Annotations
@Override
optimizeNotback to summary
private Expression optimizeNot(SessionLocal session)
rotateback to summary
private static Value rotate(Value v1, long offset, boolean right)
shiftback to summary
private static Value shift(Value v1, long offset, boolean unsigned)