IDGenerator.java :  » Game » openfield » battlefield » util » Java Open Source

Java Open Source » Game » openfield 
openfield » battlefield » util » IDGenerator.java
/*
 *--------------------------------------------------------------------------
 *   Battlefield - A Realtime Network Multiplayer Game
 *   =======================================================
 *   Developed by Group D02 - 2009/2010 Semester 4 - CS2103
 *     Harry Nguyen Duy Hoang <nnduyhoang@yahoo.co.uk>
 *     Kent Chng Siang Rong <fivefootway@gmail.com>
 *     Lim Yong Peng <limpeng1986@gmail.com>
 *     Loh Xiankun <u0807185@nus.edu.sg>
 *   Instructed by
 *     Dr. Damith C.Rajapakse <damith@gmail.com>
 *   =======================================================
 *   $Id: IDGenerator.java 570 2010-07-25 20:56:59Z Harry $
 *   $LastChangedDate: 2010-07-25 13:56:59 -0700 (Sun, 25 Jul 2010) $
 *   $LastChangedBy: Harry $
 *--------------------------------------------------------------------------
 */
package battlefield.util;

import java.io.Serializable;

/**
 *
 * @author Harry Nguyen
 */
public class IDGenerator implements Serializable {

    private int counter;

    public IDGenerator() {
        counter = 0;
    }

    public int next() {
        return ++counter;
    }

    public int current() {
        return counter;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.