package com.gliwka.hyperscan.wrapper;

/**
 * Flags influencing the matching behaviour of the scanner for a particular Expression
 */
public enum ExpressionFlag implements BitFlag {

    /**
     * Expression will be compiled with no flags.
     */
    NO_FLAG(0),


    /**
     * Matching will be performed case-insensitively.
     */
    CASELESS(1),

    /**
     * Matching a . will not exclude newlines.
     */
    DOTALL(2),


    /**
     * ^ and $ anchors match any newlines in data.
     */
    MULTILINE(4),

    /**
     * Only one match will be generated by the expression per stream.
     */
    SINGLEMATCH(8),

    /**
     * Allow expressions which can match against an empty string, such as .*.
     */
    ALLOWEMPTY(16),

    /**
     * Treat this pattern as a sequence of UTF-8 characters.
     */
    UTF8(32),

    /**
     * Use Unicode properties for character classes.
     */
    UCP(64),

    /**
     * compile pattern in prefiltering mode.
     */
    PREFILTER(128),

    /**
     * Report the leftmost start of match offset when a match is found.
     */
    SOM_LEFTMOST(256),

    /**
     * Parse the expression in logical combination syntax.
     */
    COMBINATION(512),

    /**
     * Ignore match reporting for this expression. Used for the sub-expressions in logical combinations.
     */
    QUIET(1024);

    private final int bits;

    ExpressionFlag(int bitPosition) {
        this.bits = bitPosition;
    }


    /**
     * Get the significant bits for the flag
     * @return int containing the significant bit for the flag
     */
    public int getBits() {
        return bits;
    }
}

package com.gliwka.hyperscan.wrapper;

import static com.gliwka.hyperscan.jni.hyperscan.*;

/**
 * Flags influencing the matching behaviour of the scanner for a particular Expression
 */
public enum ExpressionFlag implements BitFlag {

    /**
     * Expression will be compiled with no flags.
     */
    NO_FLAG(0),


    /**
     * Matching will be performed case-insensitively.
     */
    CASELESS(HS_FLAG_CASELESS),

    /**
     * Matching a . will not exclude newlines.
     */
    DOTALL(HS_FLAG_DOTALL),


    /**
     * ^ and $ anchors match any newlines in data.
     */
    MULTILINE(HS_FLAG_MULTILINE),

    /**
     * Only one match will be generated by the expression per stream.
     */
    SINGLEMATCH(HS_FLAG_SINGLEMATCH),

    /**
     * Allow expressions which can match against an empty string, such as .*.
     */
    ALLOWEMPTY(HS_FLAG_ALLOWEMPTY),

    /**
     * Treat this pattern as a sequence of UTF-8 characters.
     */
    UTF8(HS_FLAG_UTF8),

    /**
     * Use Unicode properties for character classes.
     */
    UCP(HS_FLAG_UCP),

    /**
     * compile pattern in prefiltering mode.
     */
    PREFILTER(HS_FLAG_PREFILTER),

    /**
     * Report the leftmost start of match offset when a match is found.
     */
    SOM_LEFTMOST(HS_FLAG_SOM_LEFTMOST),

    /**
     * Parse the expression in logical combination syntax.
     */
    COMBINATION(HS_FLAG_COMBINATION),

    /**
     * Ignore match reporting for this expression. Used for the sub-expressions in logical combinations.
     */
    QUIET(HS_FLAG_QUIET);

    private final int bits;

    ExpressionFlag(int bitPosition) {
        this.bits = bitPosition;
    }


    /**
     * Get the significant bits for the flag
     * @return int containing the significant bit for the flag
     */
    public int getBits() {
        return bits;
    }
}

Use constants for bit flag values