summaryrefslogtreecommitdiff
path: root/src/main/java/events/VSCopyableEvent.java
blob: 0b93f9e3fc424447d298e5b69c29b66c7acb7a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package events;

/**
 * Interface for events that support copying.
 * Events that implement this interface can be duplicated, which is useful
 * for creating multiple instances of the same event or for event scheduling.
 * 
 * <p>To make an event copyable:</p>
 * <ol>
 *   <li>Implement this interface</li>
 *   <li>Override initCopy() to copy all event-specific state</li>
 *   <li>The framework will handle creating the new instance</li>
 * </ol>
 * 
 * <p>Events that don't implement this interface will throw
 * {@link exceptions.VSEventNotCopyableException} when copy is attempted.</p>
 *
 * @see VSAbstractEvent#getCopy()
 * @see exceptions.VSEventNotCopyableException
 * @author Paul C. Buetow
 */
public interface VSCopyableEvent {
    /**
     * Initializes a copy of this event with all necessary state.
     * This method should copy all event-specific fields to the provided copy.
     * The copy will already be initialized with the same process and basic properties.
     *
     * @param copy the event instance to initialize with this event's state
     */
    public void initCopy(VSAbstractEvent copy);
}