software/test/performance/src/org/LexGrid/LexBIG/example/ListHierarchyByCode.java
/**
	 * Displays descendents for a code within the specified hierarchy
	 * up to the given distance or until all paths to leaf nodes is exhausted,
	 * recursing as necessary.
	 * @param lbscm
	 * @param scheme
	 * @param csvt
	 * @param hierarchyID
	 * @param code
	 * @param maxDistance
	 * @param currentDistance
	 * @throws LBException
	 */
Displays descendents for a code within the specified hierarchy
up to the given distance or until all paths to leaf nodes is exhausted,
recursing as necessary.
Displays descendents for a code within the specified hierarchy up to the given distance or until all paths to leaf nodes is exhausted recursing as necessary .
protected void printLevelNext(
		LexBIGServiceConvenienceMethods lbscm,
		String scheme,
		CodingSchemeVersionOrTag csvt,
		String hierarchyID,
		String code,
		int maxDistance,
		int currentDistance) throws LBException
	{
		if (maxDistance < 0 || currentDistance < maxDistance) {
			StringBuffer indent = new StringBuffer();
			for (int i = 0; i <= currentDistance; i++)
				indent.append("    ");
			AssociationList associations = lbscm.getHierarchyLevelNext(scheme, csvt, hierarchyID, code, false, null);
			for (int i = 0; i < associations.getAssociationCount(); i++) {
				Association assoc = associations.getAssociation(i);
				AssociatedConceptList concepts = assoc.getAssociatedConcepts();
				for (int j = 0; j < concepts.getAssociatedConceptCount(); j++) {
					AssociatedConcept concept = concepts.getAssociatedConcept(j);
					String nextCode = concept.getConceptCode();
					String nextDesc = concept.getEntityDescription().getContent();
					Util.displayMessage(indent + assoc.getDirectionalName() + "->" + nextCode + ":" + nextDesc);
					printLevelNext(lbscm, scheme, csvt, hierarchyID, nextCode, maxDistance, currentDistance + 1);
				}
			}
		}
	}
protected void printLevelNext ( LexBIGServiceConvenienceMethods lbscm , String scheme , CodingSchemeVersionOrTag csvt , String hierarchyID , String code , int maxDistance , int currentDistance ) throws LBException { if ( maxDistance < 0 || currentDistance < maxDistance ) { StringBuffer indent = new StringBuffer ( ) ; for ( int i = 0 ; i <= currentDistance ; i ++ ) indent . append ( "    " ) ; AssociationList associations = lbscm . getHierarchyLevelNext ( scheme , csvt , hierarchyID , code , false , null ) ; for ( int i = 0 ; i < associations . getAssociationCount ( ) ; i ++ ) { Association assoc = associations . getAssociation ( i ) ; AssociatedConceptList concepts = assoc . getAssociatedConcepts ( ) ; for ( int j = 0 ; j < concepts . getAssociatedConceptCount ( ) ; j ++ ) { AssociatedConcept concept = concepts . getAssociatedConcept ( j ) ; String nextCode = concept . getConceptCode ( ) ; String nextDesc = concept . getEntityDescription ( ) . getContent ( ) ; Util . displayMessage ( indent + assoc . getDirectionalName ( ) + "->" + nextCode + ":" + nextDesc ) ; printLevelNext ( lbscm , scheme , csvt , hierarchyID , nextCode , maxDistance , currentDistance + 1 ) ; } } } }
Displays descendents for a code within the specified hierarchy
 up to the given distance or until all paths to leaf nodes is exhausted,
 recursing as necessary.
Displays descendents for a code within the specified hierarchy up to the given distance or until all paths to leaf nodes is exhausted recursing as necessary .