static void checkNewChild(ASTNode node,ASTNode newChild,boolean cycleCheck,Class nodeType){
  if (newChild.ast != node.ast) {
    throw new IllegalArgumentException();
  }
  if (newChild.getParent() != null) {
    throw new IllegalArgumentException();
  }
  if (cycleCheck && newChild == node.getRoot()) {
    throw new IllegalArgumentException();
  }
  if ((newChild.typeAndFlags & PROTECT) != 0) {
    throw new IllegalArgumentException("AST node cannot be modified");
  }
}

static void checkNewChild ( ASTNode node , ASTNode newChild , boolean cycleCheck , Class nodeType ) { if ( newChild . ast != node . ast ) { throw new IllegalArgumentException ( ) ; } if ( newChild . getParent ( ) != null ) { throw new IllegalArgumentException ( ) ; } if ( cycleCheck && newChild == node . getRoot ( ) ) { throw new IllegalArgumentException ( ) ; } if ( ( newChild . typeAndFlags & PROTECT ) != 0 ) { throw new IllegalArgumentException ( "AST node cannot be modified" ) ; } }
checks whether the given new child node is a node in a different ast from its parent - to - be , whether it is already has a parent , whether adding it to its parent - to - be would create a cycle , and whether the child is of the right type . the parent - to - be is the enclosing instance .
