/*
 * BinaryAlphabetFactory.h
 *
 *  Created on: 01. 03. 2021
 *      Author: Martin Prokopic
 */

#pragma once

#include <alib/set>
#include <alphabet/common/SymbolNormalize.h>

namespace alphabet {

namespace generate {

class BinaryAlphabetFactory {
public:
    /**
     * Generate an alphabet containing all symbols with ASCII values 0 - 255 (all possible values of the C char datatype).
     *
     * @return the generated alphabet
     */
    static ext::set < char > generate ( ) {
        static ext::set < char > theAlphabet;

        if ( theAlphabet.empty ( )) {
            for ( char c = std::numeric_limits < char >::max ( ); c -- > std::numeric_limits < char >::min ( ); )
                theAlphabet.insert ( c );
        }

        return theAlphabet;
    }

    /**
     * Generate a normalized alphabet containing all symbols with ASCII values 0 - 255 (all possible values of the C char datatype).
     *
     * @return the generated alphabet
     */
    static ext::set < DefaultSymbolType > generateNormalized ( ) {
        static ext::set < DefaultSymbolType > theAlphabet;

        if ( theAlphabet.empty ( ))
            theAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( generate ( ));

        return theAlphabet;
    }
};

} /* namespace generate */

} /* namespace alphabet */
