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

Quick Search    Search Deep

Source code: org/alicebot/server/core/processor/loadtime/PredicateProcessor.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.loadtime;
6   
7   import org.alicebot.server.core.Bot;
8   import org.alicebot.server.core.parser.StartupFileParser;
9   import org.alicebot.server.core.parser.XMLNode;
10  import org.alicebot.server.core.util.Toolkit;
11  
12  // Referenced classes of package org.alicebot.server.core.processor.loadtime:
13  //            StartupElementProcessor, InvalidStartupElementException
14  
15  public class PredicateProcessor extends StartupElementProcessor
16  {
17  
18      public PredicateProcessor()
19      {
20      }
21  
22      public String process(int i, XMLNode xmlnode, StartupFileParser startupfileparser)
23          throws InvalidStartupElementException
24      {
25          if(xmlnode.XMLType == 1)
26          {
27              String s = Toolkit.getAttributeValue("name", xmlnode.XMLAttr);
28              if(s.equals(""))
29                  throw new InvalidStartupElementException("<predicate/> must specify a name!");
30              String s1 = Toolkit.getAttributeValue("default", xmlnode.XMLAttr);
31              if(s1.equals(""))
32                  s1 = null;
33              String s2 = Toolkit.getAttributeValue("set-return", xmlnode.XMLAttr);
34              boolean flag;
35              if(s2.equals("name"))
36                  flag = true;
37              else
38              if(s2.equals("value"))
39                  flag = false;
40              else
41                  throw new InvalidStartupElementException("Invalid value for set-return attribute on <predicate/>.");
42              startupfileparser.getCurrentBot().addPredicateInfo(s, s1, flag);
43              return "";
44          } else
45          {
46              throw new InvalidStartupElementException("<predicate/> cannot have element content!");
47          }
48      }
49  
50      public static final String label = "predicate";
51      private static final String NAME = "name";
52      private static final String DEFAULT = "default";
53      private static final String SET_RETURN = "set-return";
54      private static final String VALUE = "value";
55  }