Changeset 553 for trunk/quest-core-events
- Timestamp:
- 08/16/12 16:08:48 (12 years ago)
- Location:
- trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/Event.java
r551 r553 30 30 * </p> 31 31 */ 32 public static final Event STARTEVENT = new Event(new DummyEventType());32 public static final Event STARTEVENT = new Event(new StringEventType("START")); 33 33 34 34 /** … … 36 36 * Global end event that can be used to indicate the end of a sequence. 37 37 */ 38 public static final Event ENDEVENT = new Event(new DummyEventType());38 public static final Event ENDEVENT = new Event(new StringEventType("END")); 39 39 40 40 /** … … 160 160 */ 161 161 public String getId() { 162 return "(" + type.toString() + ";" + target.toString() + ")"; 162 String id = type.toString(); 163 if( target!=null ) { 164 id += "." + target.toString(); 165 } 166 return id; 163 167 } 164 168 -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/StringEventType.java
r549 r553 1 package de.ugoe.cs.quest.usageprofiles.mock;2 1 3 import de.ugoe.cs.quest.eventcore.IEventType;2 package de.ugoe.cs.quest.eventcore; 4 3 4 import java.security.InvalidParameterException; 5 6 /** 7 * <p> 8 * A simple event type that is identified by a string. 9 * </p> 10 * 11 * @version $Revision: $ $Date: Aug 16, 2012$ 12 * @author 2012, last modified by $Author: sherbold$ 13 */ 5 14 public class StringEventType implements IEventType { 6 /** */ 15 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 7 21 private static final long serialVersionUID = 1L; 8 String str;9 22 10 public StringEventType(String str) { 23 /** 24 * <p> 25 * String that identifies the event type. 26 * </p> 27 */ 28 private String str; 29 30 /** 31 * <p> 32 * Constructor. Creates a new StringEventType. str must not be null. 33 * </p> 34 * 35 * @param str 36 * string that identifies the event type 37 * @throws InvalidParameterException 38 * thrown if str is null 39 */ 40 public StringEventType(String str) throws InvalidParameterException { 11 41 if (str == null) { 12 throw new AssertionError( 13 "illegal use of mock StringEventType: str must nut be null"); 42 throw new InvalidParameterException("str must not be null"); 14 43 } 15 44 this.str = str; 16 45 } 17 46 47 /* 48 * (non-Javadoc) 49 * 50 * @see de.ugoe.cs.quest.eventcore.IEventType#getName() 51 */ 52 @Override 18 53 public String getName() { 19 54 return "StringEventType"; 20 55 } 21 56 57 /* 58 * (non-Javadoc) 59 * 60 * @see java.lang.Object#toString() 61 */ 62 @Override 63 public String toString() { 64 return str; 65 } 66 67 /* 68 * (non-Javadoc) 69 * 70 * @see java.lang.Object#hashCode() 71 */ 72 @Override 73 public int hashCode() { 74 return str.hashCode(); 75 } 76 77 /* 78 * (non-Javadoc) 79 * 80 * @see java.lang.Object#equals(java.lang.Object) 81 */ 22 82 @Override 23 83 public boolean equals(Object other) {
Note: See TracChangeset
for help on using the changeset viewer.