int trans = transActionContainer.getActionCode();
TwoPlanarConfig planarConfig = (TwoPlanarConfig)config;
DependencyNode activeStackPeek = planarConfig.getActiveStack().peek();
DependencyNode inactiveStackPeek = planarConfig.getInactiveStack().peek();
DependencyNode inputPeek = planarConfig.getInput().peek();
DependencyStructure dg = planarConfig.getDependencyGraph();
//int rootHandling = planarConfig.getRootHandling();
boolean singleHeadConstraint = planarConfig.requiresSingleHead();
boolean noCoveredRootsConstraint = planarConfig.requiresNoCoveredRoots();
boolean acyclicityConstraint = planarConfig.requiresAcyclicity();
//boolean connectednessConstraintOnReduce = planarConfig.requiresConnectednessCheckOnReduce();
//boolean connectednessConstraintOnShift = planarConfig.requiresConnectednessCheckOnShift();
if ((trans == LEFTARC || trans == RIGHTARC) && !isActionContainersLabeled()) {
return false;
}
//if ((trans == LEFTARC || trans == REDUCE) && stackPeek.isRoot()) {
// return false;
//}
if (trans == LEFTARC) {
//avoid making root child of something
if ( activeStackPeek.isRoot() )
return false;
//enforce single-head constraint if present
if ( activeStackPeek.hasHead() && singleHeadConstraint )
return false;
//avoid two links being created from and to the same node
if ( activeStackPeek.hasHead() && dg.getTokenNode(activeStackPeek.getIndex()).getHead().getIndex() == inputPeek.getIndex() )
return false;
//enforce acyclicity constraint if present
if ( acyclicityConstraint && activeStackPeek.findComponent().getIndex() == inputPeek.findComponent().getIndex() )
return false;
}
if (trans == RIGHTARC) {
//enforce single-head constraint if present
if ( inputPeek.hasHead() && singleHeadConstraint )
return false;
//avoid two links being created from and to the same node
if ( inputPeek.hasHead() && dg.getTokenNode(inputPeek.getIndex()).getHead().getIndex() == activeStackPeek.getIndex() )
return false;
//enforce acyclicity constraint if present
if ( acyclicityConstraint && activeStackPeek.findComponent().getIndex() == inputPeek.findComponent().getIndex() )
return false;
}