Example #1
0
 private static void verify(final Pair<AbstractNode, List<AbstractNode>> cluster) {
   for (final AbstractNode n : cluster.getSecond()) {
     if (!n.isElement()) {
       throw new IllegalArgumentException("Element expected");
     }
     if (!((Element) n).getSubnodes().isConcatenation()) {
       throw new IllegalArgumentException("Concatenation expected");
     }
   }
 }
Example #2
0
 private void verifyInput(final List<AbstractNode> initialGrammar) throws InterruptedException {
   for (AbstractNode node : initialGrammar) {
     if (Thread.interrupted()) {
       throw new InterruptedException();
     }
     if (!NodeType.ELEMENT.equals(node.getType())) {
       final StringBuilder sb = new StringBuilder("Initial grammar contains rule with ");
       sb.append(node.getType().toString());
       sb.append(" as left side.");
       throw new IllegalArgumentException(sb.toString());
     }
     if (node == null) {
       throw new IllegalArgumentException("Got null as left side in grammar.");
     }
   }
 }