/* * 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 MooringTemplate extends TowUsingTemplate { private TransportShip moorer; private OptionalInt moorerType = OptionalInt.empty(); private boolean direct; public OptionalInt getMoorerType() { return moorerType; } public void setMoorerType(OptionalInt moorerType) { this.moorerType = moorerType; } /** * Get the value of direction * * @return the value of direction */ public boolean isDirect() { return direct; } /** * Set the value of direction * * @param direction new value of direction */ public void setDirect(boolean direct) { this.direct = direct; } /** * Get the value of moorer * * @return the value of moorer */ public MovingObject getMoorer() { return moorer; } /** * Set the value of moorer * * @param mover new value of moorer */ public void setMoorer(TransportShip moorer) { this.moorer = moorer; } public MooringTemplate(TransportShip moorer, Berth berth, List resourcesTypes, double duration, boolean direct, int id) { super(duration, id, berth); this.moorer = moorer; this.direct = direct; this.setResourcesTypes(resourcesTypes); } public MooringTemplate() { 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 code = "mrn"; if (!direct) code = "unm"; String result = getId() + "; " + code + "; " + twtoString() + "; "; if (moorerType.isPresent()) { result += moorerType.getAsInt(); } else { result += moorer.getId(); } return result + "; " + getStartLocation().getId() + "; [" + res +"]; "+getDuration(); } }