/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package netzprog02_j_ultimatefinal;

import java.util.LinkedList;

/**
 *
 * @author Daniel Leese
 */
public class List {

    private LinkedList listJobs;
    private int jobId;
    private int clientId;
    private int workerId;
    private static List instance = null;

    public List() {
        listJobs = new LinkedList<SumUpJob>();
        jobId = 1;
        clientId = 1;
        workerId = 1;
    }

    public static List getInstnce() {
        if (instance == null) {
            instance = new List();
        }
        return instance;
    }

    public boolean isJobListEmty() {
        return listJobs.isEmpty();
    }

    public void insertJob(SumUpJob job) {
        listJobs.addLast(job);
    }

    public Object getNextObject() { // gibt das erste job-object in der liste zuruck und loscht es aus der liste.
        Object job = listJobs.getFirst();
        listJobs.removeFirst();
        return job;
    }

    public int getNextClientID() {
        return clientId++;
    }

    public int getNextWorkerID() {
        return workerId++;
    }

    public int getNextJobID() {
        return jobId++;
    }
}