Java 类com.intellij.util.containers.SoftHashMap 实例源码

项目:intellij-ce-playground    文件:LoadedRevisionsCache.java   
private LoadedRevisionsCache(final Project project) {
  myProject = project;
  myMap = (ApplicationManager.getApplication().isUnitTestMode()) ? new HashMap<String, Bunch>() : new SoftHashMap<String, Bunch>();

  myConnection = project.getMessageBus().connect();
  myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() {

    @Override
    public void changesLoaded(final RepositoryLocation location, final List<CommittedChangeList> changes) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
          myMap.clear();
          setRefreshTime(System.currentTimeMillis());
        }
      });
    }
  });
  Disposer.register(myProject, this);
  setRefreshTime(0);
}
项目:tools-idea    文件:RecursionManager.java   
@Nullable
Object getMemoizedValue(MyKey realKey) {
  SoftHashMap<MyKey, SoftReference> map = intermediateCache.get(realKey);
  if (map == null) return null;

  if (depth == 0) {
    throw new AssertionError("Memoized values with empty stack");
  }

  for (MyKey key : map.keySet()) {
    final SoftReference reference = map.get(key);
    if (reference != null) {
      final Object result = reference.get();
      if (result != null) {
        return result;
      }
    }
  }

  return null;
}
项目:consulo    文件:RecursionManager.java   
@Nullable
Object getMemoizedValue(MyKey realKey) {
  SoftHashMap<MyKey, SoftReference> map = intermediateCache.get(realKey);
  if (map == null) return null;

  if (depth == 0) {
    throw new AssertionError("Memoized values with empty stack");
  }

  for (MyKey key : map.keySet()) {
    final SoftReference reference = map.get(key);
    if (reference != null) {
      final Object result = reference.get();
      if (result != null) {
        return result;
      }
    }
  }

  return null;
}
项目:tools-idea    文件:LoadedRevisionsCache.java   
private LoadedRevisionsCache(final Project project) {
  myProject = project;
  myMap = (ApplicationManager.getApplication().isUnitTestMode()) ? new HashMap<String, Bunch>() : new SoftHashMap<String, Bunch>();

  myConnection = project.getMessageBus().connect();
  myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesListener() {
    public void changesLoaded(final RepositoryLocation location, final List<CommittedChangeList> changes) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
          myMap.clear();
          setRefreshTime(System.currentTimeMillis());
        }
      });
    }

    @Override
    public void changesCleared() {
    }

    @Override
    public void presentationChanged() {
    }

    public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) {
    }

    public void refreshErrorStatusChanged(@Nullable final VcsException lastError) {
    }
  });
  Disposer.register(myProject, this);
  setRefreshTime(0);
}
项目:intellij-tasks-navigate    文件:ToTaskReference.java   
@NotNull
@Override
public Result<Map<String, TaskPsiElement>> compute() {
  return Result.<Map<String, TaskPsiElement>>create(new SoftHashMap<String, TaskPsiElement>(), new ModificationTracker() {
    @Override
    public long getModificationCount() {
      return 0;
    }
  });
}
项目:intellij-ce-playground    文件:SvnMergeInfoCache.java   
private MyCurrentUrlData() {
  myBranchInfo = new SoftHashMap<String, BranchInfo>();
}
项目:intellij-ce-playground    文件:SvnRepositoryCache.java   
private SvnRepositoryCache() {
  myMap = new SoftHashMap<String, List<DirectoryEntry>>();
  myErrorsMap = new SoftHashMap<String, String>();
}
项目:tools-idea    文件:SvnMergeInfoCache.java   
private MyCurrentUrlData() {
  myBranchInfo = new SoftHashMap<String, BranchInfo>();
}
项目:tools-idea    文件:SvnRepositoryCache.java   
private SvnRepositoryCache() {
  myMap = new SoftHashMap<String, List<SVNDirEntry>>();
  myErrorsMap = new SoftHashMap<String, SVNErrorMessage>();
}