void checkValidity(SpanNode node, List<SpanNode> childrenToCheck) {
        if (!node.isValid()) {
            throw new IllegalStateException("Cannot reuse SpanNode instance " + node + ", is INVALID.");
        }
        if (node.getParent() != null) {
            if (node.getParent() != this) {
                throw new IllegalStateException(node + " is already a child of " + node.getParent() + ", cannot be added to " + this);
            } else if (node.getParent() == this && childrenToCheck.contains(node)) {
                throw new IllegalStateException(node + " is already a child of " + this + ", cannot be added twice to the same parent node.");
            }
        }
    }
Deep-copies a SpanList.

@param other the SpanList to copy.
document/src/main/java/com/yahoo/document/annotation/SpanList.java