/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inport; import java.util.OptionalInt; /** * * @author topazh_ag */ public class Tow extends MovingObject { public Tow(int id, String name) { super(id, name); } public Tow() { } @Override public String toString() { String res = getId() + "; " + getName() + "; 1000000"; if (getType().isPresent()) { res += "; " + getType().getAsInt(); } return res; } public Tow(String s) { super(s); String[] tokens = s.split(";"); if (tokens.length >= 4) { setType(OptionalInt.of(Integer.parseInt(tokens[3].trim()))); } } }