Search in sources :

Example 6 with SpanNode

use of com.yahoo.document.annotation.SpanNode in project vespa by vespa-engine.

the class VespaDocumentDeserializer42 method readSpanNode.

private SpanNode readSpanNode() {
    byte type = buf.get();
    buf.position(buf.position() - 1);
    SpanNode retval;
    if ((type & Span.ID) == Span.ID) {
        retval = new Span();
        if (spanNodes != null) {
            spanNodes.add(retval);
        }
        read((Span) retval);
    } else if ((type & SpanList.ID) == SpanList.ID) {
        retval = new SpanList();
        if (spanNodes != null) {
            spanNodes.add(retval);
        }
        read((SpanList) retval);
    } else if ((type & AlternateSpanList.ID) == AlternateSpanList.ID) {
        retval = new AlternateSpanList();
        if (spanNodes != null) {
            spanNodes.add(retval);
        }
        read((AlternateSpanList) retval);
    } else {
        throw new DeserializationException("Cannot read SpanNode of type " + type);
    }
    return retval;
}
Also used : SpanNode(com.yahoo.document.annotation.SpanNode) AlternateSpanList(com.yahoo.document.annotation.AlternateSpanList) AlternateSpanList(com.yahoo.document.annotation.AlternateSpanList) SpanList(com.yahoo.document.annotation.SpanList) Span(com.yahoo.document.annotation.Span)

Example 7 with SpanNode

use of com.yahoo.document.annotation.SpanNode in project vespa by vespa-engine.

the class VespaDocumentDeserializer42 method read.

public void read(SpanList spanList) {
    byte type = buf.get();
    if ((type & SpanList.ID) != SpanList.ID) {
        throw new DeserializationException("Cannot deserialize SpanList with type " + type);
    }
    List<SpanNode> nodes = readSpanList(spanList);
    for (SpanNode node : nodes) {
        spanList.add(node);
    }
}
Also used : SpanNode(com.yahoo.document.annotation.SpanNode)

Aggregations

SpanNode (com.yahoo.document.annotation.SpanNode)7 Span (com.yahoo.document.annotation.Span)3 SpanList (com.yahoo.document.annotation.SpanList)3 Annotation (com.yahoo.document.annotation.Annotation)2 AnnotationType (com.yahoo.document.annotation.AnnotationType)2 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)2 AlternateSpanList (com.yahoo.document.annotation.AlternateSpanList)1 AnnotationTypeRegistry (com.yahoo.document.annotation.AnnotationTypeRegistry)1 SpanTree (com.yahoo.document.annotation.SpanTree)1 ByteFieldValue (com.yahoo.document.datatypes.ByteFieldValue)1 CollectionFieldValue (com.yahoo.document.datatypes.CollectionFieldValue)1 DoubleFieldValue (com.yahoo.document.datatypes.DoubleFieldValue)1 FieldValue (com.yahoo.document.datatypes.FieldValue)1 FloatFieldValue (com.yahoo.document.datatypes.FloatFieldValue)1 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)1 LongFieldValue (com.yahoo.document.datatypes.LongFieldValue)1 MapFieldValue (com.yahoo.document.datatypes.MapFieldValue)1 PredicateFieldValue (com.yahoo.document.datatypes.PredicateFieldValue)1 ReferenceFieldValue (com.yahoo.document.datatypes.ReferenceFieldValue)1 StructuredFieldValue (com.yahoo.document.datatypes.StructuredFieldValue)1