54 lines
1.0 KiB
TypeScript
54 lines
1.0 KiB
TypeScript
import { Plane } from './plane.class';
|
|
|
|
export class Reader {
|
|
|
|
id:number;
|
|
reader_id:string;
|
|
plane:Plane;
|
|
|
|
constructor(id: number,
|
|
reader_id: string,
|
|
plane:Plane) {
|
|
|
|
this.id = id;
|
|
this.reader_id = reader_id;
|
|
this.plane = plane;
|
|
}
|
|
|
|
public equals(other:Reader): 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 toReader(r:any): Reader{
|
|
|
|
let plane:Plane = null;
|
|
|
|
if(r.PLANE != null)
|
|
plane = Plane.toPlane(r.PLANE);
|
|
|
|
let reader = new Reader(r.ID, r.READER_ID, plane)
|
|
|
|
//console.log('Parsed reader:', reader);
|
|
return reader;
|
|
}
|
|
}
|