Skip to content

Conversation

@eltgm
Copy link

@eltgm eltgm commented Nov 22, 2016

No description provided.

Copy link
Owner

@akrasenkov akrasenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не описан интерфейс и не реализован "Экран". Так всё тоже работает, но в задании была запрошена его реализация.

)
.getName() // Получить имя предмета
);*/
Item item ;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По гайдлайнам Java, пробел перед ; не ставится. Кроме того, здесь можно строки Item item ; и item = itemBox.emit(new Coordinates(1, 1)); объединить в одну (необязательно, но так лучше).

public static class Cola extends Item {
public Cola() {
super("Cola"); // Вызов конструктора класса-родителя (класса Item)
super("Cola",50); // Вызов конструктора класса-родителя (класса Item)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробельчик после запятой.

public static class Sprite extends Item {
public Sprite() {
super("Sprite");
super("Sprite",55);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробел после запятой.

Stack<Item> items = scheme.get(coordinates);
if(items.empty()){
return false;
}else{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробелы до и после else.

if(items.empty()){
return false;
}else{
return true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так тоже ничего, но в данном случае можно заменить ветвление на return !items.empty(); - "вернуть true если НЕ пусто".

public class Monitor implements AppScreen {

public void printText(String text){

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Много отступов.

item = itemBox.emit(new Coordinates(1, 1));
System.out.println("| Выдан товар: " + item.getName() +" по цене - " + item.getCost() + "|"); // OK
Item item = itemBox.emit(new Coordinates(1, 1));
monitor.printText("| Выдан товар: " + item.getName() +" по цене - " + item.getCost() +"|");// OK
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше вынести рамку в Monitor.

Stack<Item> sprites = new Stack<>(); // 2

//Создал монитор для вывода
Monitor monitor = new Monitor();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Абсолютно правильно. Можно также для нормализации сделать AppScreen monitor = new Monitor();. Надеюсь, суть такого финта прослеживается)

Copy link
Owner

@akrasenkov akrasenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рамки не перенесены в Monitor.

Copy link
Owner

@akrasenkov akrasenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рамки всё ещё не перенесены...

Copy link
Owner

@akrasenkov akrasenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants