public boolean isChildOf(Keyword word) {
   Iterator parents = getParentIterator();
   while (parents.hasNext()) {
     Keyword par = (Keyword) parents.next();
     if (par == null) return (false);
     else if (par.equals(word)) return (true);
     else return (par.isChildOf(word));
   }
   return false;
 }
 public static EnumDefinition dropKeywordCreateEnum(
     EnumDefinition enumDefinition, Keyword keyword, boolean saveEnum) {
   if (enumDefinition == null) {
     enumDefinition = new EnumDefinition(keyword.toString(), saveEnum);
   }
   enumDefinition.setKeyword(keyword);
   return enumDefinition;
 }
  public static Vector extractKeywordFromText(String text) {
    // see if there are any existing keywords represented
    // in this text
    // Get all keywords

    Vector extractedKeywords = new Vector();
    Iterator keywords = allKeywords.iterator();
    while (keywords.hasNext()) {
      Keyword keyword = (Keyword) keywords.next();
      if (text != null
          && keyword.toString() != null
          && text.toLowerCase().indexOf(keyword.toString().toLowerCase()) > -1) {
        extractedKeywords.addElement(keyword);
      }
    }
    return extractedKeywords;
  }
 private Vector getChildren(Keyword keyword, Vector allKids) {
   allKids.addElement(keyword);
   // 			System.out.println("Addtoallkids " + keyword + "  " + allKids );
   Vector children = keyword.getChildren();
   if (children != null) {
     Iterator i = children.iterator();
     while (i.hasNext()) {
       Keyword child = (Keyword) i.next();
       getChildren(child, allKids);
     }
   }
   return allKids;
 }
  public boolean dropOn(Object dropOnObject) {
    if (dropOnObject instanceof Keyword) {
      Keyword parentKeyword = null;
      Keyword newParentKeyword = (Keyword) dropOnObject;
      // Add child to new parent
      newParentKeyword.addChild(this);
      // Add new parent to child
      setPar(newParentKeyword);
      update();
      newParentKeyword.update();
      return true;
    } else if (dropOnObject instanceof PersistibleWithKeywords) {
      // 						System.out.println("droping a keyword on " + dropOnObject);
      // THis seems to cause a duplicate entry
      addDescribedInstance((PersistibleWithKeywords) dropOnObject);
      update();

      ((PersistibleWithKeywords) dropOnObject).link(this);
      ((PersistibleWithKeywords) dropOnObject).update();
      return true;
    }
    return false;
  }
  private void addKeyword(Hashtable table, Keyword word, Keyword parent) {
    boolean recurse = true;

    if (table.containsKey(word)) recurse = false;

    if (parent == null) table.put(word, String.valueOf(-1));
    else table.put(word, parent);

    if (recurse) {
      Iterator it = word.getChildren().iterator();
      while (it.hasNext()) {
        addKeyword(table, (Keyword) it.next(), word);
      }
    }
  }
 public static EnumDefinition dropKeywordCreateEnum(Keyword keyword, boolean saveEnum) {
   EnumDefinition enumDefinition = new EnumDefinition(keyword.toString(), saveEnum);
   enumDefinition.setKeyword(keyword);
   return enumDefinition;
 }
 public static void main(String[] args) {
   Keyword t = new Keyword("TEST KEYWORD");
   t.update();
   oncotcap.Oncotcap.getDataSource().commit();
 }