software/test/performance/src/org/LexGrid/LexBIG/example/BuildTreeForCode.java
/**
     * Prints the tree for an individual code.
     */
Prints the tree for an individual code.
Prints the tree for an individual code .
public void run(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, String scheme,
            CodingSchemeVersionOrTag csvt, SupportedHierarchy hierarchyDefn, String focusCode) throws LBException {
        Util_displayMessage("============================================================");
        Util_displayMessage("Focus code: " + focusCode);
        Util_displayMessage("============================================================");
        TreeItem ti = new TreeItem("<Root>", "Root node");
        long ms = System.currentTimeMillis();
        int pathsResolved = 0;
        try {
            String hierarchyID = hierarchyDefn.getLocalId();
            String[] associationsToNavigate = hierarchyDefn.getAssociationIds();
            boolean associationsNavigatedFwd = hierarchyDefn.getIsForwardNavigable();
            Map<String, EntityDescription> codesToDescriptions = new HashMap<String, EntityDescription>();
            AssociationList pathsFromRoot = getPathsFromRoot(lbsvc, lbscm, scheme, csvt, hierarchyID, focusCode,
                    codesToDescriptions);
            for (Iterator<Association> paths = pathsFromRoot.iterateAssociation(); paths.hasNext();) {
                addPathFromRoot(ti, lbsvc, lbscm, scheme, csvt, paths.next(), associationsToNavigate, associationsNavigatedFwd,
                        codesToDescriptions);
                pathsResolved++;
            }
        } finally {
            System.out.println("Run time (milliseconds): " + (System.currentTimeMillis() - ms) +
                " to resolve " + pathsResolved + " paths from root.");
        }
        printTree(ti, focusCode, 0);
    }
public void run ( LexBIGService lbsvc , LexBIGServiceConvenienceMethods lbscm , String scheme , CodingSchemeVersionOrTag csvt , SupportedHierarchy hierarchyDefn , String focusCode ) throws LBException { Util_displayMessage ( "============================================================" ) ; Util_displayMessage ( "Focus code: " + focusCode ) ; Util_displayMessage ( "============================================================" ) ; TreeItem ti = new TreeItem ( "<Root>" , "Root node" ) ; long ms = System . currentTimeMillis ( ) ; int pathsResolved = 0 ; try { String hierarchyID = hierarchyDefn . getLocalId ( ) ; String [ ] associationsToNavigate = hierarchyDefn . getAssociationIds ( ) ; boolean associationsNavigatedFwd = hierarchyDefn . getIsForwardNavigable ( ) ; Map < String , EntityDescription > codesToDescriptions = new HashMap < String , EntityDescription > ( ) ; AssociationList pathsFromRoot = getPathsFromRoot ( lbsvc , lbscm , scheme , csvt , hierarchyID , focusCode , codesToDescriptions ) ; for ( Iterator < Association > paths = pathsFromRoot . iterateAssociation ( ) ; paths . hasNext ( ) ; ) { addPathFromRoot ( ti , lbsvc , lbscm , scheme , csvt , paths . next ( ) , associationsToNavigate , associationsNavigatedFwd , codesToDescriptions ) ; pathsResolved ++ ; } } finally { System . out . println ( "Run time (milliseconds): " + ( System . currentTimeMillis ( ) - ms ) + " to resolve " + pathsResolved + " paths from root." ) ; } printTree ( ti , focusCode , 0 ) ; }
Prints the tree for an individual code.
Prints the tree for an individual code .
// Print a header and define a new tree for the code being processed.
 // Resolve 'is_a' hierarchy info. This example will
 // need to make some calls outside of what is covered
 // by existing convenience methods, but we use the
 // registered hierarchy to prevent need to hard code
 // relationship and direction info used on lookup ...
 //String[] associationsToNavigate = hierarchyDefn.getAssociationNames();
 // Identify the set of all codes on path from root
 // to the focus code ...
 // Typically there will be one path, but handle multiple just in
 // case.  Each path from root provides a 'backbone', from focus
 // code to root, for additional nodes to hang off of in our
 // printout. For every backbone node, one level of children is
 // printed, along with an indication of whether those nodes can
 // be expanded.
 // Print the result ..
