动态添加词典

@param <T>
@param <T>

@param FILTERDefault
@param FILTERDefault2
@param FILTER2
187782
public static synchronized StopRecognition putIfAbsent(String key, String path, StopRecognition stopRecognition) {
        KV<String, StopRecognition> kv = STOP.get(key);
        if (kv != null && kv.getV() != null) {
            return kv.getV();
        }
        put(key, path, stopRecognition);
        return stopRecognition;
    }
216468
@Bind(aggregate = true, optional = true)
    public void bindFilter(Filter filter) {
        filters.add(filter);
    }
1120781
public final void addFilters(final List<IDataFilter> newFilters) {
        assertFilterListExists();
        for (IDataFilter filter : newFilters) {
            addFilter(filter);
        }
    }
986653
@SuppressWarnings("checkstyle:npathcomplexity")
    @Override
    public int doFilter(EventFilter filter, Data dataKey, Object oldValue, Object dataValue, EntryEventType eventType,
                        String mapNameOrNull) {
        if (filter instanceof MapPartitionLostEventFilter) {
            return FILTER_DOES_NOT_MATCH;
        }

        // the order of the following ifs is important!
        // QueryEventFilter is instance of EntryEventFilter
        if (filter instanceof EventListenerFilter) {
            if (!filter.eval(eventType.getType())) {
                return FILTER_DOES_NOT_MATCH;
            } else {
                filter = ((EventListenerFilter) filter).getEventFilter();
            }
        }
        if (filter instanceof TrueEventFilter) {
            return eventType.getType();
        }
        if (filter instanceof QueryEventFilter) {
            return processQueryEventFilter(filter, eventType, dataKey, oldValue, dataValue, mapNameOrNull)
                    ? eventType.getType() : FILTER_DOES_NOT_MATCH;
        }
        if (filter instanceof EntryEventFilter) {
            return processEntryEventFilter(filter, dataKey) ? eventType.getType() : FILTER_DOES_NOT_MATCH;
        }
        throw new IllegalArgumentException("Unknown EventFilter type = [" + filter.getClass().getCanonicalName() + "]");
    }
1028496
private void add(FieldFilter filter) {
        switch(operator) {
        case NOT:
            filters.add(new NegationFieldFilter(filter));
            operator = Operator.NONE;
            break;
        case OR:
            filters.set(filters.size() - 1, 
                        new OrFieldFilter(filters.get(filters.size() - 1), filter));
            operator = Operator.NONE;
            break;
        default:
            filters.add(filter);
            break;
        }
    }
755698
public void with(@javax.annotation.Nonnull final java.util.function.Consumer<T> f, final Predicate<T> filter) {
    final T prior = currentValue.get();
    if (null != prior) {
      f.accept(prior);
    }
    else {
      final T poll = get(filter);
      try {
        currentValue.set(poll);
        f.accept(poll);
      } finally {
        this.pool.add(poll);
        currentValue.remove();
      }
    }
  }
576249
private FilterDescriptor createFilter(FilterType filterType, Map<String, FilterDescriptor> filters, ScannerContext context) {
        Store store = context.getStore();
        FilterDescriptor filterDescriptor = getOrCreateNamedDescriptor(FilterDescriptor.class, filterType.getFilterName().getValue(), filters, store);
        setAsyncSupported(filterDescriptor, filterType.getAsyncSupported());
        for (DescriptionType descriptionType : filterType.getDescription()) {
            filterDescriptor.getDescriptions().add(XmlDescriptorHelper.createDescription(descriptionType, store));
        }
        for (DisplayNameType displayNameType : filterType.getDisplayName()) {
            filterDescriptor.getDisplayNames().add(XmlDescriptorHelper.createDisplayName(displayNameType, store));
        }
        FullyQualifiedClassType filterClass = filterType.getFilterClass();
        if (filterClass != null) {
            TypeResolver typeResolver = context.peek(TypeResolver.class);
            TypeCache.CachedType<TypeDescriptor> filterClassDescriptor = typeResolver.resolve(filterClass.getValue(), context);
            filterDescriptor.setType(filterClassDescriptor.getTypeDescriptor());
        }
        for (IconType iconType : filterType.getIcon()) {
            IconDescriptor iconDescriptor = XmlDescriptorHelper.createIcon(iconType, store);
            filterDescriptor.getIcons().add(iconDescriptor);
        }
        for (ParamValueType paramValueType : filterType.getInitParam()) {
            ParamValueDescriptor paramValueDescriptor = createParamValue(paramValueType, store);
            filterDescriptor.getInitParams().add(paramValueDescriptor);
        }
        return filterDescriptor;
    }
