- Timestamp:
- 06/21/11 11:25:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/ReplayableEvent.java
r57 r79 6 6 import de.ugoe.cs.eventbench.IReplayDecorator; 7 7 8 /** 9 * <p> 10 * Subclass of {@link Event} for events that contain all informations required 11 * for replaying them, i.e., generating scripts that can used for automated 12 * software execution. 13 * </p> 14 * 15 * @author Steffen Herbold 16 * @version 1.0 17 * 18 * @param <T> 19 * Allows only types that extend {@link IReplayable} and is used to 20 * define a list of replayables that describe the replay of the 21 * event. 22 */ 8 23 public class ReplayableEvent<T extends IReplayable> extends Event<T> { 9 24 25 /** 26 * <p> 27 * List of {@link IReplayable}s of type T that describes the replay of an 28 * event. The {@link IReplayable}s can be interpreted as <it>sub-events</it> 29 * on the platform level that make up the abstract event. 30 * </p> 31 */ 10 32 private List<T> replayEvents = new LinkedList<T>();; 11 33 34 /** 35 * <p> 36 * Defines whether the replay is valid or invalid. It may be invalid, e.g., 37 * due to errors during the generation of the event or lack of vital 38 * information. 39 * </p> 40 */ 12 41 private boolean replayValid = true; 13 42 43 /** 44 * <p> 45 * {@link IReplayDecorator} used when replays of this type are written. 46 * </p> 47 */ 14 48 private IReplayDecorator decorator = null; 15 49 50 /** 51 * <p> 52 * Constructor. Creates a new event with the given type. 53 * <p> 54 * 55 * @param type 56 * type of the event 57 * @see Event#Event(String) 58 */ 16 59 public ReplayableEvent(String type) { 17 60 super(type); 18 61 } 19 62 63 /** 64 * <p> 65 * Adds a new {@link IReplayable} of type T to the replay sequence. 66 * </p> 67 * 68 * @param replayable 69 * element that is added to the sequence 70 */ 71 public void addReplayEvent(T replayable) { 72 replayEvents.add(replayable); 73 } 74 75 /** 76 * <p> 77 * Adds a {@link List}ist of {@link IReplayable} to the replay sequence. 78 * </p> 79 * 80 * @param generatedReplaySeq 81 * {@link List} that is added to the sequence 82 */ 20 83 public void addReplaySequence(List<T> generatedReplaySeq) { 21 84 replayEvents.addAll(generatedReplaySeq); 22 85 } 23 86 24 public void addReplayEvent(T replayable) { 25 replayEvents.add(replayable); 87 /** 88 * <p> 89 * Returns the {@link IReplayDecorator} of the event. 90 * </p> 91 * 92 * @return {@link IReplayDecorator} of the event; null if no decorator has 93 * been set 94 */ 95 public IReplayDecorator getReplayDecorator() { 96 return decorator; 26 97 } 27 98 28 99 /** 29 100 * <p> 30 101 * Returns a the list of replay events. 31 * </p> 102 * </p> 32 103 * <p> 33 104 * The return value is a copy of the list used internally! 34 105 * </p> 35 * @return list of replay events. 106 * 107 * @return list of replay events. 36 108 */ 37 109 public List<T> getReplayMessages() { 38 110 return new LinkedList<T>(replayEvents); 39 111 } 40 112 113 /** 114 * <p> 115 * Returns whether the replay is valid or not. 116 * </p> 117 * 118 * @return true, if replay is valid; false otherwise. 119 */ 41 120 public boolean hasValidReplay() { 42 121 return replayValid; 43 122 } 44 123 124 /** 125 * <p> 126 * Marks the replay as invalid. Once marked as invalid, it remains so and 127 * cannot be changed back to valid. 128 * </p> 129 */ 45 130 public void invalidateReplay() { 46 131 replayValid = false; 47 132 } 48 133 134 /** 135 * <p> 136 * Sets the {@link IReplayDecorator} associated with the event. 137 * </p> 138 * 139 * @param decorator 140 * decorator associated with the event 141 */ 49 142 public void setDecorator(IReplayDecorator decorator) { 50 143 this.decorator = decorator; 51 144 } 52 53 public IReplayDecorator getReplayDecorator() {54 return decorator;55 }56 145 57 146 }
Note: See TracChangeset
for help on using the changeset viewer.