All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wizarius.orm.database.data.UniqueTableDictionary Maven / Gradle / Ivy

There is a newer version: 0.0.27.3
Show newest version
package com.wizarius.orm.database.data;

import com.wizarius.orm.database.exceptions.DBException;

/**
 * Created by Vladyslav Shyshkin on 19.01.2018.
 */
public class UniqueTableDictionary {
    private final char[] uniqueDictionary = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
    private int currentIndex = 0;

    public UniqueTableDictionary() {
    }

    /**
     * Get next identification
     *
     * @return unique char
     * @throws DBException on unable to get next table prefix
     */
    public char getNext() throws DBException {
        if (currentIndex + 1 > uniqueDictionary.length) {
            throw new DBException("Unique identifiers end");
        }
        return uniqueDictionary[currentIndex++];
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy