private SpanNode copySpan(SpanNode spanTree) {
        if (spanTree instanceof Span) {
            return new Span((Span) spanTree);
        } else if (spanTree instanceof AlternateSpanList) {
            return new AlternateSpanList((AlternateSpanList) spanTree);
        } else if (spanTree instanceof SpanList) {
            return new SpanList((SpanList) spanTree);
        } else if (spanTree instanceof DummySpanNode) {
            return spanTree;  //shouldn't really happen
        } else {
            throw new IllegalStateException("Cannot create copy of " + spanTree + " with class "
            + ((spanTree == null) ? "null" : spanTree.getClass()));
        }
    }
Creates a new SpanTree with the given name and an empty SpanList as its root node.

@param name the name of the span tree
document/src/main/java/com/yahoo/document/annotation/SpanTree.java