/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inport; import java.util.List; /** * * @author topazh_ag */ public class Operation { private OperationTemplate template; private double start; private double duration; private MovingObject executor; private List resources; public List getResources() { return resources; } public void setResources(List resources) { this.resources = resources; } public MovingObject getExecutor() { return executor; } public void setExecutor(MovingObject executor) { this.executor = executor; } /** * Get the value of duration * * @return the value of duration */ public double getDuration() { return duration; } /** * Set the value of duration * * @param duration new value of duration */ public void setDuration(double duration) { this.duration = duration; } /** * Get the value of start * * @return the value of start */ public double getStart() { return start; } /** * Set the value of start * * @param start new value of start */ public void setStart(double start) { this.start = start; } /** * Get the value of template * * @return the value of template */ public OperationTemplate getTemplate() { return template; } /** * Set the value of template * * @param template new value of template */ public void setTemplate(OperationTemplate template) { this.template = template; } public Operation() { } @Override public String toString() { if (executor == null) { executor = ConversionUtil.getExecutor(template); } if (resources == null) { resources = ConversionUtil.getResources(template); } StringBuilder sb = new StringBuilder(); sb.append(template.getId()).append("; R; ").append(start).append("; ").append(duration); sb.append(" (").append(executor.getId()).append(" ["); boolean isFirst = true; for (MovingObject obj : resources) { if (isFirst) { isFirst = false; } else { sb.append(", "); } sb.append(obj.getId()); } sb.append("])"); return sb.toString(); } }