/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.util;

/**
 * This implements the <code>Sequence</code> interface providing a braindead
 * int based counter.
 *
 * @author Alex Leigh
 */
public class SimpleSequence implements Sequence {
    private int value = 0;

    public SimpleSequence() {
        // Do nothing
    }

    public SimpleSequence(final int startValue) {
        value = startValue;
    }

// --------------------- Interface Sequence ---------------------


    public int getNext() {
        final int result = value;
        value++;
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("SimpleSequence");
        sb.append("{value=").append(value);
        sb.append('}');
        return sb.toString();
    }
}
