DialogQuery.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.mod_dialog.queries;
00002 
00003 import java.util.regex.Matcher;
00004 import java.util.regex.Pattern;
00005 
00006 import edu.tum.cs.ias.knowrob.mod_dialog.DialogModule;
00007 
00008 public abstract class DialogQuery {
00009         
00010         protected DialogModule dialog_module;
00011         protected Matcher matcher;
00012         
00013         public DialogQuery(DialogModule mod) {
00014                 this.dialog_module = mod;
00015         }
00016         
00017         public boolean haveState(String state) {
00018                 return dialog_module.getCurrentState().equals(state);
00019         }
00020         
00021         public boolean haveTopLevelState() {
00022                 return haveState(DialogModule.TOP_LEVEL_STATE);
00023         }
00024         
00025         public void setState(String state) {
00026                 dialog_module.setState(state);
00027         }
00028         
00029         public void setTopLevelState() {
00030                 dialog_module.setTopLevelState();
00031         }
00032         
00033         public abstract String process(String q) throws Exception;
00034         
00035         protected boolean match(String regex, String s) {
00036                 matcher = Pattern.compile(regex).matcher(s);
00037                 return matcher.matches();
00038         }
00039 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


mod_dialog
Author(s): Moritz Tenorth
autogenerated on Tue Apr 16 2013 00:38:25