/**
* @author Wolfgang Kowarschick <kowa@hs-augsburg.de>
* @copyright 2017 - 2018
* @license CC-BY-NC-SA-4.0
*/
import {ModelRectangle} from './ModelRectangle';
/**
* @class
* @extends ModelRectangle
* @property {string} type - the type of the token
* @property {Object[]} lines - the lines of the board that belong to the
* token (initialize by the board itself)
*
* @property {number} i - the x position of the token in the board
* @property {number} j - the y position of the token in the board
*
* @property {number} width - the width of the rectangle
* @property {number} height - the height of the rectangle
*/
class ModelToken extends ModelRectangle
{ /**
* @param {Object} [p_config]
* @param {string} [p_config.type = ''] - the type of the token
* @param {number} [p_config.i = 0] - the x position of the token in the board
* @param {number} [p_config.j = 0] - the y position of the token in the board
* @param {number} [p_config.width = 0]
* @param {number} [p_config.height = 0]
*/
constructor({ type: p_type = '',
i: p_i = 0, j: p_j = 0,
width: p_width = 0, height: p_height = 0
} = {}
)
{ super({width: p_width, height: p_height});
this.typeConfig = p_type;
this.iConfig = p_i;
this.jConfig = p_j;
this.reset();
}
reset()
{ super.reset();
this.type = this.typeConfig;
this.i = this.iConfig;
this.j = this.jConfig;
this.lines = [];
}
}
export {ModelToken};