예제 #1
0
 public void initTransitionSystem(GuideUserHistory history) throws MaltChainedException {
   this.actionContainers = history.getActionContainerArray();
   if (actionContainers.length < 1) {
     throw new ParsingException(
         "Problem when initialize the history (sequence of actions). There are no action containers. ");
   }
   int nLabels = 0;
   for (int i = 0; i < actionContainers.length; i++) {
     if (actionContainers[i].getTableContainerName().startsWith("A.")) {
       nLabels++;
     }
   }
   int j = 0;
   for (int i = 0; i < actionContainers.length; i++) {
     if (actionContainers[i].getTableContainerName().equals("T.TRANS")) {
       transActionContainer = actionContainers[i];
     } else if (actionContainers[i].getTableContainerName().startsWith("A.")) {
       if (arcLabelActionContainers == null) {
         arcLabelActionContainers = new ActionContainer[nLabels];
       }
       arcLabelActionContainers[j++] = actionContainers[i];
     }
   }
   initWithDefaultTransitions(history);
 }
예제 #2
0
  protected GuideUserAction updateActionContainers(
      GuideUserHistory history, int transition, LabelSet arcLabels) throws MaltChainedException {
    transActionContainer.setAction(transition);

    if (arcLabels == null) {
      for (int i = 0; i < arcLabelActionContainers.length; i++) {
        arcLabelActionContainers[i].setAction(-1);
      }
    } else {
      for (int i = 0; i < arcLabelActionContainers.length; i++) {
        arcLabelActionContainers[i].setAction(
            arcLabels.get(arcLabelActionContainers[i].getTable()).shortValue());
      }
    }
    GuideUserAction oracleAction = history.getEmptyGuideUserAction();
    oracleAction.addAction(actionContainers);
    return oracleAction;
  }