47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
|
package Trolleybus;
|
||
|
|
||
|
// Параметры-координаты объекта
|
||
|
public class ObjectParameters {
|
||
|
private final int _x;
|
||
|
private final int _y;
|
||
|
private final int _width;
|
||
|
private final int _height;
|
||
|
public int LeftBorder() {return _x;}
|
||
|
public int TopBorder() {return _y;}
|
||
|
public int RightBorder() {return _x + _width;}
|
||
|
public int DownBorder() {return _y + _height;}
|
||
|
public int ObjectMiddleHorizontal() { return _x + _width / 2;}
|
||
|
public int ObjectMiddleVertical() {return _y + _height / 2;}
|
||
|
public int getLeftBorder() {
|
||
|
return _x;
|
||
|
}
|
||
|
|
||
|
public int getTopBorder() {
|
||
|
return _y;
|
||
|
}
|
||
|
|
||
|
public int getRightBorder() {
|
||
|
return _x + _width;
|
||
|
}
|
||
|
|
||
|
public int getDownBorder() {
|
||
|
return _y + _height;
|
||
|
}
|
||
|
|
||
|
public int getObjectMiddleHorizontal() {
|
||
|
return _x + _width / 2;
|
||
|
}
|
||
|
|
||
|
public int getObjectMiddleVertical() {
|
||
|
return _y + _height / 2;
|
||
|
}
|
||
|
// Конструктор
|
||
|
public ObjectParameters(int x, int y, int width, int height)
|
||
|
{
|
||
|
_x = x;
|
||
|
_y = y;
|
||
|
_width = width;
|
||
|
_height = height;
|
||
|
}
|
||
|
}
|