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
62
63
64
65
66
package Torello.CSS;

import java.util.Vector;

@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="CSS_TOK")
public class Func extends Identifier
    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
    // ********************************************************************************************
    // ********************************************************************************************


    Func(
            final int[]     css,
            final int       sPos,
            final int       ePos,
            final String    functionName
        )
    { super(css, sPos, ePos, functionName); }

    @Override 
    public final boolean isFunc() { return true; }

    @Override
    public final Func ifFunc() { return this; }


    // ********************************************************************************************
    // ********************************************************************************************
    // User's Constructor: a static "build" method
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-TOK=Func DATA-P=funcIdentifier>
     * <EMBED CLASS='external-html' DATA-FILE-ID=BUILD_DESC>
     * @param funcIdentifier <EMBED CLASS='external-html' DATA-FILE-ID=BUILD_PARAM>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=BUILD_RET>
     * @throws TokenizeException <EMBED CLASS='external-html' DATA-FILE-ID=BUILD_TOK_EX>
     */
    @SuppressWarnings("unchecked")
    public static Func build(final String funcIdentifier)
    {
        return (Func) CSSToken.build
            (funcIdentifier, INPUT_CHECKER, Identifier::consumeIdentLikeSequence);
    }

    private static final CSSToken.InputChecker INPUT_CHECKER = (int[] css) ->
    {
        if (css.length < 2) throw new TokenizeException(Func.class);

        if (css[css.length - 1] != '(') throw new TokenizeException
            ("Input String does not end with a Left-Parenthesis");

        if (! Identifier.startsIdentSequence(css, 0)) throw new TokenizeException
            ("String-text beginning does not constitute a valid CSS Function-Token");
    };
}