Package org.h2.expression.function
Class BitFunction
- java.lang.Object
-
- org.h2.expression.Expression
-
- org.h2.expression.Operation1_2
-
- org.h2.expression.function.Function1_2
-
- org.h2.expression.function.BitFunction
-
- All Implemented Interfaces:
NamedExpression,HasSQL,Typed
public final class BitFunction extends Function1_2
A bitwise function.
-
-
Field Summary
Fields Modifier and Type Field Description static intBITANDBITAND() (non-standard).static intBITCOUNTBITCOUNT() (non-standard).static intBITGETBITGET() (non-standard).static intBITNANDBITNAND() (non-standard).static intBITNORBITNOR() (non-standard).static intBITNOTBITNOT() (non-standard).static intBITORBITOR() (non-standard).static intBITXNORBITXNOR() (non-standard).static intBITXORBITXOR() (non-standard).private intfunctionstatic intLSHIFTLSHIFT() (non-standard).private static java.lang.String[]NAMESstatic intROTATELEFTROTATELEFT() (non-standard).static intROTATERIGHTROTATERIGHT() (non-standard).static intRSHIFTRSHIFT() (non-standard).static intULSHIFTULSHIFT() (non-standard).static intURSHIFTURSHIFT() (non-standard).-
Fields inherited from class org.h2.expression.Operation1_2
left, right, type
-
Fields inherited from class org.h2.expression.Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESES
-
Fields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
-
-
Constructor Summary
Constructors Constructor Description BitFunction(Expression arg1, Expression arg2, int function)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static ValueBigintbitCount(Value v1)private static ValueBooleanbitGet(Value v1, Value v2)static TypeInfocheckArgType(Expression arg)private static ValuegetBinaryString(int function, TypeInfo type, Value v1, Value v2)static ValuegetBitwise(int function, TypeInfo type, Value v1, Value v2)Computes the value of bitwise function.private static TypeInfogetCommonType(Expression arg1, Expression arg2)java.lang.StringgetName()Get the name.private static ValuegetNumeric(int function, TypeInfo type, Value v1, Value v2)ValuegetValue(SessionLocal session, Value v1, Value v2)Returns the value of this function.Expressionoptimize(SessionLocal session)Try to optimize the expression.private ExpressionoptimizeNot(SessionLocal session)private static Valuerotate(Value v1, long offset, boolean right)private static Valueshift(Value v1, long offset, boolean unsigned)-
Methods inherited from class org.h2.expression.function.Function1_2
getUnenclosedSQL, getValue
-
Methods inherited from class org.h2.expression.Operation1_2
getCost, getSubexpression, getSubexpressionCount, getType, isEverything, mapColumns, setEvaluatable, updateAggregate
-
Methods inherited from class org.h2.expression.Expression
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, getWhenSQL, getWhenValue, isConstant, isIdentity, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimizeCondition, toString, writeExpressions, writeExpressions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.h2.util.HasSQL
getTraceSQL
-
-
-
-
Field Detail
-
BITAND
public static final int BITAND
BITAND() (non-standard).- See Also:
- Constant Field Values
-
BITOR
public static final int BITOR
BITOR() (non-standard).- See Also:
- Constant Field Values
-
BITXOR
public static final int BITXOR
BITXOR() (non-standard).- See Also:
- Constant Field Values
-
BITNOT
public static final int BITNOT
BITNOT() (non-standard).- See Also:
- Constant Field Values
-
BITNAND
public static final int BITNAND
BITNAND() (non-standard).- See Also:
- Constant Field Values
-
BITNOR
public static final int BITNOR
BITNOR() (non-standard).- See Also:
- Constant Field Values
-
BITXNOR
public static final int BITXNOR
BITXNOR() (non-standard).- See Also:
- Constant Field Values
-
BITGET
public static final int BITGET
BITGET() (non-standard).- See Also:
- Constant Field Values
-
BITCOUNT
public static final int BITCOUNT
BITCOUNT() (non-standard).- See Also:
- Constant Field Values
-
LSHIFT
public static final int LSHIFT
LSHIFT() (non-standard).- See Also:
- Constant Field Values
-
RSHIFT
public static final int RSHIFT
RSHIFT() (non-standard).- See Also:
- Constant Field Values
-
ULSHIFT
public static final int ULSHIFT
ULSHIFT() (non-standard).- See Also:
- Constant Field Values
-
URSHIFT
public static final int URSHIFT
URSHIFT() (non-standard).- See Also:
- Constant Field Values
-
ROTATELEFT
public static final int ROTATELEFT
ROTATELEFT() (non-standard).- See Also:
- Constant Field Values
-
ROTATERIGHT
public static final int ROTATERIGHT
ROTATERIGHT() (non-standard).- See Also:
- Constant Field Values
-
NAMES
private static final java.lang.String[] NAMES
-
function
private final int function
-
-
Constructor Detail
-
BitFunction
public BitFunction(Expression arg1, Expression arg2, int function)
-
-
Method Detail
-
getValue
public Value getValue(SessionLocal session, Value v1, Value v2)
Description copied from class:Function1_2Returns the value of this function.- Overrides:
getValuein classFunction1_2- Parameters:
session- the sessionv1- the value of first argumentv2- the value of second argument, ornull- Returns:
- the resulting value
-
bitGet
private static ValueBoolean bitGet(Value v1, Value v2)
-
bitCount
private static ValueBigint bitCount(Value v1)
-
getBitwise
public static Value getBitwise(int function, TypeInfo type, Value v1, Value v2)
Computes the value of bitwise function.
-
getBinaryString
private static Value getBinaryString(int function, TypeInfo type, Value v1, Value v2)
-
optimize
public Expression optimize(SessionLocal session)
Description copied from class:ExpressionTry to optimize the expression.- Specified by:
optimizein classExpression- Parameters:
session- the session- Returns:
- the optimized expression
-
optimizeNot
private Expression optimizeNot(SessionLocal session)
-
getCommonType
private static TypeInfo getCommonType(Expression arg1, Expression arg2)
-
checkArgType
public static TypeInfo checkArgType(Expression arg)
Checks the type of an argument of bitwise function (one ofBITAND,BITOR,BITXOR,BITNOT,BITNAND,BITNOR,BITXNOR).- Parameters:
arg- the argument- Returns:
- the type of the specified argument
- Throws:
DbException- if argument type is not supported by bitwise functions
-
getName
public java.lang.String getName()
Description copied from interface:NamedExpressionGet the name.- Returns:
- the name in uppercase
-
-