1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | package Torello.CSS; import java.util.Vector; /** * CSS-Tokenizer Class for the <B>Comment-Delimiter Close</B> Token. */ @Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="CSS_TOK") public class CDC extends CSSToken implements CharSequence, java.io.Serializable, Comparable<CharSequence> { /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ protected static final long serialVersionUID = 1; // ******************************************************************************************** // ******************************************************************************************** // Private Constructor, API "is" and "if" Methods // ******************************************************************************************** // ******************************************************************************************** static final CDC SINGLETON = new CDC(); private CDC() { super("-->"); } @Override public final boolean isCDC() { return true; } @Override public final CDC ifCDC() { return this; } // ******************************************************************************************** // ******************************************************************************************** // Tokenizer's "is" Method(s) // ******************************************************************************************** // ******************************************************************************************** /** * Checks whether or not the next three code-point / characters are {@code '-', '-'} and * {@code '>'}. * * <EMBED CLASS=defs DATA-TOK="Comment-Delimiter Open" DATA-URL=CDC-token-diagram * DATA-OP=Consume> * <EMBED CLASS=external-html DATA-FILE-ID=COPIED_CSS_WG_RR> * <EMBED CLASS=external-html DATA-FILE-ID=CDC_TOK_SVG> * @param css CSS-{@code String} as an array of code-points. * @param sPos The array-index where the tokenizer is to consume its next token * @return {@code TRUE} if and only if the next token in the array is a {@code CDC} */ public static boolean is(int[] css, int sPos) { final int c1 = ((sPos + 0) < css.length) ? css[sPos + 0] : 0; final int c2 = ((sPos + 1) < css.length) ? css[sPos + 1] : 0; final int c3 = ((sPos + 2) < css.length) ? css[sPos + 2] : 0; return (c1 == '-') && (c2 == '-') && (c3 == '>'); } } |