[2153] | 1 | // Copyright 2015 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 | |
---|
| 15 | package de.ugoe.cs.autoquest.plugin.genericevents.eventCore; |
---|
| 16 | |
---|
| 17 | import de.ugoe.cs.autoquest.eventcore.AbstractDefaultHierarchicalEventTarget; |
---|
| 18 | import de.ugoe.cs.autoquest.eventcore.IEventTargetSpec; |
---|
| 19 | import de.ugoe.cs.autoquest.eventcore.IHierarchicalEventTarget; |
---|
| 20 | |
---|
| 21 | /** |
---|
| 22 | * <p> |
---|
| 23 | * TODO comment |
---|
| 24 | * </p> |
---|
| 25 | * |
---|
| 26 | * @author Patrick Harms |
---|
| 27 | */ |
---|
| 28 | public class GenericEventTarget extends AbstractDefaultHierarchicalEventTarget |
---|
| 29 | implements IHierarchicalEventTarget |
---|
| 30 | { |
---|
| 31 | |
---|
| 32 | /** */ |
---|
| 33 | private static final long serialVersionUID = 1L; |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * <p> |
---|
| 37 | * TODO: comment |
---|
| 38 | * </p> |
---|
| 39 | * |
---|
| 40 | * @param specification |
---|
| 41 | * @param parent |
---|
| 42 | */ |
---|
| 43 | public GenericEventTarget(GenericEventTargetSpec specification, GenericEventTarget parent) { |
---|
| 44 | super(specification, parent); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | /* (non-Javadoc) |
---|
| 48 | * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform() |
---|
| 49 | */ |
---|
| 50 | @Override |
---|
| 51 | public String getPlatform() { |
---|
| 52 | return "Generic Event"; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | /* (non-Javadoc) |
---|
| 56 | * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getStringIdentifier() |
---|
| 57 | */ |
---|
| 58 | @Override |
---|
| 59 | public String getStringIdentifier() { |
---|
| 60 | return ((GenericEventTargetSpec) super.getSpecification()).getId(); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | /* (non-Javadoc) |
---|
| 64 | * @see java.lang.Object#toString() |
---|
| 65 | */ |
---|
| 66 | @Override |
---|
| 67 | public String toString() { |
---|
| 68 | return super.getSpecification().toString(); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | /* (non-Javadoc) |
---|
| 72 | * @see IHierarchicalEventTarget#updateSpecification(IEventTargetSpec) |
---|
| 73 | */ |
---|
| 74 | @Override |
---|
| 75 | public void updateSpecification(IEventTargetSpec furtherSpec) { |
---|
| 76 | if (!(furtherSpec instanceof GenericEventTargetSpec)) { |
---|
| 77 | throw new IllegalArgumentException |
---|
| 78 | ("can only handle specifications of type GenericEventTargetSpec"); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | ((GenericEventTargetSpec) super.getSpecification()).mergeWith |
---|
| 82 | ((GenericEventTargetSpec) furtherSpec); |
---|
| 83 | } |
---|
| 84 | } |
---|