import java.lang.reflect.*;
import java.util.regex.*;

/**
 *  A self-contained program that displays
 *  descriptions of the fully-qualified class
 *  entered on the command line and all of
 *  its superclasses.
 *
 *@author     Gary D. Brown
 *@version    1.1, 04/30/07
 */
public class ShowHierarchy {
  
  private final static String usage =
    "usage: \n" +
    "java ShowHierarchy qualified.class.name";
    
  /**
   *  Removes package qualifiers from a String
   *
   *@param  s  A String possibly containing package qualifiers
   *@return    The modified String
   */
  private static String strip(String s) {
    Pattern p = Pattern.compile("\\w+\\.");
    return p.matcher(s).replaceAll("");
  }
    
  /**
   *  Creates a list of interfaces implemented by a class
   *
   *@param  cl  Reference to a class object
   *@return     Array of Strings containing interface names
   */
  private static String[] interfaces(Class cl) {
  }
    
  /**
   *  Creates definitions for the fields in a class
   *
   *@param  cl  Reference to a class object
   *@return     Array of Strings containing field definitions
   */
  private static String[] fields(Class cl) {
  }
    
  /**
   *  Creates prototypes for the methods declared in a class
   *
   *@param  cl  Reference to a Class object
   *@return     Array of Strings containing method prototypes
   */
  private static String[] methods(Class cl) {
    Method[] m = cl.getMethods();
    String[] s = new String[m.length];
    // Filter out superclass methods and convert to strings
    int count = 0;
    for (int i = 0; i < s.length; ++i) {
      if (m[i].getDeclaringClass() == cl) {
        s[i] = strip(m[i].toString());
        ++count; } }
    // Build the return string array
    String[] returnString = new String[count];
    for (int i = 0; i < count; ++i) {
      returnString[i] = s[i]; }
    return returnString;
  }
    
  /**
   *  Creates prototypes for the constructors declared in a class
   *
   *@param  cl  Reference to a class object
   *@return     Array of Strings containing constructor prototypes
   */
  private static String[] constructors(Class cl) {
  }
    
  /**
   *  Displays a header for a member type and a list of those members
   *
   *@param  s  Array of Strings describing class members
   *@param  t  String describing the member type
   */
  private static void showMemberType(String[] s, String t) {
  }
        
  /**
   *  Displays, if present, the interfaces, fields, methods
   *  and constructors of a class or interface
   *
   *@param  cl  Reference to a class object
   */
  private static void showClass(Class cl) {
  }
    
  /**
   *  The main method for the ShowHierarchy class. It displays
   *  descriptions of the fully-qualified class entered on the command
   *  line and all of its superclasses.
   *
   *@param  args  The command line arguments
   */
  public static void main(String[] args) {
  }
}