diff --git a/DoubleDeckerBus/MovementStrategy/MoveToBorder.java b/DoubleDeckerBus/MovementStrategy/MoveToBorder.java index edc39ab..0b407f4 100644 --- a/DoubleDeckerBus/MovementStrategy/MoveToBorder.java +++ b/DoubleDeckerBus/MovementStrategy/MoveToBorder.java @@ -3,7 +3,7 @@ package DoubleDeckerBus.MovementStrategy; public class MoveToBorder extends AbstractStrategy { @Override protected boolean IsTargetDestination() { - ObjectParameters objParams = GetObjectParameters(); + var objParams = GetObjectParameters(); if (objParams == null) { return false; @@ -14,20 +14,20 @@ public class MoveToBorder extends AbstractStrategy { } @Override protected void MoveToTarget() { - ObjectParameters objParams = GetObjectParameters(); + var objParams = GetObjectParameters(); if (objParams == null) { return; } - int diffX = objParams.RightBorder - FieldWidth(); + var diffX = objParams.RightBorder - FieldWidth(); if (Math.abs(diffX) >= GetStep()) { if (diffX < 0) { MoveRight(); } } - int diffY = objParams.DownBorder - FieldHeight(); + var diffY = objParams.DownBorder - FieldHeight(); if (Math.abs(diffY) >= GetStep()) { if (diffY < 0) { MoveDown(); diff --git a/DoubleDeckerBus/MovementStrategy/MoveToCenter.java b/DoubleDeckerBus/MovementStrategy/MoveToCenter.java index 0204492..d159018 100644 --- a/DoubleDeckerBus/MovementStrategy/MoveToCenter.java +++ b/DoubleDeckerBus/MovementStrategy/MoveToCenter.java @@ -3,16 +3,16 @@ package DoubleDeckerBus.MovementStrategy; public class MoveToCenter extends AbstractStrategy{ @Override protected boolean IsTargetDestination() { - ObjectParameters objParams = GetObjectParameters(); + var objParams = GetObjectParameters(); if (objParams == null) { return false; } return ((objParams.ObjectMiddleHorizontal <= FieldWidth() / 2 && - objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth() / 2) || - (objParams.ObjectMiddleHorizontal >= FieldWidth() / 2 && - objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth() / 2)) && + objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth() / 2) + ||(objParams.ObjectMiddleHorizontal >= FieldWidth() / 2 && + objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth() / 2)) && ((objParams.ObjectMiddleVertical <= FieldHeight() / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight() / 2) || @@ -22,13 +22,13 @@ public class MoveToCenter extends AbstractStrategy{ @Override protected void MoveToTarget() { - ObjectParameters objParams = GetObjectParameters(); + var objParams = GetObjectParameters(); if (objParams == null) { return; } - int diffX = objParams.ObjectMiddleHorizontal - FieldWidth() / 2; + var diffX = objParams.ObjectMiddleHorizontal - FieldWidth() / 2; if (Math.abs(diffX) > GetStep()) { if (diffX > 0) { MoveLeft(); @@ -37,7 +37,7 @@ public class MoveToCenter extends AbstractStrategy{ MoveRight(); } } - int diffY = objParams.ObjectMiddleVertical - FieldHeight() / 2; + var diffY = objParams.ObjectMiddleVertical - FieldHeight() / 2; if (Math.abs(diffY) > GetStep()) { if (diffY > 0) { MoveUp();