Commit 18ed93c1 authored by Lucas Fernandes de Oliveira's avatar Lucas Fernandes de Oliveira
Browse files

Issue #14: Convert Engine class to Singletion pattern


Signed-off-by: Lucas Fernandes de Oliveira's avatarLucas Fernandes de Oliveira <lfo14@inf.ufpr.br>
parent 89bc66a8
Pipeline #9855 passed with stage
in 2 minutes and 28 seconds
......@@ -27,7 +27,7 @@ import { View } from "./view";
import { engineScenario } from "../../test/scenario";
describe("engine class", () => {
const engine = new Engine();
const engine = Engine.getInstance();
const met = engineScenario.metrics;
const dim = engineScenario.dimensions;
......
......@@ -25,11 +25,21 @@ import { Query } from "../common/query";
import { RelationType } from "../common/types";
export class Engine {
private static instance: Engine;
private views: View[] = [];
private metrics: Metric[] = [];
private dimensions: Dimension[] = [];
constructor () { }
private constructor () { }
public static getInstance(): Engine {
if (this.instance == null) {
this.instance = new Engine();
}
return this.instance;
}
public getViews() {
return this.views;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment