001package org.intellimate.izou.events;
002
003import org.intellimate.izou.identification.Identifiable;
004import org.intellimate.izou.identification.Identification;
005import org.intellimate.izou.resource.ListResourceProvider;
006import org.intellimate.izou.resource.ResourceModel;
007
008import java.util.List;
009
010/**
011 * This class represents an Event, the main communication form for the AddOns.
012 * @author Leander Kurscheidt
013 * @version 1.0
014 */
015public interface EventModel<X extends EventModel> extends Identifiable {
016    /**
017     * The type of the Event.
018     * It describes the Type of the Event.
019     * @return A String containing an ID
020     */
021    String getType();
022
023    /**
024     * Returns the source of the event, e.g. the object who fired it.
025     *
026     * @return an identifiable
027     */
028    Identification getSource();
029
030    /**
031     * Returns all the resources the event currently has
032     *
033     * @return an instance of ListResourceContainer
034     */
035    ListResourceProvider getListResourceContainer();
036
037    /**
038     * adds a resource to the container
039     * @param resource an instance of the resource to add
040     * @return the resulting Event (which is the same instance)
041     */
042    X addResource(ResourceModel resource);
043
044    /**
045     * adds a list of resources to the container
046     * @param resources a list containing all the resources
047     * @return the resulting Event (which is the same instance)
048     */
049    X addResources(List<ResourceModel> resources);
050
051    /**
052     * returns a list containing all the descriptors.
053     * @return a list containing the descriptors
054     */
055    List<String> getDescriptors();
056
057    /**
058     * returns a List containing all the Descriptors and the type.
059     * @return a List containing the Descriptors
060     */
061    List<String> getAllInformations();
062
063    /**
064     * returns whether the event contains the specific descriptor.
065     * this method also checks whether it matches the type.
066     * @param descriptor a string with the ID of the descriptor
067     * @return boolean when the event contains the descriptor, false when not.
068     */
069    boolean containsDescriptor(String descriptor);
070
071    /**
072     * returns the associated EventBehaviourController
073     * @return an instance of EventBehaviourController
074     */
075    EventBehaviourControllerModel getEventBehaviourController();
076
077    /**
078     * this method gets called when the different lifecycle-stages got reached.
079     * It is not blocking!
080     * @param eventLifeCycle the lifecycle reached.
081     */
082    void lifecycleCallback(EventLifeCycle eventLifeCycle);
083}