ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/result/DefaultRow.java

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

      
    
Rootfs path

      
    
Size
2855 (2.8 KB)
MD5
92741958ded852356b9aaba4f39937aa
SHA1
4f9f32f29de8ddf71f9e47591e2165f8615455e6
SHA256
8a4aa476517405d499a96e7ee1669bfabd3331537920374cde08c47dbf20911b
SHA512

      
    
SHA1_git
dd9cd645b2063868a3fb5eb1194786eb7e9f9ca2
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
DefaultRow.java | 2.8 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.result; import org.h2.engine.Constants; import org.h2.value.Value; import org.h2.value.ValueBigint; /** * The default implementation of a row in a table. */ public class DefaultRow extends Row { /** * The constant that means "memory usage is unknown and needs to be calculated first". */ public static final int MEMORY_CALCULATE = -1; /** * The values of the row (one entry per column). */ protected final Value[] data; private int memory; DefaultRow(int columnCount) { this.data = new Value[columnCount]; this.memory = MEMORY_CALCULATE; } public DefaultRow(Value[] data) { this.data = data; this.memory = MEMORY_CALCULATE; } public DefaultRow(Value[] data, int memory) { this.data = data; this.memory = memory; } @Override public Value getValue(int i) { return i == ROWID_INDEX ? ValueBigint.get(key) : data[i]; } @Override public void setValue(int i, Value v) { if (i == ROWID_INDEX) { key = v.getLong(); } else { data[i] = v; } } @Override public int getColumnCount() { return data.length; } @Override public int getMemory() { if (memory != MEMORY_CALCULATE) { return memory; } return memory = calculateMemory(); } @Override public String toString() { StringBuilder builder = new StringBuilder("( /* key:").append(key).append(" */ "); for (int i = 0, length = data.length; i < length; i++) { if (i > 0) { builder.append(", "); } Value v = data[i]; builder.append(v == null ? "null" : v.getTraceSQL()); } return builder.append(')').toString(); } /** * Calculate the estimated memory used for this row, in bytes. * * @return the memory */ protected int calculateMemory() { int m = Constants.MEMORY_ROW + Constants.MEMORY_ARRAY + data.length * Constants.MEMORY_POINTER; for (Value v : data) { if (v != null) { m += v.getMemory(); } } return m; } @Override public Value[] getValueList() { return data; } @Override public boolean hasSharedData(Row other) { return other instanceof DefaultRow && data == ((DefaultRow) other).data; } @Override public void copyFrom(SearchRow source) { setKey(source.getKey()); for (int i = 0; i < getColumnCount(); i++) { setValue(i, source.getValue(i)); } } }
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
2.99
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