12345678910111213141516171819202122232425262728293031323334353637 |
- package ui.model;
- import model.Edge;
- import model.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 Edge model;
- public IntermediateCableWithState(Edge model,CableState state)
- {
- this.model = model;
- this.state = state;
- }
- public CableState getState() {
- return state;
- }
- public void setState(CableState state) {
- this.state = state;
- }
- public Edge getModel() {
- return model;
- }
- //ugly
- public float getEnergyFromConneted() {
- float energy = 0.0f;
- if(model.getA() instanceof HolonObject && ((HolonObject) model.getA()).getActualEnergy() > 0) energy += ((HolonObject) model.getA()).getActualEnergy();
- if(model.getB() instanceof HolonObject && ((HolonObject) model.getB()).getActualEnergy() > 0) energy += ((HolonObject) model.getB()).getActualEnergy();
- return energy;
- }
-
- }
|