2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.emc;
|
2012-10-16 03:42:57 +02:00
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2012-10-27 23:41:02 +02:00
|
|
|
/**
|
2013-03-08 19:40:59 +01:00
|
|
|
* Equivalent-Exchange-3
|
2012-10-27 23:41:02 +02:00
|
|
|
*
|
2013-03-08 19:40:59 +01:00
|
|
|
* EMCEntry
|
2012-10-27 23:41:02 +02:00
|
|
|
*
|
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*
|
|
|
|
*/
|
2012-10-16 03:42:57 +02:00
|
|
|
public class EMCEntry {
|
|
|
|
|
2012-12-19 19:09:56 +01:00
|
|
|
private float cost, recoveryPercentage;
|
|
|
|
private boolean learnable, recoverable;
|
|
|
|
private Map<EMCType, Float> breakdown;
|
|
|
|
|
|
|
|
public EMCEntry(float cost) {
|
|
|
|
|
|
|
|
this.cost = cost;
|
|
|
|
recoveryPercentage = 1F;
|
|
|
|
learnable = true;
|
|
|
|
recoverable = true;
|
|
|
|
breakdown = Collections.synchronizedMap(new HashMap<EMCType, Float>());
|
|
|
|
}
|
|
|
|
|
|
|
|
public EMCEntry(float cost, float recoveryPercentage, boolean learnable, boolean recoverable) {
|
|
|
|
|
|
|
|
this.cost = cost;
|
|
|
|
this.recoveryPercentage = recoveryPercentage;
|
|
|
|
this.learnable = learnable;
|
|
|
|
this.recoverable = recoverable;
|
|
|
|
breakdown = Collections.synchronizedMap(new HashMap<EMCType, Float>());
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getCost() {
|
|
|
|
|
|
|
|
return cost;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getRecoveryPercentage() {
|
|
|
|
|
|
|
|
return recoveryPercentage;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isLearnable() {
|
|
|
|
|
|
|
|
return learnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isRecoverable() {
|
|
|
|
|
|
|
|
return recoverable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Map<EMCType, Float> getEMCBreakDown() {
|
|
|
|
|
|
|
|
return breakdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getEMCBreakdownByType(EMCType emcType) {
|
|
|
|
|
|
|
|
if (breakdown.containsKey(emcType)) {
|
2013-03-08 19:40:59 +01:00
|
|
|
if (breakdown.get(emcType) != null)
|
2012-12-19 19:09:56 +01:00
|
|
|
return breakdown.get(emcType).floatValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1F;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCost(float cost) {
|
|
|
|
|
|
|
|
this.cost = cost;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRecoveryPercentage(float recoveryPercentage) {
|
|
|
|
|
|
|
|
this.recoveryPercentage = recoveryPercentage;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLearnable(boolean learnable) {
|
|
|
|
|
|
|
|
this.learnable = learnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRecoverable(boolean recoverable) {
|
|
|
|
|
|
|
|
this.recoverable = recoverable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addEMCBreakDown(EMCType emcType, Float breakdownPercentage) {
|
|
|
|
|
2013-03-08 19:40:59 +01:00
|
|
|
if (!breakdown.containsKey(emcType)) {
|
2012-12-19 19:09:56 +01:00
|
|
|
breakdown.put(emcType, breakdownPercentage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEMCBreakDown(EMCType emcType, Float breakdownPercentage) {
|
|
|
|
|
|
|
|
if (breakdown.containsKey(emcType)) {
|
|
|
|
breakdown.put(emcType, breakdownPercentage);
|
|
|
|
}
|
|
|
|
}
|
2012-10-16 03:42:57 +02:00
|
|
|
|
|
|
|
}
|