01: // license-header java merge-point
02: /**
03: * This is only generated once! It will never be overwritten.
04: * You can (and have to!) safely modify it by hand.
05: */package org.andromda.samples.animalquiz.decisiontree;
06:
07: /**
08: * @see org.andromda.samples.animalquiz.decisiontree.Animal
09: */
10: public class AnimalImpl extends
11: org.andromda.samples.animalquiz.decisiontree.Animal {
12: /**
13: * The serial version UID of this class. Needed for serialization.
14: */
15: private static final long serialVersionUID = -99977346143369122L;
16:
17: /**
18: * @see org.andromda.samples.animalquiz.decisiontree.Animal#getPrompt()
19: */
20: public java.lang.String getPrompt() {
21: return "Is it " + formatAnimalWithPredicate(getName()) + " ?";
22: }
23:
24: private String formatAnimalWithPredicate(String name) {
25: final StringBuffer formattedBuffer = new StringBuffer();
26:
27: formattedBuffer.append("a ");
28: formattedBuffer.append(name);
29:
30: char firstChar = name.charAt(0);
31: switch (firstChar) {
32: case 'a': // fall-through
33: case 'e': // fall-through
34: case 'i': // fall-through
35: case 'o':
36: formattedBuffer.insert(1, 'n');
37: break;
38: default:
39: }
40:
41: return formattedBuffer.toString();
42: }
43:
44: }
|