[1113] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.treeimpl;
|
---|
[439] | 16 |
|
---|
[922] | 17 | import de.ugoe.cs.autoquest.eventcore.IEventTarget;
|
---|
| 18 | import de.ugoe.cs.autoquest.eventcore.IEventType;
|
---|
| 19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask;
|
---|
[1157] | 20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; |
---|
[439] | 21 |
|
---|
| 22 | /**
|
---|
[1215] | 23 | * <p> |
---|
| 24 | * this is the default implementation of the interface {@link IEventTask}. It does not do anything |
---|
| 25 | * fancy except implementing the interface. |
---|
| 26 | * </p> |
---|
| 27 | * |
---|
| 28 | * @author Patrick Harms
|
---|
[439] | 29 | */
|
---|
[1146] | 30 | class EventTask extends Task implements IEventTask {
|
---|
[557] | 31 |
|
---|
[1215] | 32 | /** |
---|
| 33 | * <p> |
---|
| 34 | * default serial version UID |
---|
| 35 | * </p> |
---|
| 36 | */ |
---|
[1146] | 37 | private static final long serialVersionUID = 1L; |
---|
| 38 | |
---|
[1215] | 39 | /** |
---|
| 40 | * <p> |
---|
| 41 | * the type of the represented event |
---|
| 42 | * </p> |
---|
| 43 | */
|
---|
[557] | 44 | private IEventType eventType;
|
---|
[439] | 45 |
|
---|
[1215] | 46 | /** |
---|
| 47 | * <p> |
---|
| 48 | * the target of the represented event |
---|
| 49 | * </p> |
---|
| 50 | */ |
---|
[557] | 51 | private IEventTarget eventTarget;
|
---|
[439] | 52 |
|
---|
[557] | 53 | /**
|
---|
[1215] | 54 | * <p> |
---|
| 55 | * simple constructor initializing this task with an event type and an event target |
---|
| 56 | * </p> |
---|
| 57 | * |
---|
| 58 | * @param eventType the type of the represented event
|
---|
| 59 | * @param eventTarget the target of the represented event
|
---|
[557] | 60 | */
|
---|
| 61 | EventTask(IEventType eventType, IEventTarget eventTarget) {
|
---|
[1255] | 62 | super.setDescription(eventType.toString() + " \u21D2 " + eventTarget);
|
---|
[557] | 63 | this.eventType = eventType;
|
---|
| 64 | this.eventTarget = eventTarget;
|
---|
| 65 | }
|
---|
[439] | 66 |
|
---|
[1215] | 67 | /* (non-Javadoc) |
---|
| 68 | * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask#getEventType() |
---|
| 69 | */ |
---|
| 70 | @Override |
---|
[557] | 71 | public IEventType getEventType() {
|
---|
| 72 | return eventType;
|
---|
| 73 | }
|
---|
[439] | 74 |
|
---|
[1215] | 75 | /* (non-Javadoc) |
---|
| 76 | * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask#getEventTarget() |
---|
| 77 | */ |
---|
| 78 | @Override |
---|
[557] | 79 | public IEventTarget getEventTarget() {
|
---|
| 80 | return eventTarget;
|
---|
[439] | 81 | }
|
---|
[557] | 82 |
|
---|
[1215] | 83 | /* (non-Javadoc) |
---|
| 84 | * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.Task#clone() |
---|
| 85 | */ |
---|
[557] | 86 | @Override
|
---|
| 87 | public EventTask clone() {
|
---|
| 88 | // Event type and target are unchangeable and do not need to be cloned
|
---|
| 89 | return (EventTask) super.clone();
|
---|
[1157] | 90 | } |
---|
| 91 | |
---|
| 92 | /* (non-Javadoc) |
---|
[1215] | 93 | * @see de.ugoe.cs.autoquest.tasktrees.treeimpl.Task#accept(ITaskVisitor) |
---|
[1157] | 94 | */ |
---|
| 95 | @Override |
---|
| 96 | public void accept(ITaskVisitor visitor) { |
---|
| 97 | visitor.visit(this); |
---|
[557] | 98 | }
|
---|
[439] | 99 |
|
---|
| 100 | }
|
---|