package org.genericsystem.api.core;

import java.util.function.Function;

public enum Filters {

	INSTANCES(vertex -> (x -> vertex.equals(x.getMeta()))), INHERITINGS(vertex -> (x -> x.getSupers().contains(vertex))), COMPOSITES(vertex -> (x -> x.getComponents().contains(vertex)));

	private Function<IGeneric<?>, IndexFilter> getFilter;

	Filters(Function<IGeneric<?>, IndexFilter> getFilter) {
		this.getFilter = getFilter;
	}

	public <T extends IGeneric<T>> IndexFilter getFilter(T generic) {
		return getFilter.apply(generic);
	}

	public static interface IndexFilter<T extends IGeneric<T>> {
		boolean test(T generic);
	}

	public static NoFilter<?> NO_FILTER = new NoFilter<>();

	public static class NoFilter<T extends IGeneric<T>> implements IndexFilter<T> {
		@Override
		public boolean test(T generic) {
			return true;
		}
	}
}

@@ -30,16 +30,63 @@
 .core;%0A%0A
+import java.util.concurrent.ConcurrentHashMap;%0A
 import j
@@ -113,16 +113,16 @@
 nction;%0A
-
 %0Apublic 
@@ -376,16 +376,550 @@
 tFilter;
+%0A%09private static ConcurrentHashMap%3CFilters, ConcurrentHashMap%3CIGeneric%3C?%3E, IndexFilter%3E%3E filters = new ConcurrentHashMap%3CFilters, ConcurrentHashMap%3CIGeneric%3C?%3E, IndexFilter%3E%3E() %7B%0A%0A%09%09@Override%0A%09%09public ConcurrentHashMap%3CIGeneric%3C?%3E, IndexFilter%3E get(Object key) %7B%0A%09%09%09return computeIfAbsent((Filters) key, filter -%3E new ConcurrentHashMap%3CIGeneric%3C?%3E, IndexFilter%3E() %7B%0A%0A%09%09%09%09@Override%0A%09%09%09%09public IndexFilter get(Object key_) %7B%0A%09%09%09%09%09return computeIfAbsent((IGeneric%3C?%3E) key_, g -%3E ((Filters) key).getFilter.apply(g));%0A%09%09%09%09%7D%0A%0A%09%09%09%7D);%0A%09%09%7D%0A%09%7D;
 %0A%0A%09Filte
@@ -1079,31 +1079,37 @@
 %09return 
-getF
+f
 ilter
-.apply
+s.get(this).get
 (generic

Store calculated filters