package de.ugoe.cs.eventbensch.jfc.data; import java.util.HashMap; import java.util.Map; import de.ugoe.cs.eventbench.data.IReplayable; import de.ugoe.cs.eventbench.data.ReplayableEvent; /** *

* This class defines JFC events. *

* * @author Steffen Herbold * @version 1.0 */ public class JFCEvent extends ReplayableEvent { /** *

* Id for object serialization. *

*/ private static final long serialVersionUID = 1L; /** *

* Internal map of parameters associated with the event. *

*/ private Map parameters; /** *

* Information about the event source. *

*/ private Map sourceParameters; /** *

* Information about the parent of the event source. *

*/ private Map parentParameters; /** *

* Constructor. Creates a new JFCEvent. *

* * @param type * type of the event */ public JFCEvent(String type) { super(type); parameters = new HashMap(); } /** *

* Adds a new parameter to the event. *

* * @param name * name of the parameter * @param value * value of the parameter */ public void addParameter(String name, String value) { parameters.put(name, value); } /** *

* Retrieves the value of a parameter. *

* * @param name * name of the parameter * @return value of the parameter */ public String getParameter(String name) { return parameters.get(name); } /** *

* Adds new information about the source of the event. *

* * @param name * name of the information * @param value * value of the information */ public void addSourceInformation(String name, String value) { sourceParameters.put(name, value); } /** *

* Retrieves information about the source of the event. *

* * @param name * name of the information * @return value of the information */ public String getSourceInformation(String name) { return sourceParameters.get(name); } /** *

* Adds new information about the parent of the source of the event. *

* * @param name * name of the information * @param value * value of the information */ public void addParentInformation(String name, String value) { parentParameters.put(name, value); } /** *

* Retrieves information about the parent of the source of the event. *

* * @param name * name of the information * @return value of the information */ public String getParentInformation(String name) { return parentParameters.get(name); } /* * (non-Javadoc) * * @see de.ugoe.cs.eventbench.data.ReplayableEvent#equals(java.lang.Object) */ @Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof JFCEvent) { return super.equals(other) && parameters.equals(((JFCEvent) other).parameters); } return false; } /* * (non-Javadoc) * * @see de.ugoe.cs.eventbench.data.ReplayableEvent#hashCode() */ @Override public int hashCode() { int hashCode = super.hashCode(); hashCode *= parameters.hashCode(); return hashCode; } }