All files / src/manager StopwatchDataManager.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 5/5
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                              5x           12x           16x 16x           12x           36x           1x
import Stopwatch from "../Stopwatch";
import StopwatchData from "../data/StopwatchData";
import Manager from "./Manager";
 
/**
 * Data manager
 * @description
 * 
 */
class StopwatchDataManager implements Manager<Stopwatch, StopwatchData> {
 
	map: Map<Stopwatch, StopwatchData>;
 
	constructor(){
 
		this.map = new Map<Stopwatch, StopwatchData>();
 
	}
 
	get( stopwatch: Stopwatch ): StopwatchData {
 
		return this.map.get( stopwatch );
 
	}
 
	put( stopwatch: Stopwatch, data: StopwatchData ): StopwatchDataManager {
 
		this.map.set( stopwatch, data );
		return this;
 
	}
 
	remove( stopwatch: Stopwatch ): boolean {
 
		return this.map.delete( stopwatch );
 
	}
 
	size(): number {
 
		return this.map.size;
 
	}
 
}
 
export default StopwatchDataManager;