Beispiel #1
0
 /**
  * Adds a TypeTreeNode with the specified Type to the TypeTree and returns it. If the TypeTreeNode
  * with its surtype isn't present in the TypeTree, the recursive call to the method will create
  * it. The TypeTreeNode created is also added to the nodeMap.
  *
  * @param t the type wanted to be added to the TypeTree
  * @return the TypeTreeNode with the specified Type *
  */
 public TypeTreeNode addType(Type t) {
   TypeTreeNode parent = nodeMap.get(t.getSurtype());
   if (parent == null) {
     parent = addType(t.getSurtype());
   }
   TypeTreeNode node = new TypeTreeNode(t);
   nodeMap.put(t, node);
   parent.addChild(node);
   return node;
 }
Beispiel #2
0
 /**
  * Returns the list of Concepts having the specified Type or one of his "children". The method
  * runs through the Concepts having exactly the given Type, then through the Concepts having the
  * "children" Types.
  *
  * @param t the Type of the Concepts searched
  * @return the list of Concepts with the given Type *
  */
 public List<Concept> getConceptsForType(Type t) {
   TypeTreeNode node = nodeMap.get(t);
   if (node == null) {
     return new ArrayList<Concept>();
   }
   List<Concept> list = new ArrayList<Concept>();
   for (Concept c : node.getConceptList()) {
     list.add(c);
   }
   for (TypeTreeNode child : node.getChildrenList()) {
     for (Concept c : getConceptsForType(child.getType())) {
       list.add(c);
     }
   }
   return list;
 }
Beispiel #3
0
 public void addConcept(Concept c) {
   TypeTreeNode node = nodeMap.get(c.getType());
   node.addConcept(c);
 }