Package org.speakright.sro

Source Code of org.speakright.sro.SROConfirmYesNo

package org.speakright.sro;
import org.speakright.core.IConfirmationFlow;
import org.speakright.core.IConfirmationNotifier;
import org.speakright.core.IExecutionContext;
import org.speakright.core.IFlow;
import org.speakright.core.SRResults;
import org.speakright.core.SRUtils;
import org.speakright.core.flows.YesNoConfirmerFlow;
import org.speakright.sro.gen.*;

/**
* SRO for doing simple yes/no confirmation.  This confirmer can be used
* with any SRO by passing an instance of SROConfirmYesNo to the SRO's
* setConfirmer method.
*
* This confirmer does explicit confirmation, accepting yes or no as the
* answer. eg. "Do you want Boston?"  If the user answers no then a confirm-rejection
* occurs and the SRO asks its question again.
*
* Features
* <ul>
* <li>a confirmation threshold at which the confirmer should execute.  If the user input
* has a confirmation above this threshold, the confirmer does not do anything. So
* setting confirmation threshold to 100 means confirmation will always be done,
* 0 means it will never be done.</li>
* </ul>
* @author IanRaeLaptop
*
*/
@SuppressWarnings("serial")
public class SROConfirmYesNo extends genSROConfirmYesNo  implements IConfirmationFlow {
  YesNoConfirmerFlow m_confirmer;

  public SROConfirmYesNo(String subject)
  {
    super(subject);
    m_confirmer = new YesNoConfirmerFlow("notused.gsl");
  }
 
  public int confirmThreshold()
  {
    return m_confirmer.getConfirmationThreshold();
  }
  public void setConfirmThreshold(int threshold)
  {
    m_confirmer.setConfirmationThreshold(threshold);
  }
 
  public void setNotifier(IConfirmationNotifier notifier)
  {
    m_confirmer.setNotifier(notifier);
  }
 
 
  public boolean needToExecute(IFlow current, SRResults results) {
    return m_confirmer.needToExecute(current, results);
  }

  @Override
  public IFlow getNext(IFlow current, SRResults results)
  {
    return m_confirmer.getNext(current, results);
  }

}
TOP

Related Classes of org.speakright.sro.SROConfirmYesNo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.