mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[vcs-log-graph] cleanup: extract method
GitOrigin-RevId: f1f779eafb27842c0f7ffaacea248f7588e01416
This commit is contained in:
committed by
intellij-monorepo-bot
parent
717c2e8aae
commit
65a7f3883a
@@ -21,18 +21,7 @@ public interface SortIndexMap {
|
||||
reverseMap[list.get(i)] = i;
|
||||
}
|
||||
|
||||
IntList compressedMap = CompressedIntList.newInstance(new IntList() {
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int index) {
|
||||
return list.get(index);
|
||||
}
|
||||
}, CompressedIntList.DEFAULT_BLOCK_SIZE);
|
||||
|
||||
IntList compressedMap = CompressedIntList.newInstance(list);
|
||||
IntList compressedReverseMap = CompressedIntList.newInstance(reverseMap);
|
||||
return new SortIndexMap() {
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.vcs.log.graph.utils.impl;
|
||||
|
||||
import com.intellij.vcs.log.graph.utils.IntList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class CompressedIntList implements IntList {
|
||||
public static final int DEFAULT_BLOCK_SIZE = 30;
|
||||
|
||||
@@ -28,6 +29,21 @@ public final class CompressedIntList implements IntList {
|
||||
}, blockSize);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static IntList newInstance(@NotNull List<Integer> delegateList) {
|
||||
return newInstance(new IntList() {
|
||||
@Override
|
||||
public int size() {
|
||||
return delegateList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int index) {
|
||||
return delegateList.get(index);
|
||||
}
|
||||
}, DEFAULT_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static IntList newInstance(final IntList delegateList, final int blockSize) {
|
||||
if (blockSize < 1) throw new IllegalArgumentException("Unsupported blockSize:" + blockSize);
|
||||
|
||||
Reference in New Issue
Block a user