/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inport; import java.util.List; import java.util.OptionalInt; /** * * @author topazh_ag */ public class MovingTemplate extends TowUsingTemplate { private MovingObject mover; private OptionalInt moverType = OptionalInt.empty(); private Berth destination; /** * Get the value of destination * * @return the value of destination */ public Berth getDestination() { return destination; } /** * Set the value of destination * * @param destination new value of destination */ public void setDestination(Berth destination) { this.destination = destination; } /** * Get the value of mover * * @return the value of mover */ public MovingObject getMover() { return mover; } /** * Set the value of mover * * @param mover new value of mover */ public void setMover(MovingObject mover) { this.mover = mover; } public OptionalInt getMoverType() { return moverType; } public void setMoverType(OptionalInt moverType) { this.moverType = moverType; } public MovingTemplate(MovingObject mover, Berth source, Berth destination, List resourcesTypes, double duration, int id) { super(duration, id, source); this.mover = mover; this.destination = destination; this.setResourcesTypes(resourcesTypes); } public MovingTemplate() { super(); } @Override public String toString() { String res = ""; boolean first = true; for(Tow eq : getResources()) { if (!first) res += "," + eq.getId(); else res += eq.getId(); first = false; } for (Integer t : getResourcesTypes()) { if (!first) res += "," + t; else res += t; first = false; } String result = getId() + "; " + "mov; " + twtoString() + "; "; if (getMoverType().isPresent()) { result += getMoverType().getAsInt(); } else { result += mover.getId(); } return result + "; " + getStartLocation().getId() + "; " + destination.getId() + "; [" + res +"]; "+getDuration(); } }