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

项目:intellij-ce-playground    文件:ObjectObjectPersistentMultiMaplet.java   
public ObjectObjectPersistentMultiMaplet(final File file,
                                      final KeyDescriptor<K> keyExternalizer,
                                      final DataExternalizer<V> valueExternalizer,
                                      final CollectionFactory<V> collectionFactory) throws IOException {
  myValueExternalizer = valueExternalizer;
  myMap = new PersistentHashMap<K, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
  myCache = new SLRUCache<K, Collection>(CACHE_SIZE, CACHE_SIZE, keyExternalizer) {
    @NotNull
    @Override
    public Collection createValue(K key) {
      try {
        final Collection<V> collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new BuildDataCorruptedException(e);
      }
    }
  };
}
项目:intellij-ce-playground    文件:IntIntPersistentMultiMaplet.java   
public IntIntPersistentMultiMaplet(final File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
  myMap = new PersistentHashMap<Integer, TIntHashSet>(file, keyExternalizer, new IntSetExternalizer());
  myCache = new SLRUCache<Integer, TIntHashSet>(CACHE_SIZE, CACHE_SIZE) {
    @NotNull
    @Override
    public TIntHashSet createValue(Integer key) {
      try {
        final TIntHashSet collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new BuildDataCorruptedException(e);
      }
    }
  };
}
项目:intellij-ce-playground    文件:IntObjectPersistentMultiMaplet.java   
public IntObjectPersistentMultiMaplet(final File file,
                                      final KeyDescriptor<Integer> keyExternalizer,
                                      final DataExternalizer<V> valueExternalizer,
                                      final CollectionFactory<V> collectionFactory) throws IOException {
  myValueExternalizer = valueExternalizer;
  myMap = new PersistentHashMap<Integer, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
  myCache = new SLRUCache<Integer, Collection>(CACHE_SIZE, CACHE_SIZE) {
    @NotNull
    @Override
    public Collection createValue(Integer key) {
      try {
        final Collection<V> collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new BuildDataCorruptedException(e);
      }
    }
  };
}
项目:tools-idea    文件:ObjectObjectPersistentMultiMaplet.java   
public ObjectObjectPersistentMultiMaplet(final File file,
                                      final KeyDescriptor<K> keyExternalizer,
                                      final DataExternalizer<V> valueExternalizer,
                                      final CollectionFactory<V> collectionFactory) throws IOException {
  myValueExternalizer = valueExternalizer;
  myMap = new PersistentHashMap<K, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
  myCache = new SLRUCache<K, Collection>(CACHE_SIZE, CACHE_SIZE) {
    @NotNull
    @Override
    public Collection createValue(K key) {
      try {
        final Collection<V> collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  };
}
项目:tools-idea    文件:IntIntPersistentMultiMaplet.java   
public IntIntPersistentMultiMaplet(final File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
  myMap = new PersistentHashMap<Integer, TIntHashSet>(file, keyExternalizer, new IntSetExternalizer());
  myCache = new SLRUCache<Integer, TIntHashSet>(CACHE_SIZE, CACHE_SIZE) {
    @NotNull
    @Override
    public TIntHashSet createValue(Integer key) {
      try {
        final TIntHashSet collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  };
}
项目:tools-idea    文件:IntObjectPersistentMultiMaplet.java   
public IntObjectPersistentMultiMaplet(final File file,
                                      final KeyDescriptor<Integer> keyExternalizer,
                                      final DataExternalizer<V> valueExternalizer,
                                      final CollectionFactory<V> collectionFactory) throws IOException {
  myValueExternalizer = valueExternalizer;
  myMap = new PersistentHashMap<Integer, Collection<V>>(file, keyExternalizer, new CollectionDataExternalizer<V>(valueExternalizer, collectionFactory));
  myCache = new SLRUCache<Integer, Collection>(CACHE_SIZE, CACHE_SIZE) {
    @NotNull
    @Override
    public Collection createValue(Integer key) {
      try {
        final Collection<V> collection = myMap.get(key);
        return collection == null? NULL_COLLECTION : collection;
      }
      catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  };
}
项目:lombok-intellij-plugin    文件:LombokConfigIndex.java   
@NotNull
@Override
public KeyDescriptor<ConfigIndexKey> getKeyDescriptor() {
  return new KeyDescriptor<ConfigIndexKey>() {
    @Override
    public int getHashCode(ConfigIndexKey configKey) {
      return configKey.hashCode();
    }

    @Override
    public boolean isEqual(ConfigIndexKey val1, ConfigIndexKey val2) {
      return val1.equals(val2);
    }

    @Override
    public void save(@NotNull DataOutput out, ConfigIndexKey value) throws IOException {
      out.writeUTF(StringUtil.notNullize(value.getDirectoryName()));
      out.writeUTF(StringUtil.notNullize(value.getConfigKey()));
    }

    @Override
    public ConfigIndexKey read(@NotNull DataInput in) throws IOException {
      return new ConfigIndexKey(in.readUTF(), in.readUTF());
    }
  };
}
项目:intellij-ce-playground    文件:ClassFilesIndexStorageBase.java   
public ClassFilesIndexStorageBase(final File indexDir, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer)
  throws IOException {
  myIndexFile = getIndexFile(indexDir);
  myKeyDescriptor = keyDescriptor;
  myValueExternalizer = valueExternalizer;
  initialize();
}
项目:intellij-ce-playground    文件:ClassFilesIndexStorageWriter.java   
public ClassFilesIndexStorageWriter(final File indexDir,
                                    final KeyDescriptor<K> keyDescriptor,
                                    final DataExternalizer<V> valueExternalizer,
                                    final Mappings mappings) throws IOException {
  super(indexDir, keyDescriptor, valueExternalizer);
  myMappings = mappings;
}
项目:intellij-ce-playground    文件:SmallMapSerializer.java   
public SmallMapSerializer(final File file, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer) {
  myFile = file;
  myKeyDescriptor = keyDescriptor;
  myValueExternalizer = valueExternalizer;
  myMap = new HashMap<KeyWrapper<K>, V>();
  init();
}
项目:intellij-ce-playground    文件:ValueContainerMap.java   
ValueContainerMap(@NotNull final File file,
                  @NotNull KeyDescriptor<Key> keyKeyDescriptor,
                  @NotNull DataExternalizer<Value> valueExternalizer,
                  boolean keyIsUniqueForIndexedFile
                  ) throws IOException {
  super(file, keyKeyDescriptor, new ValueContainerExternalizer<Value>(valueExternalizer));
  myValueExternalizer = valueExternalizer;
  myKeyIsUniqueForIndexedFile = keyIsUniqueForIndexedFile;
}
项目:tools-idea    文件:IntIntPersistentMaplet.java   
public IntIntPersistentMaplet(final File file, final KeyDescriptor<Integer> k) {
  try {
    myMap = new PersistentHashMap<Integer, Integer>(file, k, new DataExternalizer<Integer>() {
      @Override
      public void save(DataOutput out, Integer value) throws IOException {
        out.writeInt(value);
      }

      @Override
      public Integer read(DataInput in) throws IOException {
        return in.readInt();
      }
    });
    myCache = new SLRUCache<Integer, Object>(CACHE_SIZE, CACHE_SIZE) {
      @NotNull
      @Override
      public Object createValue(Integer key) {
        try {
          final Integer v1 = myMap.get(key);
          return v1 == null? NULL_OBJ : v1;
        }
        catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
    };
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
项目:tools-idea    文件:CallingLocation.java   
public static DataExternalizer<CallingLocation> createDataExternalizer() {
  final KeyDescriptor<MethodIncompleteSignature> methodIncompleteSignatureKeyDescriptor = MethodIncompleteSignature.createKeyDescriptor();
  return new DataExternalizer<CallingLocation>() {
    @Override
    public void save(final DataOutput out, final CallingLocation value) throws IOException {
      methodIncompleteSignatureKeyDescriptor.save(out, value.getMethodIncompleteSignature());
      VariableType.KEY_DESCRIPTOR.save(out, value.getVariableType());
    }

    @Override
    public CallingLocation read(final DataInput in) throws IOException {
      return new CallingLocation(methodIncompleteSignatureKeyDescriptor.read(in), VariableType.KEY_DESCRIPTOR.read(in));
    }
  };
}
项目:tools-idea    文件:CachedPersistentHashMap.java   
public CachedPersistentHashMap(File file, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valDescriptor, final int cacheSize) throws IOException {
  super(file, keyDescriptor, valDescriptor);
  myCache = new SLRUMap<Key,Value>(cacheSize * 2, cacheSize) {
    protected void onDropFromCache(Key key, Value value) {
      if (isValueDirty(value)) {
        try {
          CachedPersistentHashMap.super.put(key, value);
        }
        catch (IOException e) {
          LOG.info(e);
        }
      }
    }
  };
}
项目:tools-idea    文件:SmallMapSerializer.java   
public SmallMapSerializer(final File file, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer) {
  myFile = file;
  myKeyDescriptor = keyDescriptor;
  myValueExternalizer = valueExternalizer;
  myMap = new HashMap<KeyWrapper<K>, V>();
  init();
}
项目:tools-idea    文件:MapIndexStorage.java   
public MapIndexStorage(@NotNull File storageFile,
                       @NotNull KeyDescriptor<Key> keyDescriptor,
                       @NotNull DataExternalizer<Value> valueExternalizer,
                       final int cacheSize
) throws IOException {
  this(storageFile, keyDescriptor, valueExternalizer, cacheSize, false);
}
项目:tools-idea    文件:MapIndexStorage.java   
public MapIndexStorage(@NotNull File storageFile,
                       @NotNull KeyDescriptor<Key> keyDescriptor,
                       @NotNull DataExternalizer<Value> valueExternalizer,
                       final int cacheSize,
                       boolean highKeySelectivity) throws IOException {

  myStorageFile = storageFile;
  myKeyDescriptor = keyDescriptor;
  myCacheSize = cacheSize;
  myDataExternalizer = valueExternalizer;
  myHighKeySelectivity = highKeySelectivity;
  initMapAndCache();
}
项目:consulo    文件:ValueContainerMap.java   
ValueContainerMap(@Nonnull final File file,
                  @Nonnull KeyDescriptor<Key> keyKeyDescriptor,
                  @Nonnull DataExternalizer<Value> valueExternalizer,
                  boolean keyIsUniqueForIndexedFile
) throws IOException {
  super(file, keyKeyDescriptor, new ValueContainerExternalizer<Value>(valueExternalizer));
  myValueExternalizer = valueExternalizer;
  myKeyIsUniqueForIndexedFile = keyIsUniqueForIndexedFile;
}
项目:consulo    文件:SmallMapSerializer.java   
public SmallMapSerializer(final File file, final KeyDescriptor<K> keyDescriptor, final DataExternalizer<V> valueExternalizer) {
  myFile = file;
  myKeyDescriptor = keyDescriptor;
  myValueExternalizer = valueExternalizer;
  myMap = new HashMap<KeyWrapper<K>, V>();
  init();
}
项目:consulo    文件:StubIndexImpl.java   
public <K> void serializeIndexValue(DataOutput out, StubIndexKey<K, ?> stubIndexKey, Map<K, StubIdList> map) throws IOException {
  MyIndex<K> index = (MyIndex<K>)getAsyncState().myIndices.get(stubIndexKey);
  KeyDescriptor<K> keyDescriptor = index.getExtension().getKeyDescriptor();

  DataInputOutputUtil.writeINT(out, map.size());
  for(K key:map.keySet()) {
    keyDescriptor.save(out, key);
    StubIdExternalizer.INSTANCE.save(out, map.get(key));
  }
}
项目:consulo-java    文件:CachedPersistentHashMap.java   
public CachedPersistentHashMap(File file, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valDescriptor, final int cacheSize) throws IOException {
  super(file, keyDescriptor, valDescriptor);
  myCache = new SLRUMap<Key,Value>(cacheSize * 2, cacheSize) {
    protected void onDropFromCache(Key key, Value value) {
      if (isValueDirty(value)) {
        try {
          CachedPersistentHashMap.super.put(key, value);
        }
        catch (IOException e) {
          LOG.info(e);
        }
      }
    }
  };
}
项目:yii2inspections    文件:TranslationKeysIndexer.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return this.descriptor;
}
项目:yii2inspections    文件:TranslationCallsIndexer.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return this.descriptor;
}
项目:idea-php-typo3-plugin    文件:ControllerActionIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return new EnumeratorStringDescriptor();
}
项目:idea-php-typo3-plugin    文件:ResourcePathIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return EnumeratorStringDescriptor.INSTANCE;
}
项目:idea-php-typo3-plugin    文件:RouteIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return new EnumeratorStringDescriptor();
}
项目:idea-php-typo3-plugin    文件:TranslationIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return EnumeratorStringDescriptor.INSTANCE;
}
项目:idea-php-typo3-plugin    文件:AbstractScalarExtensionScannerIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:idea-php-typo3-plugin    文件:IconIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return EnumeratorStringDescriptor.INSTANCE;
}
项目:idea-php-typo3-plugin    文件:ExtensionNameStubIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:idea-php-typo3-plugin    文件:LegacyClassesForIDEIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:idea-php-typo3-plugin    文件:TablenameFileIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return EnumeratorStringDescriptor.INSTANCE;
}
项目:idea-php-typo3-plugin    文件:CoreServiceMapStubIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return this.myKeyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:VirtualTypeIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return this.myKeyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:TypeConfigurationIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:EventObserverIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:ModulePackageIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return new EnumeratorStringDescriptor();
}
项目:magento2-phpstorm-plugin    文件:WebApiTypeIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return keyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:PluginIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}
项目:magento2-phpstorm-plugin    文件:NamedComponentIndex.java   
@NotNull
@Override
public KeyDescriptor<String> getKeyDescriptor() {
    return myKeyDescriptor;
}