/**************************************************************************** // Author: Kane Tse (KT) // Overview: This is a testing class used to test the other members of this // class, and to provide debugging functions such as printing // debugging messages. // Modifications: // June/19/01 - Kane - Created /***************************************************************************/ package goview; import java.io.*; public class test { public static GOTree goTree; private static int debugLevel = 0; /************************************************************************* * * Method: main() * Purpose: Executes the this testing program * Parameters: None * Returns: None. Output is sent directly to standard out * ************************************************************************/ public static void main (String args[]) { String filename; // filename = args[0]; filename = "goview/component.ontology"; System.out.println("File is: " + filename); try { FileReader goFileReader = new FileReader(filename); goTree = new GOTree(goFileReader); } catch (FileNotFoundException fnfExc) { System.err.println("Unable to find file: " + filename); fnfExc.printStackTrace(); } catch (Exception exc) { System.err.println("Unable to create GO Tree"); exc.printStackTrace(); } Node testNode = goTree.getNode("cell wall (sensu Bacteria)"); // testNode = goTree.getRoot(); if (testNode != null) { System.out.println(testNode.toString()); } else { System.out.println("Couldn't find node"); } System.exit(0); } /************************************************************************* * * Method: debugMsg() * Purpose: Prints a debugging message to standard error, if the debugging * level of the message is greater than the debugLevel set * through the class level. * Parameters: String message - the message to display to the user * int messageLevel - the level of the debugging message * Returns: None. Output is sent directly to standard out * ************************************************************************/ public static void debugMsg(String message, int messageLevel) { // only print the debugging message if its level exceeds the // debugging level of this program if (messageLevel < debugLevel) { System.err.println(message); } } }