ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/value/ValueArray.java

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

      
    
Rootfs path

      
    
Size
4308 (4.2 KB)
MD5
7755e952506d0df83bb61f8306157124
SHA1
bd55d95be1ed850a06e4b730d0f832cbe81c584a
SHA256
d6deb75dcb27aefba1340a82396be6d4f79373e6998b96281287e7fb29ed3675
SHA512

      
    
SHA1_git
c140fd82aa5c61d370884dee2e0b164a6c2b7865
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ValueArray.java | 4.2 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.value; import org.h2.engine.CastDataProvider; import org.h2.engine.Constants; import org.h2.message.DbException; /** * Implementation of the ARRAY data type. */ public final class ValueArray extends ValueCollectionBase { /** * Empty array. */ public static final ValueArray EMPTY = get(TypeInfo.TYPE_NULL, Value.EMPTY_VALUES, null); private TypeInfo type; private final TypeInfo componentType; private ValueArray(TypeInfo componentType, Value[] list, CastDataProvider provider) { super(list); int length = list.length; if (length > Constants.MAX_ARRAY_CARDINALITY) { String typeName = getTypeName(getValueType()); throw DbException.getValueTooLongException(typeName, typeName, length); } for (int i = 0; i < length; i++) { list[i] = list[i].castTo(componentType, provider); } this.componentType = componentType; } /** * Get or create a array value for the given value array. * Do not clone the data. * * @param list the value array * @param provider the cast information provider * @return the value */ public static ValueArray get(Value[] list, CastDataProvider provider) { return new ValueArray(TypeInfo.getHigherType(list), list, provider); } /** * Get or create a array value for the given value array. * Do not clone the data. * * @param componentType the type of elements, or {@code null} * @param list the value array * @param provider the cast information provider * @return the value */ public static ValueArray get(TypeInfo componentType, Value[] list, CastDataProvider provider) { return new ValueArray(componentType, list, provider); } @Override public TypeInfo getType() { TypeInfo type = this.type; if (type == null) { TypeInfo componentType = getComponentType(); this.type = type = TypeInfo.getTypeInfo(getValueType(), values.length, 0, componentType); } return type; } @Override public int getValueType() { return ARRAY; } public TypeInfo getComponentType() { return componentType; } @Override public String getString() { StringBuilder builder = new StringBuilder().append('['); for (int i = 0; i < values.length; i++) { if (i > 0) { builder.append(", "); } builder.append(values[i].getString()); } return builder.append(']').toString(); } @Override public int compareTypeSafe(Value o, CompareMode mode, CastDataProvider provider) { ValueArray v = (ValueArray) o; if (values == v.values) { return 0; } int l = values.length; int ol = v.values.length; int len = Math.min(l, ol); for (int i = 0; i < len; i++) { Value v1 = values[i]; Value v2 = v.values[i]; int comp = v1.compareTo(v2, provider, mode); if (comp != 0) { return comp; } } return Integer.compare(l, ol); } @Override public StringBuilder getSQL(StringBuilder builder, int sqlFlags) { builder.append("ARRAY ["); int length = values.length; for (int i = 0; i < length; i++) { if (i > 0) { builder.append(", "); } values[i].getSQL(builder, sqlFlags); } return builder.append(']'); } @Override public boolean equals(Object other) { if (!(other instanceof ValueArray)) { return false; } ValueArray v = (ValueArray) other; if (values == v.values) { return true; } int len = values.length; if (len != v.values.length) { return false; } for (int i = 0; i < len; i++) { if (!values[i].equals(v.values[i])) { return false; } } return true; } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
2.51
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 expression License clue details
(mpl-2.0 OR epl-1.0) AND proprietary-license {'score': 20.37, 'matcher': '3-seq', 'end_line': 3, 'rule_url': 'https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'from_file': None, 'start_line': 2, 'matched_text': ' * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,\n * and the EPL 1.0 (https://h2database.com/html/license.html).', 'match_coverage': 20.37, 'matched_length': 11, 'rule_relevance': 100, 'rule_identifier': 'mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'license_expression': '(mpl-2.0 OR epl-1.0) AND proprietary-license', 'license_expression_spdx': '(MPL-2.0 OR EPL-1.0) AND LicenseRef-scancode-proprietary-license'}
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