Last change
on this file since 612 was
553,
checked in by sherbold, 12 years ago
|
- countless adaptations throughout nearly all components to remove errors introduced due to the refactoring of the event core
- added StringEventType? as a simple-to-use event type instead of DummyEventType?
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.9 KB
|
Rev | Line | |
---|
[548] | 1 | |
---|
[553] | 2 | package de.ugoe.cs.quest.eventcore; |
---|
[548] | 3 | |
---|
[553] | 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 | */ |
---|
[548] | 14 | public class StringEventType implements IEventType { |
---|
[553] | 15 | |
---|
| 16 | /** |
---|
| 17 | * <p> |
---|
| 18 | * Id for object serialization. |
---|
| 19 | * </p> |
---|
| 20 | */ |
---|
[548] | 21 | private static final long serialVersionUID = 1L; |
---|
| 22 | |
---|
[553] | 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 { |
---|
[548] | 41 | if (str == null) { |
---|
[553] | 42 | throw new InvalidParameterException("str must not be null"); |
---|
[548] | 43 | } |
---|
| 44 | this.str = str; |
---|
| 45 | } |
---|
| 46 | |
---|
[553] | 47 | /* |
---|
| 48 | * (non-Javadoc) |
---|
| 49 | * |
---|
| 50 | * @see de.ugoe.cs.quest.eventcore.IEventType#getName() |
---|
| 51 | */ |
---|
| 52 | @Override |
---|
[548] | 53 | public String getName() { |
---|
| 54 | return "StringEventType"; |
---|
| 55 | } |
---|
| 56 | |
---|
[553] | 57 | /* |
---|
| 58 | * (non-Javadoc) |
---|
| 59 | * |
---|
| 60 | * @see java.lang.Object#toString() |
---|
| 61 | */ |
---|
[548] | 62 | @Override |
---|
[553] | 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 | */ |
---|
| 82 | @Override |
---|
[548] | 83 | public boolean equals(Object other) { |
---|
| 84 | if (other == this) { |
---|
| 85 | return true; |
---|
| 86 | } |
---|
| 87 | if (other instanceof StringEventType) { |
---|
| 88 | return str.equals(((StringEventType) other).str); |
---|
| 89 | } |
---|
| 90 | return false; |
---|
| 91 | } |
---|
| 92 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.