package ui.model; import classes.CpsEdge; import classes.HolonObject; import ui.model.DecoratedCable.CableState; /** * Intermediate to calculate/simulate the burning of Cables. * When all burning is done the Cable will be represented as a DecoratedCable. * @see DecoratedCable */ public class IntermediateCableWithState { private CableState state; private CpsEdge model; public IntermediateCableWithState(CpsEdge model,CableState state) { this.model = model; this.state = state; } public CableState getState() { return state; } public void setState(CableState state) { this.state = state; } public CpsEdge getModel() { return model; } //ugly public float getEnergyFromConnetedAtTimestep(int iteration) { float energy = 0.0f; if(model.getA() instanceof HolonObject && ((HolonObject) model.getA()).getEnergyAtTimeStep(iteration) > 0) energy += ((HolonObject) model.getA()).getEnergyAtTimeStep(iteration); if(model.getB() instanceof HolonObject && ((HolonObject) model.getB()).getEnergyAtTimeStep(iteration) > 0) energy += ((HolonObject) model.getB()).getEnergyAtTimeStep(iteration); return energy; } }