421017
public void init(BaseMessageReceiver messageReceiver, BaseMessageFilter messageFilter)
    {
        if (messageFilter == null)
        {
            if (messageReceiver != null)
            {
                messageFilter = messageReceiver.createDefaultFilter(this);    // Add filter to handler
                return; // All done. (createDefaultFilter adds the message listener to the new filter)
            }
        }
        if (messageFilter != null)
            messageFilter.addMessageListener(this);     // This will also add the message filter to my list.
    }
597942
private static void init(List<File> list, File dir, Filter filter)
    {
        File[] files = dir.listFiles();
        for (int i = 0; i < files.length; i++)
        {
            if (files[i].isDirectory())
            {
                init(list, files[i], filter);
            }
            else
            {
                if (filter == null || filter.accepts(files[i].getAbsolutePath()))
                {
                    list.add(files[i]);
                }
            }
        }
    }
1109750
void filterTree(String filter) {

        HierarchicalContainer container = (HierarchicalContainer)m_tree.getContainerDataSource();
        container.removeAllContainerFilters();
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(filter)) {
            final String lowerCaseFilter = filter.toLowerCase();
            container.addContainerFilter(new Filter() {

                private static final long serialVersionUID = 1L;

                public boolean appliesToProperty(Object propertyId) {

                    return true;
                }

                public boolean passesFilter(Object itemId, Item item) throws UnsupportedOperationException {

                    CmsCategory cat = (CmsCategory)itemId;

                    return cat.getPath().toLowerCase().contains(lowerCaseFilter)
                        || ((cat.getTitle() != null) && cat.getTitle().toLowerCase().contains(lowerCaseFilter));
                }
            });
        }
    }
997240
public static <T> Collection<T> filter(Collection<T> collection, Filter<T> filter) {
		if (null == collection || null == filter) {
			return collection;
		}

		Collection<T> collection2 = ObjectUtil.clone(collection);
		try {
			collection2.clear();
		} catch (UnsupportedOperationException e) {
			// 克隆后的对象不支持清空，说明为不可变集合对象，使用默认的ArrayList保存结果
			collection2 = new ArrayList<>();
		}

		for (T t : collection) {
			if (filter.accept(t)) {
				collection2.add(t);
			}
		}
		return collection2;
	}
287305
public void addFilter(Filter filter) {
    filter.setInitialContext(initialContext);

    int minIndex = Integer.MAX_VALUE;
    String[] before = filter.before();
    for (int i = 0; i < before.length; i++) {
        String s = before[i];
        int index = index(activeFilters, s);
        if (index < minIndex) {
          minIndex = index;
        }
      }
      if (minIndex == Integer.MAX_VALUE) {
        // -1 is more usable for not-found than MAX_VALUE
        minIndex = -1;
      }

    if (contains(filter.before(), FIRST_IN_PIPE)) {
      activeFilters.add(0, filter);
    } else if (minIndex != -1) {
      activeFilters.add(minIndex, filter);
    } else {
      activeFilters.add(filter);
    }
  }
354269
public void addFilter(Filter filter) {
		List<Filter> filters = filterFactory.getAllFilter();
		
		int index = searchFilterIndex(filters, filter.getId(), 0, filters.size());
		
		if (index == -1) {
			// not found - put at the end
			filters.add(filter);
		} else {
			filters.add(index, filter);
		}
	}
567868
public void addMessageFilter(BaseMessageFilter messageFilter)
    {
        if (messageFilter == null)
            return;
        m_mapFilters.put(m_intNext, messageFilter);
        messageFilter.setMessageReceiver(this.getMessageReceiver(), m_intNext);
        int i = m_intNext.intValue();
        if (i == Integer.MAX_VALUE)
            i = 0;
        m_intNext = new Integer(i + 1);
    }
1030456
public void setDependencyFilter(ObjectNode filter) {
        if (filter == null) {
            return;
        }
        final JsonNode patterns = filter.get("patterns");
        if (patterns != null && patterns.isArray()) {
            List<String> ids = new ArrayList<>();
            for (JsonNode exclusion : patterns) {
                ids.add(exclusion.asText());
            }
            setDependencyFilter(new ExcludesArtifactFilter(ids));
        }
    }
1188494
public static <E> Filter<E> orFilter(Filter<E> f1, Filter<E> f2) {
    return (new CombinedFilter<E>(f1, f2, false));
  }
917071
public void addFilter(String filter) {

        if (CmsStringUtil.isNotEmpty(filter)) {
            filter = filter.trim().toLowerCase();
            if (FILTERS.contains(filter)) {
                m_filters.add(filter);
            }
        }
    }