ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/util/IntArray.java

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

      
    
Rootfs path

      
    
Size
4079 (4.0 KB)
MD5
903b69becfd8d78282be25bc592a2006
SHA1
30c7c1848ce6ec6e77cc56513eeffc388c64030c
SHA256
bad7f18d0880175e1ce987a076398deb6f30a02e5eb6637ae367b40383857e19
SHA512

      
    
SHA1_git
f27bbd19de4db41c892d6bcae09172cab45d32a7
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
IntArray.java | 4.0 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.util; import java.util.Arrays; /** * An array with integer element. */ public class IntArray { private int[] data; private int size; private int hash; /** * Create an int array with the default initial capacity. */ public IntArray() { this(10); } /** * Create an int array with specified initial capacity. * * @param capacity the initial capacity */ public IntArray(int capacity) { data = new int[capacity]; } /** * Create an int array with the given values and size. * * @param data the int array */ public IntArray(int[] data) { this.data = data; size = data.length; } /** * Append a value. * * @param value the value to append */ public void add(int value) { if (size >= data.length) { ensureCapacity(size + size); } data[size++] = value; } /** * Get the value at the given index. * * @param index the index * @return the value */ public int get(int index) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } return data[index]; } /** * Remove the value at the given index. * * @param index the index */ public void remove(int index) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } System.arraycopy(data, index + 1, data, index, size - index - 1); size--; } /** * Ensure the underlying array is large enough for the given number of * entries. * * @param minCapacity the minimum capacity */ public void ensureCapacity(int minCapacity) { minCapacity = Math.max(4, minCapacity); if (minCapacity >= data.length) { data = Arrays.copyOf(data, minCapacity); } } @Override public boolean equals(Object obj) { if (!(obj instanceof IntArray)) { return false; } IntArray other = (IntArray) obj; if (hashCode() != other.hashCode() || size != other.size) { return false; } for (int i = 0; i < size; i++) { if (data[i] != other.data[i]) { return false; } } return true; } @Override public int hashCode() { if (hash != 0) { return hash; } int h = size + 1; for (int i = 0; i < size; i++) { h = h * 31 + data[i]; } hash = h; return h; } /** * Get the size of the list. * * @return the size */ public int size() { return size; } /** * Convert this list to an array. The target array must be big enough. * * @param array the target array */ public void toArray(int[] array) { System.arraycopy(data, 0, array, 0, size); } @Override public String toString() { StringBuilder builder = new StringBuilder("{"); for (int i = 0; i < size; i++) { if (i > 0) { builder.append(", "); } builder.append(data[i]); } return builder.append('}').toString(); } /** * Remove a number of elements. * * @param fromIndex the index of the first item to remove * @param toIndex upper bound (exclusive) */ public void removeRange(int fromIndex, int toIndex) { if (fromIndex > toIndex || toIndex > size) { throw new ArrayIndexOutOfBoundsException("from=" + fromIndex + " to=" + toIndex + " size=" + size); } System.arraycopy(data, toIndex, data, fromIndex, size - toIndex); size -= toIndex - fromIndex; } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
2.56
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