package org.musetest.core;

import org.musetest.core.events.*;
import org.musetest.core.resource.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
public class MuseEvent
    {
    public MuseEvent(EventType type)
        {
        _type = null;
        _type_id = type.getTypeId();
        }

    public EventType getType()
        {
        if (_type != null)
            return _type;
        else
	        return EventTypes.DEFAULT.findType(_type_id);
        }

    public String getTypeId()
	    {
	    if (_type != null)
	    	return _type.getName();
	    else
	    	return _type_id;
	    }

    public String getDescription()
        {
        return _type.getName();
        }

    public long getTimestampNanos()
        {
        return _timestamp_nanos;
        }

    private transient final EventType _type;
    protected String _type_id = null;
    protected long _timestamp_nanos = System.nanoTime();

    private final static DefaultClassLocator DEFAULT_LOCATOR = new DefaultClassLocator();
    }



@@ -311,32 +311,369 @@
 d();%0A        %7D%0A%0A
+    /**%0A     * This is a convenience method only. Use getTypeId() and EventTypes.findType() to lookup the EventType.%0A     *%0A     * This method will work as expected if the event was created within this JVM session. It will not work for%0A     * event types defined in extensions after de-serializing a saved event.%0A     */%0A    @Deprecated%0A
     public Event
@@ -772,22 +772,34 @@
         
-return
+%7B%0A%09        _type =
  EventTy
@@ -829,16 +829,104 @@
 ype_id);
+  // this is a hack without a reference to the project%0A%09        return _type;%0A%09        %7D
 %0A       
@@ -1117,29 +1117,33 @@
      return 
-_t
+getT
 ype
+()
 .getName();%0A
@@ -1265,22 +1265,16 @@
 ansient 
-final 
 EventTyp

fix NPE