package speiger.src.coreengine.utils.collections.registries.simple;

import java.util.Collection;
import java.util.Set;

import speiger.src.coreengine.assets.AssetLocation;

public interface IRegistry<T extends IRegistryEntry<T>> extends Iterable<T>
{
	public T register(T value);
	
	public default int getId(T value){return getId(value.getName());}
	public int getId(AssetLocation name);
	public AssetLocation getName(int id);
	public T getValue(AssetLocation name);
	public default T getValue(int id){return getValue(getName(id));}
	
	public default boolean contains(AssetLocation name){return getValue(name) != null;}
	public default boolean contains(T value){return contains(value.getName());}
	
	public Set<AssetLocation> keySet();
	public Collection<T> values();
}
