settings.component.ts 1.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Component, OnInit } from '@angular/core';
import {CacheService} from '../cache.service';

@Component({
  selector: 'app-settings',
  templateUrl: './settings.component.html',
  styleUrls: ['./settings.component.css']
})
export class SettingsComponent implements OnInit {
  private _windowSize;
  private _hashSize;
  private _nrOfTables;

  constructor(private service: CacheService) { }

  ngOnInit(): void {
    this._windowSize = this.service.windowSize;
    this._hashSize = this.service.hashSize;
    this._nrOfTables = this.service.nrOfTables;
  }

  public reset() {
23
24
25
    this.service.windowSize = Number(this._windowSize);
    this.service.hashSize = Number(this._hashSize);
    this.service.nrOfTables = Number(this._nrOfTables);
26
27
28
29
    this.service.reset();
  }

  public newTables() {
30
31
    this.service.hashSize = Number(this._hashSize);
    this.service.nrOfTables = Number(this._nrOfTables);
Kruyff,D.L.W. (Dylan)'s avatar
Kruyff,D.L.W. (Dylan) committed
32
    this.service.initial();
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  }

  public get windowSize() {
    return this._windowSize;
  }

  public set windowSize(v) {
    this._windowSize = v;
  }

  public get hashSize() {
    return this._hashSize;
  }

  public set hashSize(v) {
    this._hashSize = v;
  }

  public get nrOfTables() {
    return this._nrOfTables;
  }

  public set nrOfTables(v) {
    this._nrOfTables = v;
  }

}