Source code: org/alicebot/server/core/processor/Person2Processor.java
1 // Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov.
2 // Jad home page: http://www.geocities.com/kpdus/jad.html
3 // Decompiler options: packimports(3)
4
5 package org.alicebot.server.core.processor;
6
7 import java.util.HashMap;
8 import org.alicebot.server.core.Bot;
9 import org.alicebot.server.core.Bots;
10 import org.alicebot.server.core.parser.TemplateParser;
11 import org.alicebot.server.core.parser.XMLNode;
12 import org.alicebot.server.core.util.Substituter;
13
14 // Referenced classes of package org.alicebot.server.core.processor:
15 // AIMLProcessor, ProcessorException, AIMLProcessorException
16
17 public class Person2Processor extends AIMLProcessor
18 {
19
20 public Person2Processor()
21 {
22 }
23
24 public String process(int i, XMLNode xmlnode, TemplateParser templateparser)
25 throws AIMLProcessorException
26 {
27 if(xmlnode.XMLType == 0)
28 try
29 {
30 return templateparser.processResponse(applySubstitutions(templateparser.evaluate(i++, xmlnode.XMLChild), templateparser.getBotID()));
31 }
32 catch(ProcessorException processorexception)
33 {
34 throw (AIMLProcessorException)processorexception;
35 }
36 else
37 return templateparser.shortcutTag(i, "person2", 0, "", "star", 1);
38 }
39
40 public static String applySubstitutions(String s, String s1)
41 {
42 return Substituter.applySubstitutions(Bots.getBot(s1).getPerson2SubstitutionsMap(), s);
43 }
44
45 public static void addSubstitution(String s, String s1)
46 {
47 if(s != null && s1 != null)
48 substitutionMap.put(s.toUpperCase(), s1);
49 }
50
51 public static final String label = "person2";
52 private static HashMap substitutionMap = new HashMap();
53
54 }