package apz.co203;

public class Element
{
    // The last written character
    // Notice it's static as we want to retrieve this value BEFORE
    // creating an instance of our element class
    private static char highestChar = 'A';
    // Instance variables
    private char mChar;
    private String mValue;

    public Element(char pChar, String pValue) throws Exception
    {
        // Check our char is higher than previous
        if (pChar < highestChar)
            throw new Exception("Element already reserved");
        mChar = pChar;
        mValue = pValue;
        highestChar = (char)((int)pChar + 1);
    }

    public static char getHighestChar()
    {
        return highestChar;
    }

    public char getChar()
    {
        return mChar;
    }

    public String getValue()
    {
        return mValue;
    }
}