Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    /**
     * in this NQF project, the root node is QualityMeasureDocument
     * @param aNode
     * @param rootNode
     * @return the distance a node to the rootnode
     */
    public static int getHeight(Node aNode, Node rootNode) {
        int height = 0;
        if (aNode == null) {
            return 0;
        }
        while (aNode.getParentNode() != rootNode) {
            aNode = aNode.getParentNode();
            height++;
        }
        return height;
    }
}