package biz.plexers.sparrow.core;

import java.util.HashMap;

public class Upgrade {

	private HashMap<UpgradableShipAttribute.Choices, UpgradableShipAttribute> profits;
	private ResourcesManager requirements;

	public Upgrade(int cannonsValue, int crewValue, int armorValue,
			int healthValue) {

	}

	public Upgrade() {
		profits = new HashMap<>();
	}

	public ResourcesManager getRequirements() {
		return requirements;
	}

	public void setAttribute(UpgradableShipAttribute.Choices choice, int value) {
		UpgradableShipAttribute attribute = new UpgradableShipAttribute(choice,
				value);

		profits.put(choice, attribute);
		requirements.calculateRequirementFor(choice, value);
		// TODO Fix NullPointer Exception
	}

	public UpgradableShipAttribute getAttribute(
			UpgradableShipAttribute.Choices choice) {
		return profits.get(choice);
	}

	public void calculateRequirements() {
		// TODO Add implementation
	}

}

@@ -345,16 +345,57 @@
 ap%3C%3E();%0A
+%09%09requirements = new ResourcesManager();%0A
 %09%7D%0A%0A%09pub

Fix null pointer exception