@@ -0,0 +1,2979 @@
+package hu.webarticum.jsatbuilder.builder.common;%0A%0Aimport java.util.Collection;%0Aimport java.util.Comparator;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Set;%0Aimport java.util.TreeMap;%0A%0Aimport hu.webarticum.jsatbuilder.builder.core.CollapseException;%0Aimport hu.webarticum.jsatbuilder.builder.core.Definition;%0Aimport hu.webarticum.jsatbuilder.builder.core.Helper;%0Aimport hu.webarticum.jsatbuilder.builder.core.RemovalListener;%0A%0Apublic class HelperMap%3CT%3E implements Map%3CT, Helper%3E %7B%0A%0A    private final Map%3CT, Helper%3E innerMap;%0A    %0A    private final HelperRemovalListener removalListener = new HelperRemovalListener();%0A    %0A    public HelperMap() %7B%0A        this(false);%0A    %7D%0A%0A    public HelperMap(boolean navigable) %7B%0A        if (navigable) %7B%0A            innerMap = new TreeMap%3CT, Helper%3E();%0A        %7D else %7B%0A            innerMap = new HashMap%3CT, Helper%3E();%0A        %7D%0A    %7D%0A%0A    public HelperMap(Comparator%3CT%3E comparator) %7B%0A        innerMap = new TreeMap%3CT, Helper%3E(comparator);%0A    %7D%0A%0A    @Override%0A    public int size() %7B%0A        return innerMap.size();%0A    %7D%0A%0A    @Override%0A    public boolean isEmpty() %7B%0A        return innerMap.isEmpty();%0A    %7D%0A%0A    @Override%0A    public boolean containsKey(Object key) %7B%0A        return innerMap.containsKey(key);%0A    %7D%0A%0A    @Override%0A    public boolean containsValue(Object value) %7B%0A        return innerMap.containsValue(value);%0A    %7D%0A%0A    @Override%0A    public Helper get(Object key) %7B%0A        return innerMap.get(key);%0A    %7D%0A%0A    @Override%0A    public Helper put(T key, Helper value) %7B%0A        if (!register(key, value)) %7B%0A            return value;%0A        %7D%0A        %0A        Helper existing = innerMap.put(key, value);%0A        %0A        if (existing != null) %7B%0A            existing.removeRemovalListener(removalListener);%0A        %7D%0A        %0A        return existing;%0A    %7D%0A%0A    @Override%0A    public Helper remove(Object key) %7B%0A        return innerMap.remove(key);%0A    %7D%0A%0A    @Override%0A    public void putAll(Map%3C? extends T, ? extends Helper%3E m) %7B%0A        for (Map.Entry%3C? extends T, ? extends Helper%3E entry: m.entrySet()) %7B%0A            innerMap.put(entry.getKey(), entry.getValue());%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void clear() %7B%0A        innerMap.clear();%0A    %7D%0A%0A    @Override%0A    public Set%3CT%3E keySet() %7B%0A        return innerMap.keySet();%0A    %7D%0A%0A    @Override%0A    public Collection%3CHelper%3E values() %7B%0A        return innerMap.values();%0A    %7D%0A%0A    @Override%0A    public Set%3CEntry%3CT, Helper%3E%3E entrySet() %7B%0A        return innerMap.entrySet();%0A    %7D%0A%0A    private boolean register(T key, Helper helper) %7B%0A        if (helper.isRemoved()) %7B%0A            return false;%0A        %7D%0A        %0A        helper.addRemovalListener(removalListener);%0A        return true;%0A    %7D%0A    %0A    private class HelperRemovalListener implements RemovalListener %7B%0A%0A        @Override%0A        public void definitionRemoved(Definition definition) throws CollapseException %7B%0A            innerMap.remove(definition);%0A        %7D%0A        %0A    %7D%0A    %0A%7D%0A

Add HelperMap