47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
|
package laba1Loco;
|
||
|
|
||
|
public class ObjectParameters {
|
||
|
private int _x;
|
||
|
private int _y;
|
||
|
private int _width;
|
||
|
private int _height;
|
||
|
/// <summary>
|
||
|
/// Левая граница
|
||
|
/// </summary>
|
||
|
public int LeftBorder() {return _x;}
|
||
|
/// <summary>
|
||
|
/// Верхняя граница
|
||
|
/// </summary>
|
||
|
public int TopBorder () {return _y;}
|
||
|
/// <summary>
|
||
|
/// Правая граница
|
||
|
/// </summary>
|
||
|
public int RightBorder () {return _x + _width;}
|
||
|
/// <summary>
|
||
|
/// Нижняя граница
|
||
|
/// </summary>
|
||
|
public int DownBorder () {return _y + _height;}
|
||
|
/// <summary>
|
||
|
/// Середина объекта
|
||
|
/// </summary>
|
||
|
public int ObjectMiddleHorizontal () {return _x + _width / 2;}
|
||
|
/// <summary>
|
||
|
/// Середина объекта
|
||
|
/// </summary>
|
||
|
public int ObjectMiddleVertical () {return _y + _height / 2;}
|
||
|
/// <summary>
|
||
|
/// Конструктор
|
||
|
/// </summary>
|
||
|
/// <param name="x">Координата X</param>
|
||
|
/// <param name="y">Координата Y</param>
|
||
|
/// <param name="width">Ширина</param>
|
||
|
/// <param name="height">Высота</param>
|
||
|
public ObjectParameters(int x, int y, int width, int height)
|
||
|
{
|
||
|
_x = x;
|
||
|
_y = y;
|
||
|
_width = width;
|
||
|
_height = height;
|
||
|
}
|
||
|
}
|