Java 类com.intellij.util.io.EnumeratorIntegerDescriptor 实例源码

项目:intellij-ce-playground    文件:DetectedFrameworksData.java   
public DetectedFrameworksData(Project project) {
  myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>();
  File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() +
                       File.separator + "files");
  myNewFiles = new TIntObjectHashMap<TIntHashSet>();
  try {
    myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
  }
  catch (IOException e) {
    LOG.info(e);
    PersistentHashMap.deleteFilesStartingWith(file);
    try {
      myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
    }
    catch (IOException e1) {
      LOG.error(e1);
    }
  }
}
项目:tools-idea    文件:DetectedFrameworksData.java   
public DetectedFrameworksData(Project project) {
  myDetectedFrameworks = new MultiMap<Integer, DetectedFrameworkDescription>();
  File file = new File(FrameworkDetectorRegistryImpl.getDetectionDirPath() + File.separator + project.getName() + "." + project.getLocationHash() +
                       File.separator + "files");
  myNewFiles = new TIntObjectHashMap<TIntHashSet>();
  try {
    myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
  }
  catch (IOException e) {
    LOG.info(e);
    PersistentHashMap.deleteFilesStartingWith(file);
    try {
      myExistentFrameworkFiles = new PersistentHashMap<Integer, TIntHashSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new TIntHashSetExternalizer());
    }
    catch (IOException e1) {
      LOG.error(e1);
    }
  }
}
项目:tools-idea    文件:Cache.java   
public Cache(@NonNls final String storePath, final int cacheSize) throws IOException {
  myStorePath = storePath;
  new File(storePath).mkdirs();
  myQNameToClassInfoMap = new CachedPersistentHashMap<Integer, ClassInfo>(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<ClassInfo>() {
    public void save(DataOutput out, ClassInfo value) throws IOException {
      value.save(out);
    }
    public ClassInfo read(DataInput in) throws IOException {
      return new ClassInfo(in);
    }
  }, cacheSize * 2) {
    protected boolean isValueDirty(ClassInfo classInfo) {
      return classInfo.isDirty();
    }
  };

  myDependencies = new BackwardDependenciesStorage(getOrCreateFile("bdeps"), cacheSize);
  myQNameToReferencedClassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("fdeps"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);
  myQNameToSubclassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);

  myRemoteQNames = new PersistentHashMap<Integer, Boolean>(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Boolean>() {
    public void save(DataOutput out, Boolean value) throws IOException {
      out.writeBoolean(value.booleanValue());
    }

    public Boolean read(DataInput in) throws IOException {
      return in.readBoolean();
    }
  }, cacheSize);
}
项目:consulo    文件:VcsLogFullDetailsIndex.java   
public MyMapReduceIndex(@Nonnull DataIndexer<Integer, T, VcsFullCommitDetails> indexer,
                        @Nonnull DataExternalizer<T> externalizer,
                        int version) throws IOException {
  super(new MyIndexExtension(indexer, externalizer, version),
        new MapIndexStorage<Integer, T>(getStorageFile(myName, myLogId),
                                        EnumeratorIntegerDescriptor.INSTANCE,
                                        externalizer, 5000, false) {
          @Override
          protected void checkCanceled() {
            ProgressManager.checkCanceled();
          }
        }, new EmptyForwardIndex<>());
}
项目:intellij-ce-playground    文件:MethodsUsageIndexer.java   
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:MethodsUsageIndexReader.java   
public MethodsUsageIndexReader(final Project project, final String canonicalIndexName, final int version) {
  //noinspection ConstantConditions
  super(EnumeratorIntegerDescriptor.INSTANCE,
        new TObjectIntHashMapExternalizer<EnumeratedMethodIncompleteSignature>(EnumeratedMethodIncompleteSignature.createDataExternalizer()),
        canonicalIndexName, version, project);
}
项目:intellij-ce-playground    文件:SingleEntryFileBasedIndexExtension.java   
@NotNull
@Override
public final KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:IntStubIndexExtension.java   
@NotNull
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:TrigramIndex.java   
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:FrameworkDetectionIndex.java   
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:TracingData.java   
private static PersistentHashMap<Integer, Integer> createOrOpenMap() throws IOException {
  return new PersistentHashMap<Integer, Integer>(new File(tracingDataLocation), EnumeratorIntegerDescriptor.INSTANCE, EnumeratorIntegerDescriptor.INSTANCE);
}
项目:intellij-ce-playground    文件:DuplicatesIndex.java   
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:AntImportsIndex.java   
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:intellij-ce-playground    文件:GroovyTraitFieldsFileIndex.java   
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:tools-idea    文件:TwinVariablesIndex.java   
public TwinVariablesIndex() {
  super(new EnumeratorStringDescriptor(), new ArrayListKeyDescriptor<Integer>(EnumeratorIntegerDescriptor.INSTANCE));
}
项目:tools-idea    文件:BackwardDependenciesStorage.java   
public BackwardDependenciesStorage(File file, final int cacheSize) throws IOException {
  myMap = new PersistentHashMap<Integer, DependenciesSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new MyDataExternalizer());

  myCache = new SLRUCache<Integer, ReferencerSetHolder>(cacheSize * 2, cacheSize) {
    @NotNull
    public ReferencerSetHolder createValue(Integer key) {
      return new ReferencerSetHolder(key);
    }

    protected void onDropFromCache(Integer key, final ReferencerSetHolder holder) {
      if (key.equals(myKeyToRemove) || !holder.isDirty()) {
        return;
      }
      try {
        if (holder.isDataLoaded() || !myMap.containsMapping(key)) {
          myMap.put(key, new DependenciesSet(holder.getData()));
        }
        else {
          myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
            public void append(final DataOutput out) throws IOException {
              final Ref<IOException> exception = new Ref<IOException>(null);
              // process removed
              holder.myRemoveRequested.forEach(new TIntProcedure() {
                public boolean execute(int qName) {
                  try {
                    out.writeInt(-qName);
                    return true;
                  }
                  catch (IOException e) {
                    exception.set(e);
                  }
                  return false;
                }
              });
              final IOException _ex = exception.get();
              if (_ex != null) {
                throw _ex;
              }
              // process added members
              for (ReferencerItem item : holder.myAdded) {
                item.save(out);
              }
            }
          });
        }
      }
      catch (IOException e) {
        LOG.error(e);
      }
    }
  };
}
项目:tools-idea    文件:SingleEntryFileBasedIndexExtension.java   
@Override
public final KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:tools-idea    文件:IntStubIndexExtension.java   
@NotNull
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:tools-idea    文件:TrigramIndex.java   
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:tools-idea    文件:FrameworkDetectionIndex.java   
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:tools-idea    文件:AntImportsIndex.java   
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:idea-php-symfony2-plugin    文件:ContainerIdUsagesStubIndex.java   
@NotNull
@Override
public DataExternalizer<Integer> getValueExternalizer() {
    return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo-apache-ant    文件:AntImportsIndex.java   
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo    文件:SingleEntryFileBasedIndexExtension.java   
@Nonnull
@Override
public final KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo    文件:VcsLogFullDetailsIndex.java   
@Nonnull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo    文件:IntStubIndexExtension.java   
@Nonnull
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo    文件:TrigramIndex.java   
@Nonnull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
  return EnumeratorIntegerDescriptor.INSTANCE;
}
项目:consulo    文件:VfsAwareMapReduceIndex.java   
@Nonnull
private static <K> PersistentHashMap<Integer, Collection<K>> createIdToDataKeysIndex(@Nonnull IndexExtension<K, ?, ?> extension) throws IOException {
  final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile((ID<?, ?>)extension.getName());
  return new PersistentHashMap<>(indexStorageFile, EnumeratorIntegerDescriptor.INSTANCE, createInputsIndexExternalizer(extension));
}
项目:consulo-java    文件:Cache.java   
public Cache(@NonNls final String storePath, final int cacheSize) throws IOException
{
    myStorePath = storePath;
    new File(storePath).mkdirs();
    myQNameToClassInfoMap = new CachedPersistentHashMap<Integer, ClassInfo>(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<ClassInfo>()
    {
        @Override
        public void save(DataOutput out, ClassInfo value) throws IOException
        {
            value.save(out);
        }

        @Override
        public ClassInfo read(DataInput in) throws IOException
        {
            return new ClassInfo(in);
        }
    }, cacheSize * 2)
    {
        @Override
        protected boolean isValueDirty(ClassInfo classInfo)
        {
            return classInfo.isDirty();
        }
    };

    myDependencies = new BackwardDependenciesStorage(getOrCreateFile("bdeps"), cacheSize);
    myQNameToReferencedClassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("fdeps"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);
    myQNameToSubclassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);

    myRemoteQNames = new PersistentHashMap<Integer, Boolean>(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Boolean>()
    {
        @Override
        public void save(DataOutput out, Boolean value) throws IOException
        {
            out.writeBoolean(value.booleanValue());
        }

        @Override
        public Boolean read(DataInput in) throws IOException
        {
            return in.readBoolean();
        }
    }, cacheSize);
}
项目:consulo-java    文件:BackwardDependenciesStorage.java   
public BackwardDependenciesStorage(File file, final int cacheSize) throws IOException {
  myMap = new PersistentHashMap<Integer, DependenciesSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new MyDataExternalizer());

  myCache = new SLRUCache<Integer, ReferencerSetHolder>(cacheSize * 2, cacheSize) {
    @NotNull
    public ReferencerSetHolder createValue(Integer key) {
      return new ReferencerSetHolder(key);
    }

    protected void onDropFromCache(Integer key, final ReferencerSetHolder holder) {
      if (key.equals(myKeyToRemove) || !holder.isDirty()) {
        return;
      }
      try {
        if (holder.isDataLoaded() || !myMap.containsMapping(key)) {
          myMap.put(key, new DependenciesSet(holder.getData()));
        }
        else {
          myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
            public void append(final DataOutput out) throws IOException {
              final Ref<IOException> exception = new Ref<IOException>(null);
              // process removed
              holder.myRemoveRequested.forEach(new TIntProcedure() {
                public boolean execute(int qName) {
                  try {
                    out.writeInt(-qName);
                    return true;
                  }
                  catch (IOException e) {
                    exception.set(e);
                  }
                  return false;
                }
              });
              final IOException _ex = exception.get();
              if (_ex != null) {
                throw _ex;
              }
              // process added members
              for (ReferencerItem item : holder.myAdded) {
                item.save(out);
              }
            }
          });
        }
      }
      catch (IOException e) {
        LOG.error(e);
      }
    }
  };
}