FieldTypeLookup() { fullNameToFieldType = new CopyOnWriteHashMap<>(); aliasToConcreteName = new CopyOnWriteHashMap<>(); fullNameToTypes = new CopyOnWriteHashMap<>(); }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Remove the given key from this map. The current hash table is not modified. */ public CopyOnWriteHashMap<K, V> copyAndRemove(Object key) { if (key == null) { throw new IllegalArgumentException("null keys are not supported"); } final int hash = key.hashCode(); final InnerNode<K, V> newRoot = root.remove(key, hash); if (root == newRoot) { return this; } else { return new CopyOnWriteHashMap<>(newRoot, size - 1); } }
/** * Associate <code>key</code> with <code>value</code> and return a new copy * of the hash table. The current hash table is not modified. */ public CopyOnWriteHashMap<K, V> copyAndPut(K key, V value) { if (key == null) { throw new IllegalArgumentException("null keys are not supported"); } if (value == null) { throw new IllegalArgumentException("null values are not supported"); } final int hash = key.hashCode(); final MutableValueInt newValue = new MutableValueInt(); final InnerNode<K, V> newRoot = root.put(key, hash, TOTAL_HASH_BITS, value, newValue); final int newSize = size + newValue.value; return new CopyOnWriteHashMap<>(newRoot, newSize); }
/** * Build a mapping update with the provided sub mapping update. */ public ObjectMapper mappingUpdate(Mapper mapper) { ObjectMapper mappingUpdate = clone(); // reset the sub mappers mappingUpdate.mappers = new CopyOnWriteHashMap<>(); mappingUpdate.putMapper(mapper); return mappingUpdate; }
ObjectMapper(String name, String fullPath, boolean enabled, Nested nested, Dynamic dynamic, Boolean includeInAll, Map<String, Mapper> mappers, Settings settings) { super(name); assert settings != null; Version indexCreatedVersion = Version.indexCreated(settings); if (indexCreatedVersion.onOrAfter(Version.V_5_0_0_beta1)) { if (name.isEmpty()) { throw new IllegalArgumentException("name cannot be empty string"); } } this.fullPath = fullPath; this.enabled = enabled; this.nested = nested; this.dynamic = dynamic; this.includeInAll = includeInAll; if (mappers == null) { this.mappers = new CopyOnWriteHashMap<>(); } else { this.mappers = CopyOnWriteHashMap.copyOf(mappers); } this.nestedTypePathAsString = "__" + fullPath; this.nestedTypePathAsBytes = new BytesRef(nestedTypePathAsString); this.nestedTypeFilter = new TermQuery(new Term(TypeFieldMapper.NAME, nestedTypePathAsBytes)); }
/** Create a new empty instance. */ FieldTypeLookup() { fullNameToFieldType = new CopyOnWriteHashMap<>(); fullNameToTypes = new CopyOnWriteHashMap<>(); }
/** Create a new empty instance. */ public FieldTypeLookup() { fullNameToFieldType = new CopyOnWriteHashMap<>(); fullNameToTypes = new CopyOnWriteHashMap<>(); indexNameToFieldType = new CopyOnWriteHashMap<>(); indexNameToTypes = new CopyOnWriteHashMap<>(); }
FieldTypeLookup() { fullNameToFieldType = new CopyOnWriteHashMap<>(); aliasToConcreteName = new CopyOnWriteHashMap<>(); fullNameToTypes = new CopyOnWriteHashMap<>(); }
FieldTypeLookup() { fullNameToFieldType = new CopyOnWriteHashMap<>(); aliasToConcreteName = new CopyOnWriteHashMap<>(); fullNameToTypes = new CopyOnWriteHashMap<>(); }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Remove the given key from this map. The current hash table is not modified. */ public CopyOnWriteHashMap<K, V> copyAndRemove(Object key) { Preconditions.checkArgument(key != null, "Null keys are not supported"); final int hash = key.hashCode(); final InnerNode<K, V> newRoot = root.remove(key, hash); if (root == newRoot) { return this; } else { return new CopyOnWriteHashMap<>(newRoot, size - 1); } }
/** * Build a mapping update with the provided sub mapping update. */ public ObjectMapper mappingUpdate(Mapper mapper) { ObjectMapper mappingUpdate = clone(); // reset the sub mappers mappingUpdate.mappers = new CopyOnWriteHashMap<>(); mappingUpdate.putMapper(mapper); return mappingUpdate; }
/** * Build a mapping update with the provided sub mapping update. */ public ObjectMapper mappingUpdate(Mapper mapper) { ObjectMapper mappingUpdate = clone(); // reset the sub mappers mappingUpdate.mappers = new CopyOnWriteHashMap<>(); mappingUpdate.putMapper(mapper); return mappingUpdate; }
/** * Build a mapping update with the provided sub mapping update. */ public ObjectMapper mappingUpdate(Mapper mapper) { ObjectMapper mappingUpdate = clone(); // reset the sub mappers mappingUpdate.mappers = new CopyOnWriteHashMap<>(); mappingUpdate.putMapper(mapper); return mappingUpdate; }
/** * Build a mapping update with the provided sub mapping update. */ public ObjectMapper mappingUpdate(Mapper mapper) { ObjectMapper mappingUpdate = clone(); // reset the sub mappers mappingUpdate.mappers = new CopyOnWriteHashMap<>(); mappingUpdate.putMapper(mapper); return mappingUpdate; }
/** * Associate <code>key</code> with <code>value</code> and return a new copy * of the hash table. The current hash table is not modified. */ public CopyOnWriteHashMap<K, V> copyAndPut(K key, V value) { Preconditions.checkArgument(key != null, "null keys are not supported"); Preconditions.checkArgument(value != null, "null values are not supported"); final int hash = key.hashCode(); final MutableValueInt newValue = new MutableValueInt(); final InnerNode<K, V> newRoot = root.put(key, hash, TOTAL_HASH_BITS, value, newValue); final int newSize = size + newValue.value; return new CopyOnWriteHashMap<>(newRoot, newSize); }