/*
 * Created on Apr 4, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.jscape.inet.telnet;

import java.util.Hashtable;

/**
 * Factory class for maintaining TelnetDataReceivedEvent in memory.
 */
public class TelnetDataReceivedFactory {

    private static Hashtable factory = new Hashtable();

    /**
     * Private constructor to prevent instantiation.
     */
    private TelnetDataReceivedFactory() {
    }

    /**
     * Gets a TelnetDataReceivedEvent from the factory.
     *
     * @param source the source of this event
     * @param data   the data received
     *
     * @return a TelnetDataReceivedEvent
     */
    public static TelnetDataReceivedEvent getDataReceivedEvent(Object source, String data) {
        Object obj = factory.get(data);
        if (obj == null) {
            obj = new TelnetDataReceivedEvent(source, data);
            factory.put(data, obj);
        }
        return (TelnetDataReceivedEvent) obj;
    }
}
