Back to project page Station42.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.station42.base; /* ww w. j av a 2 s.c om*/ import java.util.Collection; import java.util.HashMap; import com.station42.player.move.EntityMoveState; public class Entity { public final String name; public Entity(String name) { this.name = name; } HashMap<Class<?>, Object> components = new HashMap<Class<?>, Object>(); public int id; public Entity(String name, Object... components) { this(name); for (Object component : components) { this.components.put(component.getClass(), component); } } public <T> T getComponent(Class<? extends T> componentType) { return (T) components.get(componentType); } public <T> void setComponent(Class<? extends T> componentType, T component) { components.put(componentType, component); } public Collection<Object> getComponents() { return components.values(); } }