@Override void annotate(Annotation a) { if (a.getSpanNode() == null) { spanNode2Annotation.put(DummySpanNode.INSTANCE, a); } else { spanNode2Annotation.put(a.getSpanNode(), a); } }
/** * Adds an Annotation to the internal list of annotations for this SpanTree. Use this when * adding an Annotation that uses an AnnotationReference, and does not annotate a SpanNode. * * @param a the Annotation to add * @return this, for chaining * @see com.yahoo.document.annotation.Annotation * @see com.yahoo.document.annotation.AnnotationReference * @see com.yahoo.document.annotation.AnnotationReferenceDataType */ public SpanTree annotate(Annotation a) { if (a.getSpanNode() == null) { annotateInternal(DummySpanNode.INSTANCE, a); } else { annotateInternal(a.getSpanNode(), a); } return this; }
@Override public boolean hasNext() { nextCalled = false; while (base.hasNext() && !nodes.containsKey(base.peek().getSpanNode())) { base.next(); } //now either, base has no next, or next is the correct node if (base.hasNext()) { return true; } return false; }
Map<Integer, List<String>> map = new HashMap<>(); for (Annotation anno : tree) { SpanNode span = anno.getSpanNode(); if (span == null) { continue;
continue; Integer indexOfOriginalSpanNode = originalSpanNodes.get(originalAnnotation.getSpanNode()); if (indexOfOriginalSpanNode == null) { throw new IllegalStateException("Could not clone tree, SpanNode of " + originalAnnotation + " not found.");
int spanNodeId = annotation.getSpanNode().getScratchId(); if (spanNodeId >= 0) { buf.putInt1_2_4Bytes(spanNodeId);
int spanNodeId = annotation.getSpanNode().getScratchId(); if (spanNodeId >= 0) { buf.putInt1_2_4Bytes(spanNodeId);