
class SmartDateParseState
{
    constructor()
    {
        this._value = '';
        this._valueIndex = 0;
    }
    
    start(value)
    {
        this._value = value;
        this._valueIndex = 0;
    }
    
    current()
    {
        return this.isOver() ? '' : this._value[this._valueIndex];
    }
    
    next()
    {
        if (this.isOver()) {
            return false;
        }
        
        this._valueIndex++;
        
        return !this.isOver();
    }
    
    isOver()
    {
        return this._valueIndex >= this._value.length;
    }
    
    value()
    {
        return this._value;
    }
    
    valueIndex()
    {
        return this._valueIndex;
    }
    
    setValueIndex(index)
    {
        if (this._valueIndex < index) {
            this._valueIndex = index;
        }
    }
}
