package com.srbenoit.xml;

/**
 * A generic span that covers a tag.
 */
public class TagSpan {

    /** the index of the start of the tag (the &lt; character) */
    public final transient int start;

    /** the index of the end of the tag (the &gt; character) */
    public final transient int end;

    /** <code>true</code> if this is an open (or empty) tag */
    public final transient boolean isOpen;

    /** <code>true</code> if this is a close (or empty) tag */
    public final transient boolean isClose;

    /** the index of the start of the tag name */
    public final transient int nameStart;

    /** the index of the end of the tag name */
    public final transient int nameEnd;

    /**
     * Constructs a new <code>TagSpan</code>.
     *
     * @param  startPos      the start position of the tag
     * @param  endPos        the end position of the tag
     * @param  open          <code>true</code> if this is an open (or empty) tag
     * @param  close         <code>true</code> if this is a close (or empty) tag
     * @param  nameStartPos  the start position of the tag name
     * @param  nameEndPos    the end position of the tag name
     */
    public TagSpan(final int startPos, final int endPos, final boolean open, final boolean close,
        final int nameStartPos, final int nameEndPos) {

        this.start = startPos;
        this.end = endPos;
        this.isOpen = open;
        this.isClose = close;
        this.nameStart = nameStartPos;
        this.nameEnd = nameEndPos;
    }
}
