import P from "parsernostrum" import Grammar from "../serialization/Grammar.js" import IEntity from "./IEntity.js" import NumberEntity from "./NumberEntity.js" export default class Vector4DEntity extends IEntity { static attributes = { ...super.attributes, X: NumberEntity.withDefault(), Y: NumberEntity.withDefault(), Z: NumberEntity.withDefault(), W: NumberEntity.withDefault(), } static grammar = this.createGrammar() constructor(values) { super(values) /** @type {InstanceType} */ this.X /** @type {InstanceType} */ this.Y /** @type {InstanceType} */ this.Z /** @type {InstanceType} */ this.W } /** @returns {P} */ static createGrammar() { return Grammar.createEntityGrammar(this, Grammar.commaSeparation, 1).label("Vector4DEntity") } /** @returns {[Number, Number, Number, Number]} */ toArray() { return [this.X.valueOf(), this.Y.valueOf(), this.Z.valueOf(), this.W.valueOf()] } }