LOG121_TP01/src/metadata/FactoryMetadata.java
2022-06-07 21:07:49 -04:00

56 lines
1.6 KiB
Java

package metadata;
import simulation.BuildingState;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
public class FactoryMetadata extends BuildingMetadata {
private final int productionInterval;
private final Collection<FactoryInput> inputs;
private final FactoryOutput output;
public FactoryMetadata(String type, Map<BuildingState, String> iconsPaths, int productionInterval, Collection<FactoryInput> inputs, FactoryOutput output) {
super(type, iconsPaths);
this.productionInterval = productionInterval;
this.inputs = inputs;
this.output = output;
}
public int getProductionInterval() {
return productionInterval;
}
public Collection<FactoryInput> getInputs() {
return inputs;
}
public FactoryOutput getOutput() {
return output;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
FactoryMetadata that = (FactoryMetadata) o;
return productionInterval == that.productionInterval && inputs.equals(that.inputs) && output.equals(that.output);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), productionInterval, inputs, output);
}
@Override
public String toString() {
return "FactoryMetadata{" +
"productionInterval=" + productionInterval +
", inputs=" + inputs +
", output=" + output +
"} " + super.toString();
}
}