@Test
 public void testVariableOrConstantDeclaratorParentChildLinks() {
   ASTVariableOrConstantDeclarator vd =
       getOrderedNodes(ASTVariableOrConstantDeclarator.class, TEST2).get(0);
   // ASTMethodDeclaration vdParent = (ASTMethodDeclaration)
   // ((DataFlowNode) vd.getDataFlowNode().getParents().get(0)).getNode();
   ASTProgramUnit vdParent = (ASTProgramUnit) vd.getDataFlowNode().getParents().get(0).getNode();
   // Validate the two-way link between Program Unit and Variable
   assertEquals(vd, vdParent.getDataFlowNode().getChildren().get(0).getNode());
   assertEquals(vdParent, vd.getDataFlowNode().getParents().get(0).getNode());
 }
 /**
  * Java ASTStatementExpression equivalent is inferred as an Expression() which has an
  * UnlabelledStatement as a parent.
  */
 @Test
 public void testExpressionParentChildLinks() {
   ASTExpression ex = getOrderedNodes(ASTExpression.class, TEST1).get(0);
   DataFlowNode dfn = ex.getDataFlowNode();
   assertEquals(3, dfn.getLine());
   assertTrue(dfn.getNode() instanceof ASTExpression);
   List<DataFlowNode> dfns = dfn.getParents();
   assertEquals(1, dfns.size());
   DataFlowNode parentDfn = dfns.get(0);
   assertEquals(2, parentDfn.getLine());
   assertTrue(parentDfn.getNode() instanceof ASTProgramUnit);
   ASTProgramUnit exParent = (ASTProgramUnit) parentDfn.getNode();
   // Validate the two-way link between Program Unit and Statement
   assertEquals(ex, exParent.getDataFlowNode().getChildren().get(0).getNode());
   assertEquals(exParent, ex.getDataFlowNode().getParents().get(0).getNode());
 }
  @Override
  public Object visit(ASTProgramUnit node, Object data) {
    LOGGER.entering(CLASS_NAME, "visit(ASTProgramUnit)");
    int npath = complexityMultipleOf(node, 1, data);

    DataPoint point = new DataPoint();
    point.setNode(node);
    point.setScore(1.0 * npath);
    point.setMessage(getMessage());
    addDataPoint(point);

    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(
          "NPath complexity:  "
              + npath
              + " for line "
              + node.getBeginLine()
              + ", column "
              + node.getBeginColumn());
    }
    LOGGER.exiting(CLASS_NAME, "visit(ASTProgramUnit)", npath);
    return Integer.valueOf(npath);
  }