ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/index/RangeIndex.java

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

      
    
Rootfs path

      
    
Size
3263 (3.2 KB)
MD5
a86f55d14a0eb7c8595b870120f30bc0
SHA1
994d26682cdac3620816d8f1ac8926fecdc49965
SHA256
53e72a2809da53fa8df5e32f4182c4680077b60300184eca7bcb1cbee0d75f1c
SHA512

      
    
SHA1_git
1be84a25f83e88ff762f5cfa5ed908981d71d9a9
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
RangeIndex.java | 3.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.index; import org.h2.api.ErrorCode; import org.h2.command.query.AllColumnsForPlan; import org.h2.engine.SessionLocal; import org.h2.message.DbException; import org.h2.result.Row; import org.h2.result.SearchRow; import org.h2.result.SortOrder; import org.h2.table.IndexColumn; import org.h2.table.RangeTable; import org.h2.table.TableFilter; import org.h2.value.Value; import org.h2.value.ValueBigint; /** * An index for the SYSTEM_RANGE table. * This index can only scan through all rows, search is not supported. */ public class RangeIndex extends VirtualTableIndex { private final RangeTable rangeTable; public RangeIndex(RangeTable table, IndexColumn[] columns) { super(table, "RANGE_INDEX", columns); this.rangeTable = table; } @Override public Cursor find(SessionLocal session, SearchRow first, SearchRow last) { long min = rangeTable.getMin(session); long max = rangeTable.getMax(session); long step = rangeTable.getStep(session); if (step == 0L) { throw DbException.get(ErrorCode.STEP_SIZE_MUST_NOT_BE_ZERO); } if (first != null) { try { long v = first.getValue(0).getLong(); if (step > 0) { if (v > min) { min += (v - min + step - 1) / step * step; } } else if (v > max) { max = v; } } catch (DbException e) { // error when converting the value - ignore } } if (last != null) { try { long v = last.getValue(0).getLong(); if (step > 0) { if (v < max) { max = v; } } else if (v < min) { min -= (min - v - step - 1) / step * step; } } catch (DbException e) { // error when converting the value - ignore } } return new RangeCursor(min, max, step); } @Override public double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet) { return 1d; } @Override public String getCreateSQL() { return null; } @Override public boolean canGetFirstOrLast() { return true; } @Override public Cursor findFirstOrLast(SessionLocal session, boolean first) { long min = rangeTable.getMin(session); long max = rangeTable.getMax(session); long step = rangeTable.getStep(session); if (step == 0L) { throw DbException.get(ErrorCode.STEP_SIZE_MUST_NOT_BE_ZERO); } return new SingleRowCursor((step > 0 ? min <= max : min >= max) ? Row.get(new Value[]{ ValueBigint.get(first ^ min >= max ? min : max) }, 1) : null); } @Override public String getPlanSQL() { return "range index"; } }
Detected license expression

      
    
Detected license expression (SPDX)

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