Commits

Michael Ludwig committed ec97191

Update old test cases and add new tests for versions, ownership, and the new task api.

  • Participants
  • Parent commits 4932c97

Comments (0)

Files changed (10)

File src/test/java/com/lhkbob/entreri/AdvancedIteratorTest.java

     private int countWithFloat;
     private int countWithBoth;
 
-    private TypeId<ObjectComponent> objId;
-    private TypeId<FloatComponent> floatId;
-
     private ObjectComponent objData;
     private FloatComponent floatData;
 
     @Before
     public void setup() {
-        objId = TypeId.get(ObjectComponent.class);
-        floatId = TypeId.get(FloatComponent.class);
-
         entityIds = new ArrayList<Integer>();
         entityObjValues = new ArrayList<Object>();
         entityFloatValues = new ArrayList<Float>();
 
         system = new EntitySystem();
 
-        objData = system.createDataInstance(objId);
-        floatData = system.createDataInstance(floatId);
+        objData = system.createDataInstance(ObjectComponent.class);
+        floatData = system.createDataInstance(FloatComponent.class);
 
         for (int i = 0; i < ENTITY_COUNT; i++) {
             Entity e = system.addEntity();
             double c = Math.random();
             if (c > .8) {
                 // both components to add
-                objData.set(e.add(objId));
+                objData.set(e.add(ObjectComponent.class));
                 Object v = new Object();
                 entityObjValues.add(v);
                 entityCombinedObjValues.add(v);
                 objData.setObject(v);
 
-                floatData.set(e.add(floatId));
+                floatData.set(e.add(FloatComponent.class));
                 float fv = (float) (Math.random() * 1000);
                 entityFloatValues.add(fv);
                 entityCombinedFloatValues.add(fv);
                 countWithFloat++;
             } else if (c > .4) {
                 // just float component
-                floatData.set(e.add(floatId));
+                floatData.set(e.add(FloatComponent.class));
                 float fv = (float) (Math.random() * 1000);
                 entityFloatValues.add(fv);
                 floatData.setFloat(fv);
                 countWithFloat++;
             } else {
                 // just object component
-                objData.set(e.add(objId));
+                objData.set(e.add(ObjectComponent.class));
                 Object v = new Object();
                 entityObjValues.add(v);
                 objData.setObject(v);

File src/test/java/com/lhkbob/entreri/ComponentDataTest.java

 
 public class ComponentDataTest {
     @Test
-    public void testInvalidComponentRemove() {
+    public void testIsValidComponentRemove() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
         IntComponent cd = c.getData();
 
         Assert.assertTrue(cd.isValid()); // sanity check
-        e.remove(TypeId.get(IntComponent.class));
+        e.remove(IntComponent.class);
         Assert.assertFalse(cd.isValid());
     }
 
     @Test
-    public void testInvalidEntityRemove() {
+    public void testIsValidEntityRemove() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
         IntComponent cd = c.getData();
 
         Assert.assertTrue(cd.isValid()); // sanity check
     }
 
     @Test
-    public void testInvalidCompact() {
+    public void testIsValidCompact() {
         EntitySystem system = new EntitySystem();
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
         Entity e3 = system.addEntity();
 
-        e1.add(TypeId.get(IntComponent.class)); // removed
-        e2.add(TypeId.get(IntComponent.class)); // will shift over
-        e3.add(TypeId.get(IntComponent.class)); // will shift over
-        IntComponent cd = e2.get(TypeId.get(IntComponent.class)).getData();
+        e1.add(IntComponent.class); // removed
+        e2.add(IntComponent.class); // will shift over
+        e3.add(IntComponent.class); // will shift over
+        IntComponent cd = e2.get(IntComponent.class).getData();
 
         Assert.assertTrue(cd.isValid()); // sanity check
 
-        e1.remove(TypeId.get(IntComponent.class));
+        e1.remove(IntComponent.class);
         system.compact(); // since e1's component was moved, this shifts e2
 
         Assert.assertFalse(cd.isValid());
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
         IntComponent cd = c.getData();
 
         Assert.assertTrue(cd.isValid()); // sanity check
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
 
-        e1.add(TypeId.get(IntComponent.class));
-        e2.add(TypeId.get(IntComponent.class));
-        IntComponent cd = e2.get(TypeId.get(IntComponent.class)).getData();
+        e1.add(IntComponent.class);
+        e2.add(IntComponent.class);
+        IntComponent cd = e2.get(IntComponent.class).getData();
 
         Assert.assertTrue(cd.isValid()); // sanity check
         system.compact(); // no changes
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
 
-        IntComponent cd = system.createDataInstance(TypeId.get(IntComponent.class));
+        IntComponent cd = system.createDataInstance(IntComponent.class);
         Assert.assertFalse(cd.isValid());
         Assert.assertTrue(cd.set(c));
         Assert.assertTrue(cd.isValid());
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
-        IntComponent cd = system.createDataInstance(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
+        IntComponent cd = system.createDataInstance(IntComponent.class);
 
-        e.remove(TypeId.get(IntComponent.class));
+        e.remove(IntComponent.class);
 
         Assert.assertFalse(cd.set(c));
         Assert.assertFalse(cd.isValid());
         Assert.assertFalse(cd.set(null));
         Assert.assertFalse(cd.isValid());
 
-        cd.set(e.add(TypeId.get(IntComponent.class)));
+        cd.set(e.add(IntComponent.class));
         Assert.assertTrue(cd.isValid());
     }
 
         // must test both public set() and default setFast()
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        Component<OnSetComponent> c = e.add(TypeId.get(OnSetComponent.class));
-        OnSetComponent cd = system.createDataInstance(TypeId.get(OnSetComponent.class));
+        Component<OnSetComponent> c = e.add(OnSetComponent.class);
+        OnSetComponent cd = system.createDataInstance(OnSetComponent.class);
 
         // sanity checks (onset gets called once during initialization)
         Assert.assertEquals(0, cd.onsetIndex);
         Assert.assertEquals(cd.getIndex(), cd.onsetIndex);
         Assert.assertTrue(cd.onsetCalled);
     }
+
+    @Test
+    public void testInitialVersion() {
+        EntitySystem system = new EntitySystem();
+
+        Entity e = system.addEntity();
+        Assert.assertEquals(0, e.add(IntComponent.class).getData().getVersion());
+        // ensure that overrides properly set it too
+        Assert.assertEquals(0, e.add(IntComponent.class).getData().getVersion());
+    }
+
+    @Test
+    public void testVersionUpdate() {
+        EntitySystem system = new EntitySystem();
+        Entity e = system.addEntity();
+        IntComponent cd = e.add(IntComponent.class).getData();
+
+        Assert.assertEquals(0, cd.getVersion());
+        cd.updateVersion();
+        Assert.assertEquals(1, cd.getVersion());
+    }
+
+    @Test
+    public void testGetIfModified() {
+        EntitySystem system = new EntitySystem();
+        Entity e = system.addEntity();
+
+        IntComponent cd = e.add(IntComponent.class).getData();
+        IntComponent access = system.createDataInstance(IntComponent.class);
+
+        Assert.assertEquals(0, cd.getVersion());
+        Assert.assertFalse(e.getIfModified(access, 0));
+
+        cd.updateVersion();
+        Assert.assertTrue(e.getIfModified(access, 0));
+    }
 }

File src/test/java/com/lhkbob/entreri/ComponentRepositoryTest.java

  */
 package com.lhkbob.entreri;
 
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Assert;
 import org.junit.Test;
 
     @Test
     public void testFactorySetValue() {
         EntitySystem system = new EntitySystem();
-        MultiPropertyComponent c = system.addEntity()
-                                         .add(TypeId.get(MultiPropertyComponent.class))
+        MultiPropertyComponent c = system.addEntity().add(MultiPropertyComponent.class)
                                          .getData();
         Assert.assertEquals(FloatPropertyFactory.DEFAULT, c.getFactoryFloat(), .0001f);
     }
     public void testDecorateProperty() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        IntComponent c = e.add(TypeId.get(IntComponent.class)).getData();
+        IntComponent c = e.add(IntComponent.class).getData();
 
-        FloatProperty decorated = system.decorate(TypeId.get(IntComponent.class),
+        FloatProperty decorated = system.decorate(IntComponent.class,
                                                   new FloatPropertyFactory());
         decorated.getIndexedData()[c.getIndex()] = 1f;
 
     public void testDecoratePropertyAddComponent() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        IntComponent c = e.add(TypeId.get(IntComponent.class)).getData();
+        IntComponent c = e.add(IntComponent.class).getData();
 
-        FloatProperty decorated = system.decorate(TypeId.get(IntComponent.class),
+        FloatProperty decorated = system.decorate(IntComponent.class,
                                                   new FloatPropertyFactory());
         decorated.getIndexedData()[c.getIndex()] = 1f;
 
         Entity e2 = system.addEntity();
-        IntComponent c2 = e2.add(TypeId.get(IntComponent.class)).getData();
+        IntComponent c2 = e2.add(IntComponent.class).getData();
         decorated.getIndexedData()[c2.getIndex()] = 2f;
 
         int count = 0;
         for (Entity entity : system) {
-            IntComponent c3 = entity.get(TypeId.get(IntComponent.class)).getData();
+            IntComponent c3 = entity.get(IntComponent.class).getData();
             count++;
 
             if (c3.getIndex() == c.getIndex()) {
     }
 
     @Test
-    public void testUndecorateValidProperty() {
+    @SuppressWarnings("unused")
+    public void testUndecorateValidProperty() throws Exception {
+        // This is an ugly ugly test case since it has to verify that the
+        // property gets garbage collected. The only way it can get at that
+        // is to use reflection to inspect the component repository
         EntitySystem system = new EntitySystem();
+        ComponentRepository<IntComponent> cr = system.getRepository(IntComponent.class);
+        int count = getDecoratedProperties(cr).size();
 
-        FloatProperty decorated = system.decorate(TypeId.get(IntComponent.class),
+        FloatProperty decorated = system.decorate(IntComponent.class,
                                                   new FloatPropertyFactory());
-        system.undecorate(TypeId.get(IntComponent.class), decorated);
+
+        Assert.assertEquals(count + 1, getDecoratedProperties(cr).size());
+
+        decorated = null;
+        System.gc();
+        Thread.sleep(100);
+
+        system.compact();
+
+        Assert.assertEquals(count, getDecoratedProperties(cr).size());
     }
 
-    @Test
-    public void testUndecorateInvalidProperty() {
-        FloatProperty prop = new FloatProperty();
-        EntitySystem system = new EntitySystem();
-        system.undecorate(TypeId.get(IntComponent.class), prop);
-        // should not fail
+    @SuppressWarnings("unchecked")
+    private static List<Property> getDecoratedProperties(ComponentRepository<?> cr) throws Exception {
+        Field decorated = ComponentRepository.class.getDeclaredField("decoratedProperties");
+        decorated.setAccessible(true);
+        List<?> value = (List<?>) decorated.get(cr);
+
+        List<Property> converted = new ArrayList<Property>();
+        for (Object o : value) {
+            Field ref = o.getClass().getDeclaredField("property");
+            ref.setAccessible(true);
+            converted.add(((WeakReference<? extends Property>) ref.get(o)).get());
+        }
+        return converted;
     }
 }

File src/test/java/com/lhkbob/entreri/ControllerManagerTest.java

-/*
- * Entreri, an entity-component framework in Java
- *
- * Copyright (c) 2012, Michael Ludwig
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- *     Redistributions of source code must retain the above copyright notice,
- *         this list of conditions and the following disclaimer.
- *     Redistributions in binary form must reproduce the above copyright notice,
- *         this list of conditions and the following disclaimer in the
- *         documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.lhkbob.entreri;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.lhkbob.entreri.component.IntComponent;
-import com.lhkbob.entreri.task.Task;
-import com.lhkbob.entreri.task.Result;
-import com.lhkbob.entreri.task.AbstractTask;
-import com.lhkbob.entreri.task.Scheduler.Phase;
-
-public class ControllerManagerTest {
-    @Test
-    public void testPreProcessPhase() {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process(Phase.PREPROCESS, 0);
-
-        Assert.assertTrue(controller.preprocessed);
-        Assert.assertFalse(controller.processed);
-        Assert.assertFalse(controller.postprocessed);
-    }
-
-    @Test
-    public void testProcessPhase() {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process(Phase.PROCESS, 0);
-
-        Assert.assertFalse(controller.preprocessed);
-        Assert.assertTrue(controller.processed);
-        Assert.assertFalse(controller.postprocessed);
-    }
-
-    @Test
-    public void testPostProcessPhase() {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process(Phase.POSTPROCESS, 0);
-
-        Assert.assertFalse(controller.preprocessed);
-        Assert.assertFalse(controller.processed);
-        Assert.assertTrue(controller.postprocessed);
-    }
-
-    @Test
-    public void testProcessAllPhase() {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process();
-
-        Assert.assertTrue(controller.preprocessed);
-        Assert.assertTrue(controller.processed);
-        Assert.assertTrue(controller.postprocessed);
-    }
-
-    @Test
-    public void testComputedDelta() throws Exception {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process();
-        // 1st process() uses a dt of 0
-        Assert.assertEquals(0.0, controller.dt, .0001);
-
-        Thread.sleep(10);
-
-        system.getControllerManager().process();
-        Assert.assertTrue(controller.preprocessed);
-        Assert.assertTrue(controller.processed);
-        Assert.assertTrue(controller.postprocessed);
-        // must be at least 10 ms, within 2 ms error either direction
-        Assert.assertTrue(controller.dt > .008);
-        Assert.assertTrue(controller.dt < .012);
-    }
-
-    @Test
-    public void testDeltaOverride() {
-        ControllerImpl controller = new ControllerImpl();
-        EntitySystem system = new EntitySystem();
-        system.getControllerManager().addController(controller);
-
-        system.getControllerManager().process(1f);
-
-        Assert.assertTrue(controller.preprocessed);
-        Assert.assertTrue(controller.processed);
-        Assert.assertTrue(controller.postprocessed);
-        Assert.assertEquals(1f, controller.dt, .0001);
-    }
-
-    @Test
-    public void testReportResult() {
-        doTestReportResult(new ResultImpl());
-    }
-
-    @Test
-    public void testReportMultipleResults() {
-        doTestReportResult(new ResultImpl(), new ResultImpl());
-    }
-
-    @Test
-    public void testReportSingletonResult() {
-        doTestReportResult(new SingletonResultImpl());
-    }
-
-    @Test
-    public void testReportMixedResults() {
-        doTestReportResult(new SingletonResultImpl(), new ResultImpl());
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void testReportMultipleSingletonResults() {
-        doTestReportResult(new SingletonResultImpl(), new SingletonResultImpl());
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void testReportOutOfPhase() {
-        Result result = new ResultImpl();
-
-        EntitySystem system = new EntitySystem();
-        ResultSupplyingController supplier = new ResultSupplyingController(result);
-        ControllerImpl receiver = new ControllerImpl();
-
-        system.getControllerManager().addController(supplier);
-        system.getControllerManager().addController(receiver);
-
-        system.getControllerManager().report(result);
-    }
-
-    @Test
-    public void testSingletonResultReset() {
-        Result result = new SingletonResultImpl();
-
-        EntitySystem system = new EntitySystem();
-        ResultSupplyingController supplier = new ResultSupplyingController(result);
-        ControllerImpl receiver = new ControllerImpl();
-
-        system.getControllerManager().addController(supplier);
-        system.getControllerManager().addController(receiver);
-
-        Assert.assertArrayEquals(new Result[] {result}, supplier.resultsToReport);
-        Assert.assertTrue(receiver.reportedResults.isEmpty());
-
-        // process twice
-        system.getControllerManager().process();
-        system.getControllerManager().process();
-
-        // result list should contain 2 elements to the same result
-        Assert.assertEquals(2, receiver.reportedResults.size());
-        Assert.assertSame(result, receiver.reportedResults.get(0));
-        Assert.assertSame(result, receiver.reportedResults.get(1));
-    }
-
-    private void doTestReportResult(Result... results) {
-        EntitySystem system = new EntitySystem();
-        ResultSupplyingController supplier = new ResultSupplyingController(results);
-        ControllerImpl receiver = new ControllerImpl();
-
-        system.getControllerManager().addController(supplier);
-        system.getControllerManager().addController(receiver);
-
-        Assert.assertArrayEquals(results, supplier.resultsToReport);
-        Assert.assertTrue(receiver.reportedResults.isEmpty());
-
-        system.getControllerManager().process();
-
-        Assert.assertEquals(Arrays.asList(results), receiver.reportedResults);
-    }
-
-    @Test
-    public void testControllerAddRemoveListener() {
-        EntitySystem system = new EntitySystem();
-        ControllerImpl ctrl = new ControllerImpl();
-
-        system.getControllerManager().addController(ctrl);
-        Assert.assertTrue(ctrl.added);
-        system.getControllerManager().removeController(ctrl);
-        Assert.assertTrue(ctrl.removed);
-    }
-
-    @Test
-    public void testEntityAddRemoveListener() {
-        EntitySystem system = new EntitySystem();
-        ControllerImpl ctrl = new ControllerImpl();
-        system.getControllerManager().addController(ctrl);
-
-        Entity e = system.addEntity();
-        Assert.assertEquals(e, ctrl.lastAddedEntity);
-        system.removeEntity(e);
-        Assert.assertTrue(e == ctrl.lastRemovedEntity);
-    }
-
-    @Test
-    public void testComponentAddRemoveListener() {
-        EntitySystem system = new EntitySystem();
-        ControllerImpl ctrl = new ControllerImpl();
-        system.getControllerManager().addController(ctrl);
-
-        Entity e = system.addEntity();
-        Component<IntComponent> i = e.add(TypeId.get(IntComponent.class));
-
-        Assert.assertEquals(i, ctrl.lastAddedComponent);
-        e.remove(TypeId.get(IntComponent.class));
-        Assert.assertTrue(i == ctrl.lastRemovedComponent);
-    }
-
-    private static class ResultSupplyingController extends AbstractTask {
-        private final Result[] resultsToReport;
-
-        public ResultSupplyingController(Result... results) {
-            resultsToReport = results;
-        }
-
-        @Override
-        public void process(double dt) {
-            for (Result r : resultsToReport) {
-                getEntitySystem().getControllerManager().report(r);
-            }
-        }
-    }
-
-    private static class ResultImpl implements Result {
-        @Override
-        public boolean isSingleton() {
-            return false;
-        }
-    }
-
-    private static class SingletonResultImpl implements Result {
-        @Override
-        public boolean isSingleton() {
-            return true;
-        }
-    }
-
-    // explicitly not a listener
-    private static class ControllerImpl implements Task {
-        private boolean preprocessed;
-        private boolean processed;
-        private boolean postprocessed;
-
-        private double dt;
-
-        private boolean added;
-        private boolean removed;
-
-        private Entity lastAddedEntity;
-        private Entity lastRemovedEntity;
-
-        private Component<?> lastAddedComponent;
-        private Component<?> lastRemovedComponent;
-
-        private EntitySystem system;
-
-        private final List<Result> reportedResults = new ArrayList<Result>();
-
-        @Override
-        public void report(Result result) {
-            reportedResults.add(result);
-        }
-
-        @Override
-        public EntitySystem getEntitySystem() {
-            return system;
-        }
-
-        @Override
-        public void preProcess(double dt) {
-            preprocessed = true;
-            this.dt = dt;
-        }
-
-        @Override
-        public void process(double dt) {
-            processed = true;
-            this.dt = dt;
-        }
-
-        @Override
-        public void postProcess(double dt) {
-            postprocessed = true;
-            this.dt = dt;
-        }
-
-        @Override
-        public void init(EntitySystem system) {
-            added = true;
-        }
-
-        @Override
-        public void destroy() {
-            removed = true;
-        }
-
-        @Override
-        public void onEntityAdd(Entity e) {
-            lastAddedEntity = e;
-        }
-
-        @Override
-        public void onEntityRemove(Entity e) {
-            lastRemovedEntity = e;
-        }
-
-        @Override
-        public void onComponentAdd(Component<?> c) {
-            lastAddedComponent = c;
-        }
-
-        @Override
-        public void onComponentRemove(Component<?> c) {
-            lastRemovedComponent = c;
-        }
-    }
-}

File src/test/java/com/lhkbob/entreri/EntityTest.java

         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
 
         c.getData().setInt(1);
         Assert.assertEquals(1, c.getData().getInt());
 
-        Assert.assertEquals(c, e.get(TypeId.get(IntComponent.class)));
-        Assert.assertEquals(1, e.get(TypeId.get(IntComponent.class)).getData().getInt());
+        Assert.assertEquals(c, e.get(IntComponent.class));
+        Assert.assertEquals(1, e.get(IntComponent.class).getData().getInt());
 
-        Assert.assertTrue(e.remove(TypeId.get(IntComponent.class)));
+        Assert.assertTrue(e.remove(IntComponent.class));
 
-        Assert.assertNull(e.get(TypeId.get(IntComponent.class)));
-        Assert.assertNull(e.get(TypeId.get(FloatComponent.class)));
+        Assert.assertNull(e.get(IntComponent.class));
+        Assert.assertNull(e.get(FloatComponent.class));
 
         Assert.assertFalse(c.isLive());
-        Assert.assertFalse(e.get(system.createDataInstance(TypeId.get(IntComponent.class))));
+        Assert.assertFalse(e.get(system.createDataInstance(IntComponent.class)));
     }
 
     @Test
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
-        Component<IntComponent> c2 = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
+        Component<IntComponent> c2 = e.add(IntComponent.class);
 
         Assert.assertNotSame(c, c2);
         Assert.assertFalse(c.isLive());
         Assert.assertTrue(c2.isLive());
-        Assert.assertSame(c2, e.get(TypeId.get(IntComponent.class)));
+        Assert.assertSame(c2, e.get(IntComponent.class));
     }
 
     @Test
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
         c.getData().setInt(2);
 
         int count = 0;
         for (Entity e2 : system) {
             Assert.assertSame(e, e2);
-            Assert.assertSame(c, e2.get(TypeId.get(IntComponent.class)));
-            Assert.assertEquals(2, e2.get(TypeId.get(IntComponent.class)).getData()
-                                     .getInt());
+            Assert.assertSame(c, e2.get(IntComponent.class));
+            Assert.assertEquals(2, e2.get(IntComponent.class).getData().getInt());
             count++;
         }
 
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
 
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
         c.setEnabled(false);
 
-        Assert.assertNull(e.get(TypeId.get(IntComponent.class)));
-        Assert.assertSame(c, e.get(TypeId.get(IntComponent.class), true));
+        Assert.assertNull(e.get(IntComponent.class));
+        Assert.assertSame(c, e.get(IntComponent.class, true));
 
         // test removing a disabled component
-        Assert.assertTrue(e.remove(TypeId.get(IntComponent.class)));
+        Assert.assertTrue(e.remove(IntComponent.class));
     }
 
     @Test
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
 
-        IntComponent data = system.createDataInstance(TypeId.get(IntComponent.class));
+        IntComponent data = system.createDataInstance(IntComponent.class);
 
-        Assert.assertTrue(data.set(e1.add(TypeId.get(IntComponent.class))));
+        Assert.assertTrue(data.set(e1.add(IntComponent.class)));
         data.setInt(1);
 
-        Assert.assertTrue(data.set(e2.add(TypeId.get(IntComponent.class))));
+        Assert.assertTrue(data.set(e2.add(IntComponent.class)));
         data.setInt(2);
 
         Assert.assertTrue(e1.get(data));
         Assert.assertEquals(2, data.getInt());
 
         // now test disabled'ness
-        e1.get(TypeId.get(IntComponent.class)).setEnabled(false);
+        e1.get(IntComponent.class).setEnabled(false);
         Assert.assertFalse(e1.get(data));
         Assert.assertTrue(data.isValid());
         Assert.assertFalse(data.isEnabled());
     public void testIterateComponents() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        Component<IntComponent> ic = e.add(TypeId.get(IntComponent.class));
-        Component<FloatComponent> fc = e.add(TypeId.get(FloatComponent.class));
+        Component<IntComponent> ic = e.add(IntComponent.class);
+        Component<FloatComponent> fc = e.add(FloatComponent.class);
 
-        e.add(TypeId.get(ObjectComponent.class)).setEnabled(false);
+        e.add(ObjectComponent.class).setEnabled(false);
 
         boolean intFound = false;
         boolean floatFound = false;
     public void testIterateDisabledComponents() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        Component<IntComponent> ic = e.add(TypeId.get(IntComponent.class));
-        Component<FloatComponent> fc = e.add(TypeId.get(FloatComponent.class));
+        Component<IntComponent> ic = e.add(IntComponent.class);
+        Component<FloatComponent> fc = e.add(FloatComponent.class);
 
-        Component<ObjectComponent> oc = e.add(TypeId.get(ObjectComponent.class));
+        Component<ObjectComponent> oc = e.add(ObjectComponent.class);
         oc.setEnabled(false);
 
         boolean intFound = false;
     public void testIterateRemoveComponent() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        Component<IntComponent> ic = e.add(TypeId.get(IntComponent.class));
-        Component<FloatComponent> fc = e.add(TypeId.get(FloatComponent.class));
+        Component<IntComponent> ic = e.add(IntComponent.class);
+        Component<FloatComponent> fc = e.add(FloatComponent.class);
 
         Iterator<Component<?>> it = e.iterator();
         while (it.hasNext()) {
             Component<?> c = it.next();
-            if (c.getTypeId() == TypeId.get(IntComponent.class)) {
+            if (c.getType().equals(IntComponent.class)) {
                 Assert.assertSame(ic, c);
                 it.remove();
 
             }
         }
 
-        Assert.assertNull(e.get(TypeId.get(IntComponent.class)));
-        Assert.assertNotNull(e.get(TypeId.get(FloatComponent.class)));
+        Assert.assertNull(e.get(IntComponent.class));
+        Assert.assertNotNull(e.get(FloatComponent.class));
         Assert.assertFalse(ic.isLive());
-        Assert.assertFalse(e.get(system.createDataInstance(TypeId.get(IntComponent.class))));
+        Assert.assertFalse(e.get(system.createDataInstance(IntComponent.class)));
     }
 }

File src/test/java/com/lhkbob/entreri/IteratorTest.java

     @Test
     public void testDisabledComponents() {
         EntitySystem system = new EntitySystem();
-        IntComponent cd = system.createDataInstance(TypeId.get(IntComponent.class));
+        IntComponent cd = system.createDataInstance(IntComponent.class);
 
         Entity e1 = system.addEntity();
-        e1.add(TypeId.get(IntComponent.class)).setEnabled(true);
+        e1.add(IntComponent.class).setEnabled(true);
         Entity e2 = system.addEntity();
-        e2.add(TypeId.get(IntComponent.class)).setEnabled(false);
+        e2.add(IntComponent.class).setEnabled(false);
 
         ComponentIterator it = new ComponentIterator(system);
         it.addRequired(cd);
     @Test
     public void testIgnoreEnabledComponents() {
         EntitySystem system = new EntitySystem();
-        IntComponent cd = system.createDataInstance(TypeId.get(IntComponent.class));
+        IntComponent cd = system.createDataInstance(IntComponent.class);
 
         Entity e1 = system.addEntity();
-        e1.add(TypeId.get(IntComponent.class)).setEnabled(true);
+        e1.add(IntComponent.class).setEnabled(true);
         Entity e2 = system.addEntity();
-        e2.add(TypeId.get(IntComponent.class)).setEnabled(false);
+        e2.add(IntComponent.class).setEnabled(false);
 
         ComponentIterator it = new ComponentIterator(system);
         it.addRequired(cd).setIgnoreEnabled(true).reset();

File src/test/java/com/lhkbob/entreri/OwnershipTest.java

+package com.lhkbob.entreri;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import com.lhkbob.entreri.component.FloatComponent;
+import com.lhkbob.entreri.component.IntComponent;
+
+public class OwnershipTest {
+
+    @Test
+    public void testEntitySetOwner() {
+        EntitySystem system = new EntitySystem();
+
+        Entity e1 = system.addEntity();
+        Entity e2 = system.addEntity();
+
+        Assert.assertNull(e1.getOwner());
+        Assert.assertNull(e2.getOwner());
+
+        e1.setOwner(e2);
+
+        Assert.assertSame(e2, e1.getOwner());
+        Assert.assertNull(e2.getOwner());
+
+        Component<IntComponent> c2 = e2.add(IntComponent.class);
+        e1.setOwner(c2);
+
+        Assert.assertSame(c2, e1.getOwner());
+    }
+
+    @Test
+    public void testComponentSetOwner() {
+        EntitySystem system = new EntitySystem();
+
+        Entity e1 = system.addEntity();
+        Entity e2 = system.addEntity();
+
+        Component<IntComponent> c1a = e1.add(IntComponent.class);
+        Component<FloatComponent> c1b = e1.add(FloatComponent.class);
+
+        Assert.assertNull(c1a.getOwner());
+        Assert.assertNull(c1b.getOwner());
+
+        c1a.setOwner(c1b);
+
+        Assert.assertSame(c1b, c1a.getOwner());
+        Assert.assertNull(c1b.getOwner());
+
+        c1a.setOwner(e2);
+
+        Assert.assertSame(e2, c1a.getOwner());
+    }
+
+    @Test
+    public void testOwnedEntityRemoval() {
+        EntitySystem system = new EntitySystem();
+        Entity e1 = system.addEntity();
+
+        final boolean[] revoked = new boolean[1];
+
+        e1.setOwner(new Owner() {
+            @Override
+            public void notifyOwnershipGranted(Ownable obj) {}
+
+            @Override
+            public void notifyOwnershipRevoked(Ownable obj) {
+                revoked[0] = true;
+            }
+        });
+
+        system.removeEntity(e1);
+        Assert.assertTrue(revoked[0]);
+    }
+
+    @Test
+    public void testOwnedComponentRemoval() {
+        EntitySystem system = new EntitySystem();
+        Entity e1 = system.addEntity();
+        Component<IntComponent> c1 = e1.add(IntComponent.class);
+
+        final boolean[] revoked = new boolean[1];
+
+        c1.setOwner(new Owner() {
+            @Override
+            public void notifyOwnershipGranted(Ownable obj) {}
+
+            @Override
+            public void notifyOwnershipRevoked(Ownable obj) {
+                revoked[0] = true;
+            }
+        });
+
+        e1.remove(IntComponent.class);
+        Assert.assertTrue(revoked[0]);
+    }
+
+    @Test
+    public void testOwnedComponentAdd() {
+        EntitySystem system = new EntitySystem();
+        Entity e1 = system.addEntity();
+
+        Component<IntComponent> c1 = e1.add(IntComponent.class);
+
+        final boolean[] revoked = new boolean[1];
+
+        c1.setOwner(new Owner() {
+            @Override
+            public void notifyOwnershipGranted(Ownable obj) {}
+
+            @Override
+            public void notifyOwnershipRevoked(Ownable obj) {
+                revoked[0] = true;
+            }
+        });
+
+        Component<IntComponent> c2 = e1.add(IntComponent.class);
+        Assert.assertTrue(revoked[0]);
+        Assert.assertNull(c2.getOwner());
+    }
+
+    @Test
+    public void testEntityRemovalCleanup() {
+        EntitySystem system = new EntitySystem();
+
+        Entity owner = system.addEntity();
+
+        Entity spare = system.addEntity();
+        Component<IntComponent> ownedC = spare.add(IntComponent.class);
+        ownedC.setOwner(owner);
+
+        Entity ownedE = system.addEntity();
+        ownedE.setOwner(owner);
+
+        system.removeEntity(owner);
+        Assert.assertFalse(ownedC.isLive());
+        Assert.assertFalse(ownedE.isLive());
+        Assert.assertTrue(spare.isLive());
+    }
+
+    @Test
+    public void testComponentRemovalCleanup() {
+        EntitySystem system = new EntitySystem();
+
+        Entity e1 = system.addEntity();
+
+        Component<IntComponent> owner = e1.add(IntComponent.class);
+        Component<FloatComponent> ownedC = e1.add(FloatComponent.class);
+        ownedC.setOwner(owner);
+
+        Entity ownedE = system.addEntity();
+        ownedE.setOwner(owner);
+
+        e1.remove(IntComponent.class);
+        Assert.assertFalse(ownedC.isLive());
+        Assert.assertFalse(ownedE.isLive());
+    }
+
+    @Test
+    public void testComplexOwnershipHierarchyCleanup() {
+        EntitySystem system = new EntitySystem();
+
+        Entity e1 = system.addEntity();
+        Component<IntComponent> c1 = e1.add(IntComponent.class);
+
+        Entity e2 = system.addEntity();
+        Component<IntComponent> c2 = e2.add(IntComponent.class);
+
+        Entity e3 = system.addEntity();
+        Component<IntComponent> c3 = e3.add(IntComponent.class);
+
+        e1.setOwner(e2);
+        e2.setOwner(e3);
+        e3.setOwner(c1);
+        c1.setOwner(c2);
+        c2.setOwner(c3);
+
+        e3.remove(IntComponent.class);
+
+        Assert.assertFalse(e1.isLive());
+        Assert.assertFalse(e2.isLive());
+        Assert.assertFalse(e3.isLive());
+        Assert.assertFalse(c1.isLive());
+        Assert.assertFalse(c2.isLive());
+        Assert.assertFalse(c3.isLive());
+    }
+
+    @Test
+    public void testComponentOwningParentEntityRemoval() {
+        EntitySystem system = new EntitySystem();
+        Entity e = system.addEntity();
+        Component<IntComponent> c = e.add(IntComponent.class);
+
+        e.setOwner(c);
+
+        system.removeEntity(e);
+        Assert.assertFalse(e.isLive());
+        Assert.assertFalse(c.isLive());
+    }
+}

File src/test/java/com/lhkbob/entreri/ReflectionComponentDataFactoryTest.java

 
     @Test
     public void testUnmanagedField() {
-        TypeId<UnmanagedFieldComponent> id = TypeId.get(UnmanagedFieldComponent.class);
-
         EntitySystem system = new EntitySystem();
         for (int i = 0; i < 4; i++) {
-            UnmanagedFieldComponent c = system.addEntity().add(id).getData();
+            UnmanagedFieldComponent c = system.addEntity()
+                                              .add(UnmanagedFieldComponent.class)
+                                              .getData();
             c.setObject(i);
             c.setFloat(i);
         }
 
-        UnmanagedFieldComponent c = system.createDataInstance(id);
+        UnmanagedFieldComponent c = system.createDataInstance(UnmanagedFieldComponent.class);
         for (Entity e : system) {
             Assert.assertTrue(e.get(c));
             float f = c.getFloat();

File src/test/java/com/lhkbob/entreri/SchedulerTest.java

+package com.lhkbob.entreri;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.lhkbob.entreri.task.Job;
+import com.lhkbob.entreri.task.Result;
+import com.lhkbob.entreri.task.Task;
+
+// NOTE: this does not test the thread-safety aspects of a job, because
+// it's a little too difficult to right a unit test for that
+public class SchedulerTest {
+    @Test
+    public void testResultsReportedToFutureTasksOnly() {
+        EntitySystem system = new EntitySystem();
+
+        ResultReportingTask t1 = new ResultReportingTask(null,
+                                                         new ResultA(),
+                                                         new ResultA(),
+                                                         new ResultB());
+        ResultAListeningTask t2 = new ResultAListeningTask(null);
+        ResultBListeningTask t3 = new ResultBListeningTask(null);
+        AllResultListeningTask t4 = new AllResultListeningTask(null);
+
+        // note the reordering of the tasks, t1 doesn't report results until after
+        // t2 and t3 are already run
+        Job j = system.getScheduler().createJob("test", t2, t3, t1, t4);
+
+        j.run();
+        Assert.assertEquals(0, t2.aReceiveCount);
+        Assert.assertEquals(0, t3.bReceiveCount);
+        Assert.assertEquals(2, t4.aReceiveCount);
+        Assert.assertEquals(1, t4.bReceiveCount);
+        Assert.assertEquals(3, t4.receiveCount);
+
+        // run the job a second time to make sure resubmitting results doesn't
+        // screw anything up after a reset
+        j.run();
+        Assert.assertEquals(0, t2.aReceiveCount);
+        Assert.assertEquals(0, t3.bReceiveCount);
+        Assert.assertEquals(2, t4.aReceiveCount);
+        Assert.assertEquals(1, t4.bReceiveCount);
+        Assert.assertEquals(3, t4.receiveCount);
+    }
+
+    @Test
+    public void testPostProcessTasksInvoked() {
+        EntitySystem system = new EntitySystem();
+
+        BasicTask t1 = new BasicTask(null);
+        BasicTask t2 = new BasicTask(t1);
+        BasicTask t3 = new BasicTask(t2);
+
+        Job j = system.getScheduler().createJob("test", t3);
+        j.run();
+
+        Assert.assertTrue(t1.invoked);
+        Assert.assertTrue(t2.invoked);
+        Assert.assertTrue(t3.invoked);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testMultipleSingletonResultsReported() {
+        EntitySystem system = new EntitySystem();
+
+        ResultReportingTask t1 = new ResultReportingTask(null,
+                                                         new ResultA(),
+                                                         new ResultB(),
+                                                         new ResultB());
+
+        Job j = system.getScheduler().createJob("test", t1);
+        j.run();
+    }
+
+    @Test
+    public void testResultsReported() {
+        EntitySystem system = new EntitySystem();
+
+        ResultReportingTask t1 = new ResultReportingTask(null,
+                                                         new ResultA(),
+                                                         new ResultA(),
+                                                         new ResultB());
+        ResultAListeningTask t2 = new ResultAListeningTask(null);
+        ResultBListeningTask t3 = new ResultBListeningTask(null);
+        AllResultListeningTask t4 = new AllResultListeningTask(null);
+
+        Job j = system.getScheduler().createJob("test", t1, t2, t3, t4);
+
+        j.run();
+        Assert.assertEquals(2, t2.aReceiveCount);
+        Assert.assertEquals(1, t3.bReceiveCount);
+        Assert.assertEquals(2, t4.aReceiveCount);
+        Assert.assertEquals(1, t4.bReceiveCount);
+        Assert.assertEquals(3, t4.receiveCount);
+
+        // run the job a second time to make sure resubmitting results doesn't
+        // screw anything up after a reset
+        j.run();
+        Assert.assertEquals(2, t2.aReceiveCount);
+        Assert.assertEquals(1, t3.bReceiveCount);
+        Assert.assertEquals(2, t4.aReceiveCount);
+        Assert.assertEquals(1, t4.bReceiveCount);
+        Assert.assertEquals(3, t4.receiveCount);
+    }
+
+    @Test
+    public void testResetInvoked() {
+        EntitySystem system = new EntitySystem();
+
+        BasicTask t1 = new BasicTask(null);
+        Job j = system.getScheduler().createJob("test", t1);
+        j.run();
+
+        Assert.assertTrue(t1.invoked);
+        Assert.assertTrue(t1.reset);
+    }
+
+    private static class ResultA extends Result {
+        @Override
+        public boolean isSingleton() {
+            return false;
+        }
+    }
+
+    private static class ResultB extends Result {
+        @Override
+        public boolean isSingleton() {
+            return true;
+        }
+    }
+
+    private static class BasicTask implements Task {
+        boolean invoked;
+        boolean reset;
+
+        final BasicTask postProcess;
+
+        public BasicTask(BasicTask postProcess) {
+            this.postProcess = postProcess;
+        }
+
+        @Override
+        public Task process(EntitySystem system, Job job) {
+            invoked = true;
+            return postProcess;
+        }
+
+        @Override
+        public void reset() {
+            reset = true;
+        }
+    }
+
+    private static class ResultReportingTask extends BasicTask {
+        private final Result[] toReport;
+
+        public ResultReportingTask(BasicTask postProcess, Result... results) {
+            super(postProcess);
+            toReport = results;
+        }
+
+        @Override
+        public Task process(EntitySystem system, Job job) {
+            for (Result r : toReport) {
+                job.report(r);
+            }
+            return super.process(system, job);
+        }
+    }
+
+    private static class ResultAListeningTask extends BasicTask {
+        int aReceiveCount;
+
+        public ResultAListeningTask(BasicTask parent) {
+            super(parent);
+            aReceiveCount = 0;
+        }
+
+        @Override
+        public void reset() {
+            aReceiveCount = 0;
+            super.reset();
+        }
+
+        @SuppressWarnings("unused")
+        public void report(ResultA r) {
+            aReceiveCount++;
+        }
+    }
+
+    private static class ResultBListeningTask extends BasicTask {
+        int bReceiveCount;
+
+        public ResultBListeningTask(BasicTask parent) {
+            super(parent);
+            bReceiveCount = 0;
+        }
+
+        @Override
+        public void reset() {
+            bReceiveCount = 0;
+            super.reset();
+        }
+
+        @SuppressWarnings("unused")
+        public void report(ResultB r) {
+            bReceiveCount++;
+        }
+    }
+
+    private static class AllResultListeningTask extends BasicTask {
+        int aReceiveCount;
+        int bReceiveCount;
+        int receiveCount;
+
+        public AllResultListeningTask(BasicTask parent) {
+            super(parent);
+        }
+
+        @Override
+        public void reset() {
+            aReceiveCount = 0;
+            bReceiveCount = 0;
+            receiveCount = 0;
+            super.reset();
+        }
+
+        @SuppressWarnings("unused")
+        public void report(Result r) {
+            receiveCount++;
+        }
+
+        @SuppressWarnings("unused")
+        public void report(ResultA r) {
+            aReceiveCount++;
+        }
+
+        @SuppressWarnings("unused")
+        public void report(ResultB r) {
+            bReceiveCount++;
+        }
+    }
+}

File src/test/java/com/lhkbob/entreri/SystemTest.java

     @Test
     public void testCustomFactory() {
         EntitySystem system = new EntitySystem();
-        system.setFactory(TypeId.get(CustomFactoryComponent.class), new CustomFactory());
+        system.setFactory(CustomFactoryComponent.class, new CustomFactory());
 
         // the default reflection factory will fail to create an instance
         // because the property is public. If it is created, and it's not null
         // we know the custom factory worked
-        CustomFactoryComponent cd = system.createDataInstance(TypeId.get(CustomFactoryComponent.class));
+        CustomFactoryComponent cd = system.createDataInstance(CustomFactoryComponent.class);
         Assert.assertNotNull(cd.prop);
     }
 
         // the default reflection factory will fail to create an instance
         // because the property is public. If it is created, and it's not null
         // we know the custom factory worked
-        DefaultFactoryComponent cd = system.createDataInstance(TypeId.get(DefaultFactoryComponent.class));
+        DefaultFactoryComponent cd = system.createDataInstance(DefaultFactoryComponent.class);
         Assert.assertNotNull(cd.prop);
     }
 
         EntitySystem system = new EntitySystem();
         Entity template = system.addEntity();
 
-        Component<IntComponent> tc1 = template.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> tc1 = template.add(IntComponent.class);
         tc1.getData().setInt(2);
-        Component<FloatComponent> tc2 = template.add(TypeId.get(FloatComponent.class));
+        Component<FloatComponent> tc2 = template.add(FloatComponent.class);
         tc2.getData().setFloat(3f);
 
         Entity fromTemplate = system.addEntity(template);
-        Component<IntComponent> c1 = fromTemplate.get(TypeId.get(IntComponent.class));
-        Component<FloatComponent> c2 = fromTemplate.get(TypeId.get(FloatComponent.class));
+        Component<IntComponent> c1 = fromTemplate.get(IntComponent.class);
+        Component<FloatComponent> c2 = fromTemplate.get(FloatComponent.class);
 
         Assert.assertEquals(2, c1.getData().getInt());
         Assert.assertEquals(3f, c2.getData().getFloat(), .0001f);
     public void testRemoveEntity() {
         EntitySystem system = new EntitySystem();
         Entity e = system.addEntity();
-        Component<IntComponent> c = e.add(TypeId.get(IntComponent.class));
+        Component<IntComponent> c = e.add(IntComponent.class);
 
         system.removeEntity(e);
         Assert.assertFalse(e.isLive());
     public void testCompactNoOp() {
         EntitySystem system = new EntitySystem();
         for (int i = 0; i < 5; i++) {
-            system.addEntity().add(TypeId.get(MultiPropertyComponent.class));
+            system.addEntity().add(MultiPropertyComponent.class);
         }
 
         system.compact();
         Iterator<Entity> it = system.iterator();
         while (it.hasNext()) {
             Entity e = it.next();
-            Assert.assertNotNull(e.get(TypeId.get(MultiPropertyComponent.class))
-                                  .getData());
+            Assert.assertNotNull(e.get(MultiPropertyComponent.class).getData());
             count++;
         }
 
         for (int i = 0; i < 100; i++) {
             es.add(system.addEntity());
             MultiPropertyComponent c = es.get(es.size() - 1)
-                                         .add(TypeId.get(MultiPropertyComponent.class))
-                                         .getData();
+                                         .add(MultiPropertyComponent.class).getData();
             float f = (float) Math.random();
             float f2 = (float) Math.random();
             c.setFloat(f);
             Entity e = si.next();
             Assert.assertEquals(it.next(), e);
             Assert.assertEquals(ft.next().floatValue(),
-                                e.get(TypeId.get(MultiPropertyComponent.class)).getData()
-                                 .getFloat(), .0001f);
+                                e.get(MultiPropertyComponent.class).getData().getFloat(),
+                                .0001f);
             Assert.assertEquals(ft.next().floatValue(),
-                                e.get(TypeId.get(MultiPropertyComponent.class)).getData()
+                                e.get(MultiPropertyComponent.class).getData()
                                  .getFactoryFloat(), .0001f);
         }
         Assert.assertFalse(it.hasNext());
         for (int i = 0; i < 100; i++) {
             es.add(system.addEntity());
             MultiPropertyComponent c = es.get(es.size() - 1)
-                                         .add(TypeId.get(MultiPropertyComponent.class))
-                                         .getData();
+                                         .add(MultiPropertyComponent.class).getData();
             float f = (float) Math.random();
             float f2 = (float) Math.random();
             c.setFloat(f);
         while (it.hasNext()) {
             Entity e = it.next();
             if (i % 2 == 0) {
-                e.remove(TypeId.get(MultiPropertyComponent.class));
+                e.remove(MultiPropertyComponent.class);
             }
             i++;
         }
         Iterator<Float> ft = cs.iterator();
         while (it.hasNext()) {
             Entity e = it.next();
-            Component<MultiPropertyComponent> c = e.get(TypeId.get(MultiPropertyComponent.class));
+            Component<MultiPropertyComponent> c = e.get(MultiPropertyComponent.class);
 
             float f = ft.next();
             float f2 = ft.next();
 
             if (c == null) {
-                c = e.add(TypeId.get(MultiPropertyComponent.class));
+                c = e.add(MultiPropertyComponent.class);
                 c.getData().setFloat(f);
                 c.getData().setFactoryFloat(f2);
             }
             Entity e = si.next();
             Assert.assertEquals(it.next(), e);
             Assert.assertEquals(ft.next().floatValue(),
-                                e.get(TypeId.get(MultiPropertyComponent.class)).getData()
-                                 .getFloat(), .0001f);
+                                e.get(MultiPropertyComponent.class).getData().getFloat(),
+                                .0001f);
             Assert.assertEquals(ft.next().floatValue(),
-                                e.get(TypeId.get(MultiPropertyComponent.class)).getData()
+                                e.get(MultiPropertyComponent.class).getData()
                                  .getFactoryFloat(), .0001f);
         }
         Assert.assertFalse(it.hasNext());