mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
refactor interners: extract common super class, generalize usages
GitOrigin-RevId: 7958f52e8fb1c6a1b95b9f9c88e6cc3e0e5b5d90
This commit is contained in:
committed by
intellij-monorepo-bot
parent
30b6d83993
commit
ac3221470f
@@ -2,7 +2,7 @@
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.util.containers.EmptyIterator;
|
||||
import com.intellij.util.containers.StringInterner;
|
||||
import com.intellij.util.containers.Interner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -15,11 +15,11 @@ import java.util.Stack;
|
||||
*/
|
||||
public class TreeBasedMap<T> {
|
||||
private Node<T> myRoot = new Node<>();
|
||||
private final StringInterner myInterner;
|
||||
private final Interner<String> myInterner;
|
||||
private final char mySeparator;
|
||||
private int mySize = 0;
|
||||
|
||||
public TreeBasedMap(StringInterner table, final char separator) {
|
||||
public TreeBasedMap(Interner<String> table, final char separator) {
|
||||
myInterner = table;
|
||||
mySeparator = separator;
|
||||
}
|
||||
@@ -48,12 +48,12 @@ public class TreeBasedMap<T> {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Node<T> findRelative(String text, boolean create, final StringInterner table) {
|
||||
public Node<T> findRelative(String text, boolean create, final Interner<String> table) {
|
||||
return findRelative(text, 0, create, table);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Node<T> findRelative(final String text, final int nameStartIndex, final boolean create, final StringInterner table) {
|
||||
private Node<T> findRelative(final String text, final int nameStartIndex, final boolean create, final Interner<String> table) {
|
||||
if (myChildren == null && !create) {
|
||||
return null;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class TreeBasedMap<T> {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Node<T> addChild(final StringInterner table, final String text, final int nameStartIndex, final int nameEndIndex) {
|
||||
private Node<T> addChild(final Interner<String> table, final String text, final int nameStartIndex, final int nameEndIndex) {
|
||||
if (myChildren == null) {
|
||||
myChildren = new HashMap<>(3, 0.95f);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.util.containers.StringInterner;
|
||||
import com.intellij.util.containers.Interner;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -23,7 +23,7 @@ import com.intellij.util.containers.StringInterner;
|
||||
public class TreeBasedPathsSet {
|
||||
private final TreeBasedMap<Object> myMap;
|
||||
|
||||
public TreeBasedPathsSet(StringInterner interner, char separator) {
|
||||
public TreeBasedPathsSet(Interner<String> interner, char separator) {
|
||||
myMap = new TreeBasedMap<>(interner, separator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user