Commits

Michael Ludwig committed 67b6fb6

Clean up source code to use Java 7's <> syntax.

  • Participants
  • Parent commits e3d4607

Comments (0)

Files changed (16)

File src/main/java/com/lhkbob/entreri/EntitySystem.java

  * When Entities are created by an EntitySystem, the created instance is assigned an ID
  * which represents its true identity.
  * <p/>
- * Use {@link #create()} to get a new instance of an EntitySystem.
+ * Use {@link Factory#create()} to get a new instance of an EntitySystem.
  *
  * @author Michael Ludwig
  * @see Entity
  * @see Component
  */
-public abstract class EntitySystem implements Iterable<Entity> {
-    /**
-     * Create a new EntitySystem using the default implementation with entreri
-     *
-     * @return A new, empty EntitySystem
-     */
-    public static EntitySystem create() {
-        return new EntitySystemImpl();
+public interface EntitySystem extends Iterable<Entity> {
+    public static class Factory {
+        /**
+         * Create a new EntitySystem using the default implementation with entreri
+         *
+         * @return A new, empty EntitySystem
+         */
+        public static EntitySystem create() {
+            return new EntitySystemImpl();
+        }
     }
 
     /**
      *
      * @throws NullPointerException if type is null
      */
-    public abstract <T extends Component> Collection<Class<? extends T>> getComponentTypes(
+    public <T extends Component> Collection<Class<? extends T>> getComponentTypes(
             Class<T> type);
 
     /**
      *
      * @return All TypeIds at one point used by this system
      */
-    public abstract Collection<Class<? extends Component>> getComponentTypes();
+    public Collection<Class<? extends Component>> getComponentTypes();
 
     /**
      * Return the Scheduler for this EntitySystem that can be used to organize processing
      *
      * @return The Scheduler for this system
      */
-    public abstract Scheduler getScheduler();
+    public Scheduler getScheduler();
 
     /**
      * Return an iterator over all of the entities within the system. The returned
      * @return An iterator over the entities of the system
      */
     @Override
-    public abstract Iterator<Entity> iterator();
+    public Iterator<Entity> iterator();
 
     /**
      * Return an iterator over all components of with the given type. The returned
      *
      * @return A fast iterator over components in this system
      */
-    public abstract <T extends Component> Iterator<T> iterator(Class<T> type);
+    public <T extends Component> Iterator<T> iterator(Class<T> type);
 
     /**
      * Return a new ComponentIterator that must be configured with required and optional
      *
      * @return A new iterator over the components in this system
      */
-    public abstract ComponentIterator fastIterator();
+    public ComponentIterator fastIterator();
 
     /**
      * <p/>
      * frame rate. As an example, on a test system with 20,000 entities compact() took
      * ~2ms on an Intel i5 processor. Of course, mileage may very.
      */
-    public abstract void compact();
+    public void compact();
 
     /**
      * Add a new Entity to this EntitySystem. The created Entity will not have any
      *
      * @return A new Entity in the system, without any components
      */
-    public abstract Entity addEntity();
+    public Entity addEntity();
 
     /**
      * <p/>
      *
      * @throws IllegalStateException if the template is not a live entity
      */
-    public abstract Entity addEntity(Entity template);
+    public Entity addEntity(Entity template);
 
     /**
      * <p/>
      * @throws IllegalArgumentException if the entity was not created by this system, or
      *                                  already removed
      */
-    public abstract void removeEntity(Entity e);
+    public void removeEntity(Entity e);
 
     /**
      * <p/>
      *
      * @throws NullPointerException if type or factory are null
      */
-    public abstract <T extends Component, P extends Property> P decorate(Class<T> type,
-                                                                         PropertyFactory<P> factory);
+    public <T extends Component, P extends Property> P decorate(Class<T> type,
+                                                                PropertyFactory<P> factory);
 }

File src/main/java/com/lhkbob/entreri/impl/ComponentFactoryProvider.java

             if (use15) {
                 sb.append("\n\t@Override");
             }
-            appendGetter(s, property, sb, use15);
+            appendGetter(s, property, sb);
             List<PropertyDeclaration> setterParams = setters.get(s.getSetterMethod());
             if (setterParams == null) {
                 setterParams = new ArrayList<>();
      * @param forProperty The property whose getter method will be defined
      * @param index       The index of the property in the overall spec
      * @param sb          The buffer to append to
-     * @param useGenerics True if the source can use generics, in which case
-     *                    ObjectProperties are properly parameterized
      */
     private static void appendGetter(PropertyDeclaration forProperty, int index,
-                                     StringBuilder sb, boolean useGenerics) {
+                                     StringBuilder sb) {
         // method signature
         sb.append("\n\tpublic ").append(forProperty.getType()).append(" ")
           .append(forProperty.getGetterMethod()).append("() {\n\t\t");

File src/main/java/com/lhkbob/entreri/impl/EntitySystemImpl.java

  *
  * @author Michael Ludwig
  */
-public final class EntitySystemImpl extends EntitySystem {
+public final class EntitySystemImpl implements EntitySystem {
     // converts valid component data types into indices into componentRepositories
     private final Map<Class<? extends Component>, Integer> typeIndexMap;
     private int typeIdSeq;
      * Create a new EntitySystem that has no entities added.
      */
     public EntitySystemImpl() {
-        typeIndexMap = new HashMap<Class<? extends Component>, Integer>();
+        typeIndexMap = new HashMap<>();
         typeIdSeq = 0;
 
         manager = new Scheduler(this);
             throw new NullPointerException("Type cannot be null");
         }
 
-        List<Class<? extends T>> ids = new ArrayList<Class<? extends T>>();
+        List<Class<? extends T>> ids = new ArrayList<>();
         for (int i = 0; i < componentRepositories.length; i++) {
             if (componentRepositories[i] != null) {
                 // check the type
 
     @Override
     public Collection<Class<? extends Component>> getComponentTypes() {
-        List<Class<? extends Component>> ids = new ArrayList<Class<? extends Component>>();
+        List<Class<? extends Component>> ids = new ArrayList<>();
         for (int i = 0; i < componentRepositories.length; i++) {
             if (componentRepositories[i] != null) {
                 ids.add(componentRepositories[i].getType());
 
     @Override
     public <T extends Component> Iterator<T> iterator(Class<T> type) {
-        return new ComponentIteratorWrapper<T>(type);
+        return new ComponentIteratorWrapper<>(type);
     }
 
     @Override
         ComponentRepository<T> i = (ComponentRepository<T>) componentRepositories[index];
         if (i == null) {
             // if the index does not exist, then we need to use the default component data factory
-            i = new ComponentRepository<T>(this, type);
+            i = new ComponentRepository<>(this, type);
             i.expandEntityIndex(entities.length);
             componentRepositories[index] = i;
         }

File src/main/java/com/lhkbob/entreri/impl/OwnerSupport.java

             throw new NullPointerException("Ownable cannot be null");
         }
         this.target = target;
-        ownedObjects = new HashSet<Ownable>();
+        ownedObjects = new HashSet<>();
         currentOwner = null;
     }
 

File src/main/java/com/lhkbob/entreri/impl/TypePropertyMapping.java

     private static final ConcurrentHashMap<Class<?>, Class<? extends Property>> typeMapping;
 
     static {
-        typeMapping = new ConcurrentHashMap<Class<?>, Class<? extends Property>>();
+        typeMapping = new ConcurrentHashMap<>();
 
         // default mapping for primitive types
         typeMapping.put(byte.class, ByteProperty.class);

File src/main/java/com/lhkbob/entreri/property/Attributes.java

 
 /**
  * Attributes represents the collection of attributes that have been provided on a
- * property declaration within a ComponentData definition. To work with {@link
- * ReflectionComponentDataFactory}, {@link PropertyFactory} implementations should have a
- * constructor that takes a single Attributes instance.
+ * property declaration within a ComponentData definition. To use attributes, {@link
+ * PropertyFactory} implementations should have a constructor that takes a single
+ * Attributes instance.
  *
  * @author Michael Ludwig
  * @see PropertyFactory
      * Construct a new set of attributes from the given annotations. Only annotations that
      * have the Attribute annotation are kept.
      *
-     * @param attrs
+     * @param attrs The annotations from the method, or field, etc.
      *
      * @throws NullPointerException if attrs is null or contains null elements
      */
         if (attrs == null) {
             throw new NullPointerException("Attributes cannot be null");
         }
-        this.attrs = new HashMap<Class<? extends Annotation>, Annotation>();
+        this.attrs = new HashMap<>();
 
         for (Annotation a : attrs) {
             if (a.annotationType().getAnnotation(Attribute.class) != null) {

File src/main/java/com/lhkbob/entreri/task/Job.java

         this.tasks = new Task[tasks.length];
         this.name = name;
 
-        singletonResults = new HashSet<Class<? extends Result>>();
-        resultMethods = new HashMap<Class<? extends Result>, List<ResultReporter>>();
+        singletonResults = new HashSet<>();
+        resultMethods = new HashMap<>();
         taskIndex = -1;
 
         boolean exclusive = false;
-        Set<Class<? extends Component>> typeLocks = new HashSet<Class<? extends Component>>();
+        Set<Class<? extends Component>> typeLocks = new HashSet<>();
         for (int i = 0; i < tasks.length; i++) {
             if (tasks[i] == null) {
                 throw new NullPointerException("Task cannot be null");
 
                         List<ResultReporter> all = resultMethods.get(type);
                         if (all == null) {
-                            all = new ArrayList<ResultReporter>();
+                            all = new ArrayList<>();
                             resultMethods.put(type, all);
                         }
 
             locks = null;
         } else {
             needsExclusiveLock = false;
-            locks = new ArrayList<Class<? extends Component>>(typeLocks);
+            locks = new ArrayList<>(typeLocks);
             // give locks a consistent ordering
             Collections.sort(locks, new Comparator<Class<? extends Component>>() {
                 @Override
             }
 
             // process all tasks and collect all returned tasks, in order
-            List<Task> postProcess = new ArrayList<Task>();
+            List<Task> postProcess = new ArrayList<>();
             for (int i = 0; i < tasks.length; i++) {
                 taskIndex = i;
                 Task after = tasks[i].process(scheduler.getEntitySystem(), this);
                 if (taskIndex > Job.this.taskIndex) {
                     reportMethod.invoke(Job.this.tasks[taskIndex], r);
                 }
-            } catch (IllegalArgumentException e) {
+            } catch (IllegalArgumentException | IllegalAccessException e) {
                 // shouldn't happen, since we check the type before invoking
                 throw new RuntimeException(e);
-            } catch (IllegalAccessException e) {
-                // shouldn't happen since we only use public methods
-                throw new RuntimeException(e);
             } catch (InvocationTargetException e) {
                 throw new RuntimeException("Error reporting result", e.getCause());
             }

File src/main/java/com/lhkbob/entreri/task/Scheduler.java

 
         schedulerGroup = new ThreadGroup("job-scheduler");
         exclusiveLock = new ReentrantReadWriteLock();
-        typeLocks = new ConcurrentHashMap<Class<? extends Component>, ReentrantLock>();
+        typeLocks = new ConcurrentHashMap<>();
     }
 
     /**

File src/main/java/com/lhkbob/entreri/task/SimpleTask.java

         }
     }
 
+    /**
+     * The default implementation of process() just invokes {@link
+     * #processEntities(com.lhkbob.entreri.EntitySystem)} immediately and returns no
+     * future task.
+     *
+     * @param system The EntitySystem being processed, which will always be the same for a
+     *               given Task instance
+     * @param job    The Job this task belongs to
+     *
+     * @return Will return null unless overridden
+     */
     @Override
     public Task process(EntitySystem system, Job job) {
         processEntities(system);

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

 
     @Before
     public void setup() {
-        entityIds = new ArrayList<Integer>();
-        entityObjValues = new ArrayList<ObjectComponent.FooBlah>();
-        entityFloatValues = new ArrayList<Float>();
-        entityCombinedObjValues = new ArrayList<ObjectComponent.FooBlah>();
-        entityCombinedFloatValues = new ArrayList<Float>();
+        entityIds = new ArrayList<>();
+        entityObjValues = new ArrayList<>();
+        entityFloatValues = new ArrayList<>();
+        entityCombinedObjValues = new ArrayList<>();
+        entityCombinedFloatValues = new ArrayList<>();
 
-        system = EntitySystem.create();
+        system = EntitySystem.Factory.create();
 
         for (int i = 0; i < ENTITY_COUNT; i++) {
             Entity e = system.addEntity();

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

 public class ComponentTest {
     @Test
     public void testIsAliveComponentRemove() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent c = e.add(IntComponent.class);
 
     @Test
     public void testIsAliveEntityRemove() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent c = e.add(IntComponent.class);
 
     @Test
     public void testIsAlivePostCompact() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
         Entity e3 = system.addEntity();
 
     @Test
     public void testNewlyAddedComponentState() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent c = e.add(IntComponent.class);
 
     @Test
     public void testIsAlivePostNoopCompact() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
 
 
     @Test
     public void testVersionUpdate() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent cd = e.add(IntComponent.class);
 
 
     @Test
     public void testAutomaticVersionUpdate() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent cd = e.add(IntComponent.class);
 
 
     @Test
     public void testUniqueVersionUpdate() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         IntComponent cd1 = system.addEntity().add(IntComponent.class);
         IntComponent cd2 = system.addEntity().add(IntComponent.class);
 
 
     @Test
     public void testInvalidComponentVersion() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent cd = e.add(IntComponent.class);
         e.remove(IntComponent.class);
 
     @Test
     public void testBeanMethodInvocation() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
         ComplexComponent c1 = e1.add(ComplexComponent.class);
 
 
     @Test
     public void testFlyweightIsAliveAfterRemoval() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         IntComponent c1 = system.addEntity().add(IntComponent.class);
         IntComponent c2 = system.addEntity().add(IntComponent.class);

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

     public void testAddEntity() {
         // There really isn't much to test with this one, everything else
         // is validated by other tests in this package
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         int componentCount = 0;
 
     @Test
     public void testAddEntityFromTemplate() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity template = system.addEntity();
 
         IntComponent tc1 = template.add(IntComponent.class);
 
     @Test
     public void testAddEntityFromTemplateInAnotherSystem() {
-        EntitySystem system1 = EntitySystem.create();
+        EntitySystem system1 = EntitySystem.Factory.create();
         Entity template = system1.addEntity();
 
         IntComponent tc1 = template.add(IntComponent.class);
         FloatComponent tc2 = template.add(FloatComponent.class);
         tc2.setFloat(3f);
 
-        EntitySystem system2 = EntitySystem.create();
+        EntitySystem system2 = EntitySystem.Factory.create();
         Entity fromTemplate = system2.addEntity(template);
         IntComponent c1 = fromTemplate.get(IntComponent.class);
         FloatComponent c2 = fromTemplate.get(FloatComponent.class);
 
     @Test
     public void testRemoveEntity() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent c = e.add(IntComponent.class);
 
 
     @Test
     public void testIteratorRemoveEntity() {
-        EntitySystem system = EntitySystem.create();
-        List<Entity> original = new ArrayList<Entity>();
+        EntitySystem system = EntitySystem.Factory.create();
+        List<Entity> original = new ArrayList<>();
 
-        List<Entity> removed = new ArrayList<Entity>();
+        List<Entity> removed = new ArrayList<>();
 
         for (int i = 0; i < 10; i++) {
             original.add(system.addEntity());
 
     @Test
     public void testIteratorExternalRemoveEntity() {
-        EntitySystem system = EntitySystem.create();
-        List<Entity> original = new ArrayList<Entity>();
+        EntitySystem system = EntitySystem.Factory.create();
+        List<Entity> original = new ArrayList<>();
 
-        List<Entity> removed = new ArrayList<Entity>();
+        List<Entity> removed = new ArrayList<>();
 
         for (int i = 0; i < 10; i++) {
             original.add(system.addEntity());
         }
 
-        Iterator<Entity> it = system.iterator();
-        while (it.hasNext()) {
-            Entity e = it.next();
+        for (Entity e : system) {
             removed.add(e);
             system.removeEntity(e);
         }
 
     @Test
     public void testCompactNoOp() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         for (int i = 0; i < 5; i++) {
             system.addEntity().add(ComplexComponent.class);
         }
         system.compact();
 
         int count = 0;
-        Iterator<Entity> it = system.iterator();
-        while (it.hasNext()) {
-            Entity e = it.next();
+        for (Entity e : system) {
             Assert.assertNotNull(e.get(ComplexComponent.class));
             count++;
         }
 
     @Test
     public void testCompactRepairRemoves() {
-        EntitySystem system = EntitySystem.create();
-        List<Entity> es = new ArrayList<Entity>();
-        List<Float> cs = new ArrayList<Float>();
+        EntitySystem system = EntitySystem.Factory.create();
+        List<Entity> es = new ArrayList<>();
+        List<Float> cs = new ArrayList<>();
         for (int i = 0; i < 100; i++) {
             es.add(system.addEntity());
             ComplexComponent c = es.get(es.size() - 1).add(ComplexComponent.class);
 
     @Test
     public void testCompactAddRemoveRepair() {
-        EntitySystem system = EntitySystem.create();
-        List<Entity> es = new ArrayList<Entity>();
-        List<Float> cs = new ArrayList<Float>();
+        EntitySystem system = EntitySystem.Factory.create();
+        List<Entity> es = new ArrayList<>();
+        List<Float> cs = new ArrayList<>();
         for (int i = 0; i < 100; i++) {
             es.add(system.addEntity());
             ComplexComponent c = es.get(es.size() - 1).add(ComplexComponent.class);

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

 public class EntityTest {
     @Test
     public void testGetEntitySystem() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         Assert.assertEquals(system, e.getEntitySystem());
 
     @Test
     public void testAddWithRequiredComponents() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         RequiresBComponent rb = e.add(RequiresBComponent.class);
 
     @Test
     public void testAddWithRequiredComponentsAlreadyPresent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent ci = e.add(IntComponent.class);
 
     @Test
     public void testAddRemoveComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent c = e.add(IntComponent.class);
 
     @Test
     public void testReAddComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         IntComponent c = e.add(IntComponent.class);
 
     @Test
     public void testGetComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         Assert.assertNull(e.get(IntComponent.class));
 
     @Test
     public void testHasComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         Assert.assertFalse(e.has(IntComponent.class));
 
     @Test
     public void testAsComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
 
         Assert.assertNull(e.get(IntComponent.class));
 
     @Test
     public void testIterateComponents() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent ic = e.add(IntComponent.class);
         FloatComponent fc = e.add(FloatComponent.class);
 
     @Test
     public void testIterateRemoveComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent ic = e.add(IntComponent.class);
         FloatComponent fc = e.add(FloatComponent.class);

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

 
     @Test
     public void testEntitySetOwner() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
 
     @Test
     public void testComponentSetOwner() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         Entity e1 = system.addEntity();
         Entity e2 = system.addEntity();
 
     @Test
     public void testOwnedEntityRemoval() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
 
         final boolean[] revoked = new boolean[1];
 
     @Test
     public void testOwnedComponentRemoval() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
         IntComponent c1 = e1.add(IntComponent.class);
 
 
     @Test
     public void testOwnedComponentAdd() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e1 = system.addEntity();
 
         IntComponent c1 = e1.add(IntComponent.class);
 
     @Test
     public void testEntityRemovalCleanup() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         Entity owner = system.addEntity();
 
 
     @Test
     public void testComponentRemovalCleanup() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         Entity e1 = system.addEntity();
 
 
     @Test
     public void testComplexOwnershipHierarchyCleanup() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         Entity e1 = system.addEntity();
         IntComponent c1 = e1.add(IntComponent.class);
 
     @Test
     public void testComponentOwningParentEntityRemoval() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent c = e.add(IntComponent.class);
 
 
     @Test
     public void testFlyweightComponentOwnership() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent c = e.add(IntComponent.class);
 

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

 public class SchedulerTest {
     @Test
     public void testResultsReportedToFutureTasksOnly() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         ResultReportingTask t1 = new ResultReportingTask(null, new ResultA(),
                                                          new ResultA(), new ResultB());
 
     @Test
     public void testPostProcessTasksInvoked() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         BasicTask t1 = new BasicTask(null);
         BasicTask t2 = new BasicTask(t1);
 
     @Test(expected = IllegalStateException.class)
     public void testMultipleSingletonResultsReported() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         ResultReportingTask t1 = new ResultReportingTask(null, new ResultA(),
                                                          new ResultB(), new ResultB());
 
     @Test
     public void testResultsReported() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         ResultReportingTask t1 = new ResultReportingTask(null, new ResultA(),
                                                          new ResultA(), new ResultB());
 
     @Test
     public void testResetInvoked() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
 
         BasicTask t1 = new BasicTask(null);
         Job j = system.getScheduler().createJob("test", t1);

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

 public class ComponentRepositoryTest {
     @Test
     public void testFactorySetValue() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         ComplexComponent c = system.addEntity().add(ComplexComponent.class);
         Assert.assertEquals(FloatPropertyFactory.DEFAULT, c.getFactoryFloat(), .0001f);
     }
 
     @Test
     public void testDecorateProperty() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent c = e.add(IntComponent.class);
 
 
     @Test
     public void testDecoratePropertyAddComponent() {
-        EntitySystem system = EntitySystem.create();
+        EntitySystem system = EntitySystem.Factory.create();
         Entity e = system.addEntity();
         IntComponent c = e.add(IntComponent.class);
 
     }
 
     @Test
-    @SuppressWarnings("unused")
+    @SuppressWarnings({ "unused", "UnusedAssignment" })
     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
-        EntitySystemImpl system = (EntitySystemImpl) EntitySystem.create();
+        EntitySystemImpl system = (EntitySystemImpl) EntitySystem.Factory.create();
         ComponentRepository<IntComponent> cr = system.getRepository(IntComponent.class);
         int count = getDecoratedProperties(cr).size();
 
         decorated.setAccessible(true);
         List<?> value = (List<?>) decorated.get(cr);
 
-        List<Property> converted = new ArrayList<Property>();
+        List<Property> converted = new ArrayList<>();
         for (Object o : value) {
             Field ref = o.getClass().getDeclaredField("property");
             ref.setAccessible(true);