package ro.ase.cts.flyweight;

import java.awt.event.KeyListener;
import java.util.HashMap;

import ro.ase.cts.modele.Model3D;
import ro.ase.cts.modele.NavaFederatie;
import ro.ase.cts.modele.NavaKlingoniana;

public class FlyweightFactory {
	
	//colectia de modele 3D
	HashMap<TipModelNava,Model3D> modele = 
			new HashMap<>();
	
	public Model3D getModelNava(TipModelNava tip)
	{
		Model3D nava = modele.get(tip);
		if(nava == null){
			switch(tip){
			case FEDERATIE:
				nava = new NavaFederatie();
				modele.put(tip, nava);
				break;
			case KLINGON:
				nava = new NavaKlingoniana();
				modele.put(tip, nava);
				break;
			}
		}
		return nava;
	}
			
}
