package de.eightbitboy.ecorealms.simulation;

import java.util.EnumMap;
import java.util.Map;
import java.util.Set;

public class Inventory {

	private Map<Resource, Integer> resources; //TODO Find a better name!?

	public Inventory() {
		resources = new EnumMap<Resource, Integer>(Resource.class);
	}

	public Set<Resource> getResources() {
		return resources.keySet();
	}

	public void add(Resource resource, int amount) {
		//TODO
	}

	public int get(Resource resource) {
		if (!resources.containsKey(resource)) {
			return 0;
		}
		return resources.get(resource);
	}

	public int remove(Resource resource, int amount) {
		return 0; //TODO
	}
}

@@ -372,71 +372,8 @@
 %09%7D%0A%0A
-%09public void add(Resource resource, int amount) %7B%0A%09%09//TODO%0A%09%7D%0A%0A
 %09pub
@@ -514,70 +514,477 @@
 lic 
-int remove(Resource resource, int amount) %7B%0A%09%09return 0; //TODO
+void add(Resource resource, int amount) %7B%0A%09%09checkAmount(resource, amount);%0A%09%09if (resources.containsKey(resource)) %7B%0A%09%09%09resources.put(resource, amount);%0A%09%09%7D else %7B%0A%0A%09%09%7D%0A%09%7D%0A%0A%09public int remove(Resource resource, int amount) %7B%0A%09%09checkAmount(resource, amount);%0A%09%09return 0; //TODO%0A%09%7D%0A%0A%09private void checkAmount(Resource resource, int amount) %7B%0A%09%09if (amount %3C 0) %7B%0A%09%09%09throw new RuntimeException(%22The resource amount is negative! %22%0A%09%09%09%09%09+ resource.name() + %22: %22 + amount);%0A%09%09%7D
 %0A%09%7D%0A

Implement logic