package electrosphere.entity;

import electrosphere.main.Globals;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author amaterasu
 */
public class Entity {
    
    
    
    
    static int entity_id_iterator = 0;
    
    int id;
    
    HashMap<String,Object> data;
    
    LinkedList<String> dataKeys;

    
    
    public int getId() {
        return id;
    }
    
    public void setId(int id){
        this.id = id;
    }

//    HashMap<String, Object> getData() {
//        return data;
//    }
    
    public void putData(String key, Object o){
        data.put(key,o);
        dataKeys.add(key);
    }
    
    public List<String> getDataKeys(){
        return dataKeys;
    }
    
    public Object getData(String key){
        return data.get(key);
    }
    
    public Entity(){
        data = new HashMap();
        dataKeys = new LinkedList();
        while(Globals.entityManager.getEntityFromId(entity_id_iterator)!=null){
            entity_id_iterator++;
        }
        id = entity_id_iterator;
        entity_id_iterator++;
    }
    
    public void removeData(String key){
        data.remove(key);
    }
}
