예제 #1
0
 public Vector getAssociatedLevelLists() {
   Vector levelLists = new Vector();
   Vector endPts = CollectionHelper.makeVector("Keyword");
   Hashtable keywordParents =
       oncotcap.Oncotcap.getDataSource()
           .getParentTree(
               "Keyword", endPts, CollectionHelper.makeVector(this), TreeDisplayModePanel.ROOT);
   // Take each of the parents and get the associated level lists
   if (keywordParents.size() <= 0) return levelLists;
   Hashtable levelListsHashtable =
       oncotcap.Oncotcap.getDataSource()
           .getInstanceTree(
               "EnumLevelList",
               new Vector(),
               makeLevelListFilter(keywordParents),
               TreeDisplayModePanel.ROOT);
   for (Enumeration e = keywordParents.keys(); e.hasMoreElements(); ) {
     System.out.println("Keyword.getAssociatedLevelLists: " + e.nextElement());
   }
   // Collect all the level lists from the hashtable
   Vector selectedItems = CollectionHelper.makeVector(keyword);
   for (Enumeration e = levelListsHashtable.keys(); e.hasMoreElements(); ) {
     Object obj = e.nextElement();
     if (obj instanceof EnumLevelList) {
       levelLists.addElement(obj);
     }
   }
   return levelLists;
 }
 public Collection<String> getAllVariables(ValueMapPath path) {
   Vector<String> vars = new Vector<String>();
   vars.add(getName());
   Collection<String> moreVars =
       JavaParser.getAllVariables(path.substitute(variable.getInitialValue()));
   for (String var : moreVars) if (!vars.contains(var)) vars.add(var);
   Collection<String> ifVars = getCodeBundleContainingMe().getIfClauseVariables(path);
   vars.addAll(ifVars);
   return (vars);
 }
 public Collection<VariableDependency> getVariableDependencies(ValueMapPath path) {
   Vector<VariableDependency> deps = new Vector<VariableDependency>();
   String leftVar = path.substituteJavaName(getName());
   Collection<String> rightVars =
       JavaParser.getAllVariables(path.substitute(variable.getInitialValue()));
   for (String var : rightVars)
     deps.add(new VariableDependency(leftVar, var, VariableDependency.ASSIGN));
   Collection<String> ifVars = getCodeBundleContainingMe().getIfClauseVariables(path);
   for (String var : ifVars)
     deps.add(new VariableDependency(leftVar, var, VariableDependency.LITERAL_if));
   return (deps);
 }
예제 #4
0
 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 Collection<Instruction> getInstructions() {
   if (instructions == null) {
     instructions = new Vector<Instruction>();
     instructions.add(new DeclarationInstruction());
   }
   return (instructions);
 }
예제 #6
0
  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;
  }
예제 #7
0
 public void unlink(oncotcap.datalayer.Persistible relatedPersistible) {
   if (relatedPersistible instanceof Keyword) {
     // 						System.out.println("removing the keyword p/c" + relatedPersistible);
     if (children != null) children.remove(relatedPersistible);
     if (parentKeywords != null) parentKeywords.remove(relatedPersistible);
   } else {
     // 					System.out.println("removing the keyword described instance"
     // 															 + relatedPersistible
     // 															 + " from list " + describedInstances);
     if (describedInstances != null) describedInstances.remove(relatedPersistible);
   }
 }
예제 #8
0
 private void init() {
   initGetterMap();
   initSetterMap();
   allKeywords.addElement(this);
   initPopupMenu();
 }
예제 #9
0
 public Collection getConnectedNodes() {
   Vector connectedNodes = new Vector();
   connectedNodes.addElement(Keyword.class);
   return connectedNodes;
 }
예제 #10
0
 public Iterator getChildrenIterator() {
   return (children.iterator());
 }
예제 #11
0
 public void addChild(Keyword keyword) {
   if (!children.contains(keyword)) children.add(keyword);
 }
 public Collection<String> getSetVariables(ValueMapPath path) {
   Vector<String> vars = new Vector();
   vars.add(path.substituteJavaName(getName()));
   return (vars);
 }