[1819] | 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 |
|
---|
| 15 | package de.ugoe.cs.autoquest.eventcore.gui;
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * <p>
|
---|
| 19 | * Event type for typing strings.
|
---|
| 20 | * </p>
|
---|
| 21 | *
|
---|
| 22 | * @version 1.0
|
---|
| 23 | * @author Florian Unger
|
---|
| 24 | */
|
---|
| 25 | public class CharacterTyped implements IInteraction {
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * <p>
|
---|
| 29 | * Id for object serialization.
|
---|
| 30 | * </p>
|
---|
| 31 | */
|
---|
| 32 | private static final long serialVersionUID = 1L;
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * <p>
|
---|
| 36 | * The string associated with the interaction.
|
---|
| 37 | * </p>
|
---|
| 38 | */
|
---|
| 39 | private String string;
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * <p>
|
---|
| 43 | * Constructor. Creates a new CharacterTyped.
|
---|
| 44 | * </p>
|
---|
| 45 | *
|
---|
| 46 | * @param string
|
---|
| 47 | * string associated with the interaction
|
---|
| 48 | */
|
---|
| 49 | public CharacterTyped(String string) {
|
---|
| 50 | this.string = string;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | @Override
|
---|
| 54 | public String getName() {
|
---|
| 55 | return "StringTyped: " + string;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | @Override
|
---|
| 59 | public boolean startsLogicalSequence() {
|
---|
[1868] | 60 | throw new UnsupportedOperationException("not implemented yet");
|
---|
[1819] | 61 | }
|
---|
| 62 |
|
---|
| 63 | @Override
|
---|
| 64 | public boolean finishesLogicalSequence() {
|
---|
[1868] | 65 | throw new UnsupportedOperationException("not implemented yet");
|
---|
[1819] | 66 | }
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | * (non-Javadoc)
|
---|
| 70 | *
|
---|
| 71 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 72 | */
|
---|
| 73 | @Override
|
---|
| 74 | public boolean equals(Object obj) {
|
---|
[1868] | 75 | if(obj == this){
|
---|
| 76 | return true;
|
---|
[1819] | 77 | }
|
---|
[1868] | 78 | if(!(obj instanceof CharacterTyped)){
|
---|
| 79 | return false;
|
---|
| 80 | }
|
---|
| 81 | CharacterTyped character = (CharacterTyped)obj;
|
---|
| 82 | return character.string.equals(string);
|
---|
| 83 |
|
---|
[1819] | 84 | }
|
---|
| 85 |
|
---|
| 86 | /*
|
---|
| 87 | * (non-Javadoc)
|
---|
| 88 | *
|
---|
| 89 | * @see java.lang.Object#hashCode()
|
---|
| 90 | */
|
---|
| 91 | @Override
|
---|
| 92 | public int hashCode() {
|
---|
| 93 | return getString().hashCode();
|
---|
| 94 | }
|
---|
[1868] | 95 |
|
---|
| 96 | /*
|
---|
| 97 | * (non-Javadoc)
|
---|
| 98 | *
|
---|
| 99 | * @see java.lang.Object#toString()
|
---|
| 100 | */
|
---|
| 101 | @Override
|
---|
| 102 | public String toString() {
|
---|
| 103 | return "StringTyped: " + string;
|
---|
| 104 | }
|
---|
[1819] | 105 |
|
---|
| 106 | /**
|
---|
| 107 | * <p>
|
---|
| 108 | * Returns the string associated with the interaction.
|
---|
| 109 | * </p>
|
---|
| 110 | *
|
---|
| 111 | * @return the string
|
---|
| 112 | */
|
---|
| 113 | public String getString() {
|
---|
| 114 | return string;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | }
|
---|