2013-05-27 05:02:24 +02:00
|
|
|
package com.pahimar.ee3.emc;
|
|
|
|
|
|
|
|
public class EmcComponent {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
private final EmcType emcType;
|
|
|
|
private final float percentage;
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
public EmcComponent(EmcType emcType, float percentage) {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
this.emcType = emcType;
|
|
|
|
this.percentage = percentage;
|
|
|
|
}
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
public EmcType getEmcType() {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
return emcType;
|
|
|
|
}
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
public float getPercentage() {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
return percentage;
|
|
|
|
}
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object object) {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
if (!(object instanceof EmcComponent)) {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
return false;
|
|
|
|
}
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
EmcComponent emcBreakDown = (EmcComponent) object;
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
return ((this.emcType == emcBreakDown.emcType) && (this.percentage == emcBreakDown.percentage));
|
|
|
|
}
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
stringBuilder.append(String.format("<EMC Type: %s, Percentage: %s>", emcType, (percentage * 100)));
|
2013-07-03 20:36:35 +02:00
|
|
|
|
2013-05-27 05:02:24 +02:00
|
|
|
return stringBuilder.toString();
|
|
|
|
}
|
|
|
|
}
|