/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.stat;

import lc.mecha.util.VelocityWatch;

import java.util.HashMap;

public final class Stat {
    private static final Stat stat = new Stat();
    private HashMap<String, VelocityWatch> watches = new HashMap<>();

    public static Stat getStat() {
        return stat;
    }

    public void event(String key, String evt) {
        VelocityWatch watch = watches.get(key);
        if (watch != null) watch.event(evt);
    }

    public void registerWatch(String key, VelocityWatch watch) {
        watches.put(key, watch);
    }

    public VelocityWatch getWatch(String key) {
        return watches.get(key);
    }
}