(Tree tree)
| 70 | } |
| 71 | |
| 72 | public void addTree(Tree tree) { |
| 73 | |
| 74 | Set<String> names = new TreeSet<String>(); |
| 75 | for (Node node : tree.getNodes()) { |
| 76 | names.addAll(node.getAttributeNames()); |
| 77 | } |
| 78 | for (Taxon taxon : tree.getTaxa()) { |
| 79 | names.addAll(taxon.getAttributeNames()); |
| 80 | } |
| 81 | for (String name : names) { |
| 82 | if (!name.startsWith("!")) { |
| 83 | AnnotationDefinition annotation = getAnnotationDefinitions().get(name); |
| 84 | |
| 85 | Set<Attributable> items = new HashSet<Attributable>(tree.getNodes()); |
| 86 | items.addAll(tree.getTaxa()); |
| 87 | |
| 88 | AnnotationDefinition.Type type = AnnotationDefinition.guessType(name, items); |
| 89 | |
| 90 | if (annotation == null) { |
| 91 | annotation = new AnnotationDefinition(name, type); |
| 92 | getAnnotationDefinitions().put(name, annotation); |
| 93 | } else if (type != annotation.getType()){ |
| 94 | AnnotationDefinition.Type newType = AnnotationDefinition.Type.STRING; |
| 95 | if (type == AnnotationDefinition.Type.INTEGER && |
| 96 | annotation.getType() == AnnotationDefinition.Type.REAL) { |
| 97 | newType = AnnotationDefinition.Type.REAL; |
| 98 | } |
| 99 | |
| 100 | if (newType != type) { |
| 101 | annotation = new AnnotationDefinition(name, newType); |
| 102 | getAnnotationDefinitions().put(name, annotation); |
| 103 | } |
| 104 | |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | super.addTree(tree); |
| 109 | |
| 110 | showStatus(); |
| 111 | } |
| 112 | |
| 113 | public void showTree(int index) { |
| 114 | super.showTree(index); |
nothing calls this directly
no test coverage detected