mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ class FilePointerPartNode {
|
||||
}
|
||||
|
||||
boolean getPointersUnder(@NotNull String path, int start, @NotNull List<FilePointerPartNode> out) {
|
||||
checkStructure();
|
||||
checkConsistency();
|
||||
if (pointersUnder == 0) return false;
|
||||
// invariant: upper nodes are matched
|
||||
int index = indexOfFirstDifferentChar(path, start);
|
||||
@@ -76,12 +76,12 @@ class FilePointerPartNode {
|
||||
return false;
|
||||
}
|
||||
|
||||
void checkStructure() {
|
||||
void checkConsistency() {
|
||||
if (!DEBUG) return;
|
||||
int childSum = 0;
|
||||
for (FilePointerPartNode child : children) {
|
||||
childSum += child.pointersUnder;
|
||||
child.checkStructure();
|
||||
child.checkConsistency();
|
||||
assert child.parent == this;
|
||||
}
|
||||
if (leaf != null) childSum++;
|
||||
|
||||
+9
-10
@@ -37,7 +37,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import gnu.trove.TObjectIntProcedure;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -196,7 +195,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
|
||||
String path;
|
||||
if (file == null) {
|
||||
path = protocolEnd == -1 ? url : url.substring(protocolEnd + URLUtil.SCHEME_SEPARATOR.length());
|
||||
path = url.substring(protocolEnd + URLUtil.SCHEME_SEPARATOR.length());
|
||||
String cleanPath = cleanupPath(path, isJar);
|
||||
// if newly created path is the same as substringed one then the url did not change, we can reuse it
|
||||
//noinspection StringEquality
|
||||
@@ -263,7 +262,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
}
|
||||
pointer.myNode.incrementUsageCount(1);
|
||||
|
||||
root.checkStructure();
|
||||
root.checkConsistency();
|
||||
return pointer;
|
||||
}
|
||||
|
||||
@@ -327,7 +326,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
}
|
||||
}
|
||||
|
||||
private void addAllPointers(Collection<VirtualFilePointerImpl> pointers) {
|
||||
private void addAllPointers(@NotNull Collection<VirtualFilePointerImpl> pointers) {
|
||||
List<FilePointerPartNode> out = new ArrayList<FilePointerPartNode>();
|
||||
for (FilePointerPartNode root : myPointers.values()) {
|
||||
root.getPointersUnder("", 0, out);
|
||||
@@ -381,9 +380,9 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
return virtualFilePointerContainer;
|
||||
}
|
||||
|
||||
@Nullable private List<EventDescriptor> myEvents = Collections.emptyList();
|
||||
@Nullable private List<FilePointerPartNode> myPointersToUpdateUrl = Collections.emptyList();
|
||||
@Nullable private List<FilePointerPartNode> myPointersToFire = Collections.emptyList();
|
||||
private List<EventDescriptor> myEvents = Collections.emptyList();
|
||||
private List<FilePointerPartNode> myPointersToUpdateUrl = Collections.emptyList();
|
||||
private List<FilePointerPartNode> myPointersToFire = Collections.emptyList();
|
||||
|
||||
@Override
|
||||
public void before(@NotNull final List<? extends VFileEvent> events) {
|
||||
@@ -518,7 +517,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
myEvents = Collections.emptyList();
|
||||
myPointersToFire = Collections.emptyList();
|
||||
for (FilePointerPartNode root : myPointers.values()) {
|
||||
root.checkStructure();
|
||||
root.checkConsistency();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,12 +527,12 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
|
||||
myPointers.remove(listener);
|
||||
}
|
||||
else {
|
||||
myPointers.get(listener).checkStructure();
|
||||
myPointers.get(listener).checkConsistency();
|
||||
}
|
||||
}
|
||||
|
||||
private static class DelegatingDisposable implements Disposable {
|
||||
private static final ConcurrentMap<Disposable, DelegatingDisposable> ourInstances = new ConcurrentHashMap<Disposable, DelegatingDisposable>(TObjectHashingStrategy.IDENTITY);
|
||||
private static final ConcurrentMap<Disposable, DelegatingDisposable> ourInstances = new ConcurrentHashMap<Disposable, DelegatingDisposable>(ContainerUtil.<Disposable>identityStrategy());
|
||||
private final TObjectIntHashMap<VirtualFilePointerImpl> myCounts = new TObjectIntHashMap<VirtualFilePointerImpl>();
|
||||
private final Disposable myParent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user