/** * Instantiates a new annotation source. * * @param name the name * @param annotations the annotations * @param color the color * @param ancestry the ancestry */ public AnnotationSource(String name, Annotations annotations, Color color, String ancestry) { super(name, annotations, color, ancestry); this.color = color; initializations = annotations.findTag("initialization"); crashes = annotations.findTag("crash"); failures = annotations.findTag("failure"); Vector<String> tagKeys = new Vector<String>(annotations.getTags()); Collections.sort(tagKeys); for (String label : tagKeys) { values.add(new ValuesAnnotations(label, ValueType.TAG)); } Vector<String> valueKeys = new Vector<String>(annotations.getValueKeys()); Collections.sort(valueKeys); for (String key : valueKeys) { values.add(new ValuesAnnotations(key, ValueType.NUMERICAL)); } }
/** * Adds the. * * @param name the name * @param annotations the annotations * @param colorHint the color hint * @param ancestry the ancestry */ public void add(String name, Annotations annotations, String colorHint, String ancestry) { if (!instances.isEmpty() && !StringUtils.same(getAncestry(), ancestry)) return; for (TransferableAnnotations a : instances) { if (a.getAnnotations() == annotations) return; } instances.add(new AnnotationSource(name, annotations, getUniqueColor(colorHint), ancestry)); length = Math.max(length, annotations.size()); this.bounds.setRect(0, 0, getLength(), 1); timeline.setLength(length); timeline.repaint(); timeline.getTrack("tags").addObject(this); values.reload(this); }