@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; }
@Override protected void applyInternal(ParseConfiguration configuration) { configuration.getStack().pop(); }