Ejemplo n.º 1
0
  @Override
  public boolean checkPreconditions(ParseConfiguration configuration) {
    if (configuration.getStack().isEmpty()) {
      if (LOG.isTraceEnabled()) {
        LOG.trace("Cannot apply " + this.toString() + ": stack is empty");
      }
      return false;
    }

    // top of stack must already have a governor
    PosTaggedToken topOfStack = configuration.getStack().peek();
    PosTaggedToken governor = configuration.getHead(topOfStack);
    if (governor == null) {
      if (LOG.isTraceEnabled()) {
        LOG.trace(
            "Cannot apply "
                + this.toString()
                + ": top of stack "
                + topOfStack
                + " doesn't yet have a governor.");
      }
      return false;
    }

    return true;
  }
Ejemplo n.º 2
0
 @Override
 protected void applyInternal(ParseConfiguration configuration) {
   configuration.getStack().pop();
 }