001package Torello.CSS;
002
003import java.util.Vector;
004import java.util.stream.IntStream;
005
006/**
007 * It has been patently decided that neither {@code 'BadStr'} nor {@code 'BadURL'} will have
008 * constructors.
009 */
010@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="CSS_TOK")
011public class BadStr extends CSSToken
012    implements CharSequence, java.io.Serializable, Comparable<CharSequence>
013{
014    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
015    protected static final long serialVersionUID = 1;
016
017
018    // ********************************************************************************************
019    // ********************************************************************************************
020    // Public & Final Fields
021    // ********************************************************************************************
022    // ********************************************************************************************
023
024
025    /* The quotation mark which was used to beging the Bad-{@code String}. */
026    public final char startingQuote;
027
028    /*
029     * The textual / {@code String} data that was collected before the wrongful
030     * {@code String}-termination.
031     */
032    public final String unescaped;
033
034
035    // ********************************************************************************************
036    // ********************************************************************************************
037    // Private Constructor, API "is" and "if" Methods
038    // ********************************************************************************************
039    // ********************************************************************************************
040
041
042    BadStr(
043            final int[]             css,
044            final int               sPos,
045            final int               ePos, 
046            final IntStream.Builder b
047        )
048    {
049        super(css, sPos, ePos);
050
051        this.startingQuote = (char) css[sPos];
052
053        int[] codePoints = b.build().toArray();
054        this.unescaped = new String(codePoints, 0, codePoints.length);
055    }
056
057    @Override 
058    public final boolean isBadStr () { return true; }
059
060    @Override
061    public final BadStr ifBadStr () { return this; }
062}