53 lines
1.0 KiB
TypeScript
53 lines
1.0 KiB
TypeScript
export class Plane {
|
|
|
|
id:number;
|
|
name:string;
|
|
registration:string;
|
|
model:string;
|
|
comment:string;
|
|
|
|
constructor(id: number,
|
|
name: string,
|
|
registration:string,
|
|
model:string,
|
|
comment:string) {
|
|
|
|
this.id = id;
|
|
this.name = name;
|
|
this.registration = registration;
|
|
this.model = model;
|
|
this.comment = comment;
|
|
}
|
|
|
|
public equals(other:Plane): boolean
|
|
{
|
|
if(other)
|
|
{
|
|
var keySet1 = Object.keys(this);
|
|
var keySet2 = Object.keys(other);
|
|
|
|
var j = 0;
|
|
var isTheSame = true;
|
|
|
|
for(j; j < keySet1.length; j++) {
|
|
if (this[keySet1[j]] !== other[keySet2[j]]) {
|
|
// Shit is not the same
|
|
isTheSame = false;
|
|
}
|
|
}
|
|
|
|
return isTheSame;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static toPlane(r:any): Plane{
|
|
|
|
let plane = new Plane(r.ID, r.NAME, r.REGISTRATION, r.MODEL, r.COMMENT);
|
|
|
|
//console.log('Parsed plane:', plane);
|
|
return plane;
|
|
}
|
|
}
|