/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inport; import java.util.ArrayList; import java.util.List; /** * * @author topazh_ag */ public class LoadingTemplate extends OperationTemplate { private TransportShip loader; private Storage storage; private List resources; private double intensity; private boolean withMooring; private Cargo cargo; /** * Get the value of resources * * @return the value of resources */ public List getResources() { return resources; } /** * Set the value of resources * * @param resources new value of resources */ public void setResources(List resources) { this.resources = resources; } public TransportShip getLoader() { return loader; } public void setLoader(TransportShip loader) { this.loader = loader; } public double getIntensity() { return intensity; } public void setIntensity(double intensity) { this.intensity = intensity; } public Storage getStorage() { return storage; } public void setStorage(Storage storage) { this.storage = storage; } public void setWithMooring(boolean withMooring) { this.withMooring = withMooring; } public boolean getWithMooring() { return withMooring; } public void setCargo(Cargo cargo) { this.cargo = cargo; } public Cargo getCargo() { return cargo; } public LoadingTemplate(TransportShip loader, Berth berth, Storage storage, double intensity, int id) { super(id, berth); this.loader = loader; this.storage = storage; this.resources = new ArrayList<>(); this.intensity = intensity; } public LoadingTemplate() { this.resources = new ArrayList<>(); } @Override public String toString() { String res = ""; boolean first = true; for(LoadingEquipment eq : resources) { if (!first) res += "," + eq.getId(); else res += eq.getId(); first = false; } int source = loader.getId(); if (intensity>0) source = storage.getId(); int target = loader.getId(); if (intensity<=0) target = storage.getId(); return getId() + ";" + "loa;" + twtoString() + ";" + source + ";" + cargo.getId() + ";" + target + ";" + getStartLocation().getId() + ";[" + res +"];" + Math.abs(intensity) + ";" + (withMooring ? "M" : "U"); } }