ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/expression/OperationN.java

Path
ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/expression/OperationN.java
Status
scanned
Type
file
Name
OperationN.java
Extension
.java
Programming language
Java
Mime type
text/x-java
File type
Java source, ASCII text
Tag

      
    
Rootfs path

      
    
Size
3154 (3.1 KB)
MD5
ca6cc178754ef5cc66a0990efb4e04aa
SHA1
c48dd17cb24365efec9cccf6d1dbc3ce152cedae
SHA256
002eed553d238ac0c368c685c1de5324df252743070f8176c9486a3964eb91fc
SHA512

      
    
SHA1_git
5ca136a5b5966334f59b5edd88d231b448f3a8f5
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
OperationN.java | 3.1 KB |

/* * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.expression; import java.util.Arrays; import org.h2.engine.SessionLocal; import org.h2.message.DbException; import org.h2.table.ColumnResolver; import org.h2.table.TableFilter; import org.h2.value.TypeInfo; /** * Operation with many arguments. */ public abstract class OperationN extends Expression implements ExpressionWithVariableParameters { /** * The array of arguments. */ protected Expression[] args; /** * The number of arguments. */ protected int argsCount; /** * The type of the result. */ protected TypeInfo type; protected OperationN(Expression[] args) { this.args = args; } @Override public void addParameter(Expression param) { int capacity = args.length; if (argsCount >= capacity) { args = Arrays.copyOf(args, capacity * 2); } args[argsCount++] = param; } @Override public void doneWithParameters() throws DbException { if (args.length != argsCount) { args = Arrays.copyOf(args, argsCount); } } @Override public TypeInfo getType() { return type; } @Override public void mapColumns(ColumnResolver resolver, int level, int state) { for (Expression e : args) { e.mapColumns(resolver, level, state); } } /** * Optimizes arguments. * * @param session * the session * @param allConst * whether operation is deterministic * @return whether operation is deterministic and all arguments are * constants */ protected boolean optimizeArguments(SessionLocal session, boolean allConst) { for (int i = 0, l = args.length; i < l; i++) { Expression e = args[i].optimize(session); args[i] = e; if (allConst && !e.isConstant()) { allConst = false; } } return allConst; } @Override public void setEvaluatable(TableFilter tableFilter, boolean value) { for (Expression e : args) { e.setEvaluatable(tableFilter, value); } } @Override public void updateAggregate(SessionLocal session, int stage) { for (Expression e : args) { e.updateAggregate(session, stage); } } @Override public boolean isEverything(ExpressionVisitor visitor) { for (Expression e : args) { if (!e.isEverything(visitor)) { return false; } } return true; } @Override public int getCost() { int cost = args.length + 1; for (Expression e : args) { cost += e.getCost(); } return cost; } @Override public int getSubexpressionCount() { return args.length; } @Override public Expression getSubexpression(int index) { return args[index]; } }
Detected license expression
mpl-2.0 AND epl-1.0
Detected license expression (SPDX)
MPL-2.0 AND EPL-1.0
Percentage of license text
3.06
Copyrights
- end_line: 2
  copyright: Copyright 2004-2023 H2 Group. Multiple-Licensed
  start_line: 2
Holders
- holder: H2 Group. Multiple-Licensed
  end_line: 2
  start_line: 2
Authors

      
    
License detections License expression License expression SPDX
mpl_2_0_and_epl_1_0-796bf8d7-f485-3520-923d-e6a4b1ecd2f3 mpl-2.0 AND epl-1.0 MPL-2.0 AND EPL-1.0
URL Start line End line
https://h2database.com/html/license.html 3 3
Package URL License Primary language
pkg:osgi/com.h2database.source@2.2.220