Blame view

src/app/model/vessels.ts 482 Bytes
de59ffef8   lsagona   add model + search
1
2
  import {Vessel} from './vessel';
  import {Message} from './message';
287033a62   lsagona   add vessel positi...
3
  import { delay } from 'rxjs/operators';
de59ffef8   lsagona   add model + search
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  
  export class Vessels {
    vessels: Map<number, Vessel>;
  
    constructor() {
      this.vessels = new Map<number, Vessel>();
    }
  
    addMessage(message: Message): void {
      if (!this.vessels.get(Number(message.mmsi))) {
        this.vessels.set(Number(message.mmsi), new Vessel(new Array<Message>()));
      }
  
      this.vessels.get(Number(message.mmsi)).addMessage(message);
    }
  
  }