Browse Source
* commit 'afd60d16d8d53a050c1eac796f2d613af57c8d59': CHART-19735 && CHART-19736 版本升级 修改信息 修复bug KERNEL-8448 提供RoaringBitmap兼容实现 DEC-19253 feat: netty-socketio支持配置加密套件 DEC-19577 fix: 另一个实现类也改一下 无jira任务 fix: 修改注释 DEC-19577 fix: hibernate建表时,调整为只有建表成功才进行添加索引、主键等操作research/11.0
superman
3 years ago
553 changed files with 9400 additions and 4763 deletions
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<parent> |
||||
<groupId>com.fr.third</groupId> |
||||
<artifactId>step1</artifactId> |
||||
<version>${revision}</version> |
||||
<relativePath>../base-third-project/base-third-step1</relativePath> |
||||
</parent> |
||||
|
||||
<artifactId>fine-roaringbitmap</artifactId> |
||||
<version>${revision}</version> |
||||
|
||||
|
||||
</project> |
@ -0,0 +1,194 @@
|
||||
package com.fr.third.bitmap.roaringbitmap; |
||||
|
||||
import java.util.Iterator; |
||||
|
||||
/** |
||||
* Created by loy on 2021/7/13. |
||||
* |
||||
* <p>兼容新引擎插件中用到的这个类,后续会删除 |
||||
*/ |
||||
@Deprecated |
||||
public class RoaringBitmap { |
||||
|
||||
private byte[] value; |
||||
private int length; |
||||
private int cap; |
||||
|
||||
public RoaringBitmap() { |
||||
this(8192); |
||||
} |
||||
|
||||
public RoaringBitmap(int cap) { |
||||
this.cap = cap; |
||||
this.value = new byte[(cap + 7) / 8]; |
||||
} |
||||
|
||||
public void add(int n) { |
||||
checkIndex(n); |
||||
ensureCap(n); |
||||
int idx0 = n / 8; |
||||
int idx1 = n % 8; |
||||
if ((value[idx0] & (1 << idx1)) == 0) { |
||||
length++; |
||||
value[idx0] |= (1 << idx1); |
||||
} |
||||
} |
||||
|
||||
public void remove(int n) { |
||||
checkIndex(n); |
||||
if (n >= value.length * 8) { |
||||
return; |
||||
} |
||||
int idx0 = n / 8; |
||||
int idx1 = n % 8; |
||||
if ((value[idx0] & (1 << idx1)) != 0) { |
||||
length--; |
||||
value[idx0] &= ~(1 << idx1); |
||||
} |
||||
} |
||||
|
||||
public boolean contains(int n) { |
||||
checkIndex(n); |
||||
if (n >= value.length * 8) { |
||||
return false; |
||||
} |
||||
int idx0 = n / 8; |
||||
int idx1 = n % 8; |
||||
return (value[idx0] & (1 << idx1)) != 0; |
||||
} |
||||
|
||||
public void flip(long rangeStart, long rangeEnd) { |
||||
int sIdx0 = (int) ((rangeStart + 7) / 8); |
||||
int sIdx1 = (int) (rangeStart % 8); |
||||
int eIdx0 = (int) (rangeEnd / 8); |
||||
int eIdx1 = (int) (rangeEnd % 8); |
||||
int lenDiff = 0; |
||||
if (sIdx1 > 0) { |
||||
byte b = value[sIdx0 - 1]; |
||||
byte b2 = (byte) (~(b & 0xff) >> sIdx1 << sIdx1 + ((b & 0xff) << (32 - sIdx1) >> (32 - sIdx1))); |
||||
value[sIdx0 - 1] = b2; |
||||
lenDiff += countInByte(b2) - countInByte(b); |
||||
} |
||||
for (int i = sIdx0; i < eIdx0; i++) { |
||||
value[i] = (byte) ~(value[i]); |
||||
lenDiff += countInByte(value[i]) * 2 - 8; |
||||
} |
||||
if (eIdx1 > 0) { |
||||
byte b = value[eIdx0]; |
||||
byte b2 = (byte) (((b & 0xff) >> eIdx1 << eIdx1) + ~(b & 0xff) << (32 - eIdx1) >> (32 - eIdx1)); |
||||
value[eIdx0] = b2; |
||||
lenDiff += countInByte(b2) - countInByte(b); |
||||
} |
||||
length += lenDiff; |
||||
} |
||||
|
||||
public int getCardinality() { |
||||
return length; |
||||
} |
||||
|
||||
@Override |
||||
public RoaringBitmap clone() { |
||||
RoaringBitmap bm = new RoaringBitmap(cap); |
||||
bm.length = length; |
||||
bm.value = new byte[value.length]; |
||||
System.arraycopy(value, 0, bm.value, 0, value.length); |
||||
return bm; |
||||
} |
||||
|
||||
public static RoaringBitmap and(RoaringBitmap bm1, RoaringBitmap bm2) { |
||||
int len = Integer.min(bm1.value.length, bm2.value.length); |
||||
RoaringBitmap bm = new RoaringBitmap(Integer.max(bm1.cap, bm2.cap)); |
||||
bm.value = new byte[len]; |
||||
for (int i = 0; i < len; i++) { |
||||
byte b = (byte) (bm1.value[i] & bm2.value[i]); |
||||
if (b == 0) { |
||||
continue; |
||||
} |
||||
bm.value[i] = b; |
||||
bm.length += countInByte(b); |
||||
} |
||||
return bm; |
||||
} |
||||
|
||||
public static int andCardinality(RoaringBitmap bm1, RoaringBitmap bm2) { |
||||
int len = Integer.min(bm1.value.length, bm2.value.length); |
||||
int count = 0; |
||||
for (int i = 0; i < len; i++) { |
||||
byte b = (byte) (bm1.value[i] & bm2.value[i]); |
||||
if (b == 0) { |
||||
continue; |
||||
} |
||||
count += countInByte(b); |
||||
} |
||||
return count; |
||||
} |
||||
|
||||
public Iterator<Integer> iterator() { |
||||
return new Iterator<Integer>() { |
||||
private int idx0 = 0; |
||||
private int idx1 = 0; |
||||
@Override |
||||
public boolean hasNext() { |
||||
while (idx0 < value.length) { |
||||
if (value[idx0] != 0) { |
||||
byte b = value[idx0]; |
||||
while (idx1 < 8) { |
||||
if ((b & (1 << idx1)) != 0) { |
||||
return true; |
||||
} |
||||
idx1++; |
||||
} |
||||
} |
||||
idx0++; |
||||
idx1 = 0; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public Integer next() { |
||||
if (hasNext()) { |
||||
int v = idx0 * 8 + idx1; |
||||
idx1++; |
||||
if (idx1 >= 8) { |
||||
idx1 = 0; |
||||
idx0++; |
||||
} |
||||
return v; |
||||
} |
||||
return null; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private void ensureCap(int n) { |
||||
int idx = (n + 7) / 8; |
||||
int len = value.length; |
||||
while (len < idx) { |
||||
len <<= 1; |
||||
} |
||||
if (len > value.length) { |
||||
byte[] value2 = new byte[len]; |
||||
System.arraycopy(value, 0, value2, 0, value.length); |
||||
value = value2; |
||||
} |
||||
} |
||||
|
||||
private void checkIndex(int n) { |
||||
if (n < 0) { |
||||
throw new ArrayIndexOutOfBoundsException(); |
||||
} |
||||
} |
||||
|
||||
private static int countInByte(byte b) { |
||||
int count = 0; |
||||
while (b != 0) { |
||||
if ((b & 0x01) == 0x01) { |
||||
count++; |
||||
} |
||||
b = (byte) ((b & 0xff) >> 1); |
||||
} |
||||
return count; |
||||
} |
||||
} |
||||
|
@ -1,2 +1,2 @@
|
||||
源码地址:https://github.com/apache/xmlgraphics-batik <br> |
||||
版本:1.9 |
||||
版本:1.14 |
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue