Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/alicebot/server/core/loader/AIMLLoader.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.loader;
6   
7   import org.alicebot.server.core.*;
8   import org.alicebot.server.core.logging.Log;
9   import org.alicebot.server.core.node.Nodemapper;
10  import org.alicebot.server.core.parser.AIMLReaderListener;
11  import org.alicebot.server.core.util.Trace;
12  
13  public class AIMLLoader
14      implements AIMLReaderListener
15  {
16  
17      public AIMLLoader(String s, String s1)
18      {
19          filename = s;
20          botid = s1;
21          if(s1 != null)
22              bot = Bots.getBot(s1);
23          policy = Globals.getMergePolicy();
24      }
25  
26      public void newCategory(String s, String s1, String s2, String s3)
27      {
28          boolean flag = true;
29          if(s == null)
30              s = "*";
31          if(s1 == null)
32              s1 = "*";
33          if(s2 == null)
34              s2 = "*";
35          if(s3 == null)
36              s3 = "*";
37          if(SHOW_CONSOLE && Graphmaster.getTotalCategories() % NOTIFY_INTERVAL == 0 && Graphmaster.getTotalCategories() > 0)
38              Trace.userinfo(Graphmaster.getTotalCategories() + " categories loaded so far.");
39          if(flag)
40          {
41              Nodemapper nodemapper = Graphmaster.add(s, s1, s2, botid);
42              if(nodemapper.get("<template>") == null)
43              {
44                  nodemapper.put("<filename>", filename);
45                  bot.addToFilenameMap(filename, nodemapper);
46                  nodemapper.put("<template>", s3);
47                  Graphmaster.incrementTotalCategories();
48              } else
49              if(!policy.equals("true"))
50              {
51                  if(Globals.showConsole())
52                      Log.userinfo(new String[] {
53                          "Duplicate category:", s + " : " + s1 + " : " + s2, " in \"" + filename + "\"", "conflicts with category already loaded from", (String)nodemapper.get("<filename>")
54                      }, Log.MERGE);
55              } else
56              {
57                  nodemapper.put("<filename>", filename);
58                  nodemapper.put("<template>", s3);
59              }
60          }
61      }
62  
63      private static int NOTIFY_INTERVAL = Globals.getCategoryLoadNotifyInterval();
64      protected static final boolean SHOW_CONSOLE = Globals.showConsole();
65      private static String filename;
66      private static String botid;
67      private static Bot bot;
68      private static String policy;
69      private static final String SPACE = " ";
70      private static final String EMPTY_STRING = "";
71      private static final String ATOMIC_CLOSE = "/>";
72      private static final String SLASH = "/";
73      private static final String NAME = "name";
74      private static final String LOCALHOST = "localhost";
75  
76  }