From 43fbfdfd688914b2c085d471886ce2f157f72f3c Mon Sep 17 00:00:00 2001 From: Vlad_kv Date: Thu, 8 Aug 2019 16:06:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D0=B0=D0=BD=D0=BD=D0=BE=D1=82=D0=B0=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=D1=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/inport/Operation.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/inport/Operation.java b/src/inport/Operation.java index ac0feb1..820bc7f 100644 --- a/src/inport/Operation.java +++ b/src/inport/Operation.java @@ -118,12 +118,12 @@ public class Operation { } private static String getTransportName(MovingObject obj) { - if (obj instanceof TransportShip) { - return "судно " + obj.getId(); - } if (obj instanceof Bunker) { return "бункеровщик " + obj.getId(); } + if (obj instanceof TransportShip) { + return "судно " + obj.getId(); + } if (obj instanceof Tow) { return "буксир " + obj.getId(); } @@ -131,7 +131,7 @@ public class Operation { } private static String getShortTransportName(MovingObject obj) { - if ((obj instanceof TransportShip) || (obj instanceof Bunker) || (obj instanceof Tow)) { + if ((obj instanceof TransportShip) || (obj instanceof Tow)) { return Integer.toString(obj.getId()); } return (obj.getName().isEmpty()) ? Integer.toString(obj.getId()) : obj.getName(); @@ -290,9 +290,13 @@ public class Operation { { String[] items = rStr.substring(0, rStr.indexOf('[')).split(" "); - MovingObject ex = m_vessel.get(Integer.valueOf(items[0].trim())); - if (ex == null) { - ex = m_bunker.get(Integer.valueOf(items[0].trim())); + int id = Integer.valueOf(items[0].trim()); + MovingObject ex; + + if (m_bunker.containsKey(id)) { + ex = m_bunker.get(id); + } else { + ex = m_vessel.get(id); } setExecutor(ex); if (items.length > 1) { -- GitLab