package com.cf.imes.framework.id.core.util;

import java.util.concurrent.atomic.AtomicLong;

public class SerialNoMinuteCounter {
    private static final long MASK = 0x7FFFFFFFFFFFFFFFL;
    private final AtomicLong atom;

    public SerialNoMinuteCounter() {
        atom = new AtomicLong(0);
    }

    public final long incrementAndGet() {
        return atom.incrementAndGet() & MASK;
    }

    public long get() {
        return atom.get() & MASK;
    }

    public void set(long newValue) {
        atom.set(newValue & MASK);
    }

}
