//
//
//  Generated by StarUML(tm) Java Add-In
//
//  @ Project : Untitled
//  @ File Name : Fabrique.java
//  @ Date : 20/01/2008
//  @ Author : 
//
//



package Gestion;

import java.util.ArrayList;


public class Fabrique {
	public int nextID = 1;
	public ArrayList<Documents.Element> documents;
	private static Fabrique INSTANCE  = null;
        
        private Fabrique() {
            this.documents = new ArrayList<Documents.Element>();
        }
	public static Fabrique getInstance() {
            if(INSTANCE == null) {
                INSTANCE = new Fabrique(); }
            return INSTANCE;
	}
	
	public Documents.Element getElement(int ref) {
            return documents.get(ref-1);
	}
	
	public Documents.Texte CreateElem(String text, String auteur) {
            int oldID = this.nextID;
            this.nextID++;
            Documents.Texte txt = new Documents.Texte(oldID,text,auteur);
            this.documents.add(txt);
            return txt;
	}
	
	public Documents.Figure CreateElem( int haut, int larg, String legende) {
            int oldID = this.nextID;
            this.nextID++;
            Documents.Figure fig = new Documents.Figure(oldID,haut,larg,legende);
            this.documents.add(fig);
            return fig;
	}
	
	public Documents.Section CreateElem( String titre) {
            int oldID = this.nextID;
            this.nextID++;
            Documents.Section sec =  new Documents.Section(oldID,titre); 
            this.documents.add(sec);
            return sec;
	}
        public void ajouterElem(Documents.Element e) {
            this.documents.add(e);
        }
}
