Michael Ludwig avatar Michael Ludwig committed aede426

Improve JavaDoc and Java code formatting for IntelliJ

Comments (0)

Files changed (82)

-
 syntax: regexp
 ^\.project$
 syntax: regexp
 syntax: regexp
 ^\.settings$
 syntax: regexp
-^target$
+^target$
+syntax: regexp
+^\.idea$
+syntax: regexp
+^.*\.iml$
+syntax: regexp
+^.DS_Store$
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.lhkbob.entreri</groupId>
     <artifactId>entreri</artifactId>
     <version>1.6.1-SNAPSHOT</version>
 
     <name>Entreri Entity-Component Framework</name>
-    <description>Entreri is an entity-component framework for Java that helps manage or remove complex OO hierarchies that often form when developing games. For a useful description of an entity-component framework, see http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/</description>
+    <description>Entreri is an entity-component framework for Java that helps manage or
+        remove complex OO hierarchies that often form when developing games. For a useful
+        description of an entity-component framework, see
+        http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/
+    </description>
     <url>http://entreri.lhkbob.com</url>
 
     <parent>
 
     <scm>
         <connection>scm:hg:http://bitbucket.org/mludwig/entreri</connection>
-        <developerConnection>scm:hg:https://bitbucket.org/mludwig/entreri</developerConnection>
+        <developerConnection>scm:hg:https://bitbucket.org/mludwig/entreri
+        </developerConnection>
         <url>http://bitbucket.org/mludwig/entreri</url>
     </scm>
 

src/main/java/com/lhkbob/entreri/Attribute.java

  */
 package com.lhkbob.entreri;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
 import com.lhkbob.entreri.property.IntProperty;
 import com.lhkbob.entreri.property.IntProperty.DefaultInt;
 
+import java.lang.annotation.*;
+
 /**
- * Attribute is used to declare that other annotation types are 'attributes' of
- * a Property declaration in a ComponentData type definition. They can then be
- * accessed by custom {@link PropertyFactory factories} to configure the
- * specific property. Examples include describing cloning behavior and default
- * values.
- * 
+ * Attribute is used to declare that other annotation types are 'attributes' of a Property
+ * declaration in a ComponentData type definition. They can then be accessed by custom
+ * {@link PropertyFactory factories} to configure the specific property. Examples include
+ * describing cloning behavior and default values.
+ *
+ * @author Michael Ludwig
  * @see IntProperty.Factory
  * @see DefaultInt
- * @author Michael Ludwig
- * 
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.ANNOTATION_TYPE)
-public @interface Attribute {}
+public @interface Attribute {
+}

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

 import java.util.Map;
 
 /**
- * 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.
- * 
+ * 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.
+ *
+ * @author Michael Ludwig
  * @see PropertyFactory
- * @author Michael Ludwig
- * 
  */
 public class Attributes {
     private final Map<Class<? extends Annotation>, Annotation> attrs;
 
     /**
-     * Construct a new set of attributes from the given annotations. Only
-     * annotations that have the Attribute annotation are kept.
-     * 
+     * Construct a new set of attributes from the given annotations. Only annotations that
+     * have the Attribute annotation are kept.
+     *
      * @param attrs
+     *
      * @throws NullPointerException if attrs is null or contains null elements
      */
     public Attributes(Annotation... attrs) {
     }
 
     /**
-     * Create a new Attributes that collects all annotations that have been
-     * annotated with {@link Attribute} on the given field.
-     * 
+     * Create a new Attributes that collects all annotations that have been annotated with
+     * {@link Attribute} on the given field.
+     *
      * @param f The field to build the set of attributes from
+     *
      * @throws NullPointerException if f is null
      */
     public Attributes(Field f) {
     }
 
     /**
-     * Get the attribute annotation of type T. If there is no attribute for the
-     * given type, then null is returned.
-     * 
+     * Get the attribute annotation of type T. If there is no attribute for the given
+     * type, then null is returned.
+     *
      * @param cls The attribute annotation class type
+     *
      * @return The associated attribute instance
      */
     @SuppressWarnings("unchecked")
     }
 
     /**
-     * Get whether or not this set of attributes has an attribute of the given
-     * type. If an attribute does not have any variables, this is sufficient
-     * instead of getting the actual instance.
-     * 
+     * Get whether or not this set of attributes has an attribute of the given type. If an
+     * attribute does not have any variables, this is sufficient instead of getting the
+     * actual instance.
+     *
      * @param cls The annotation class type
+     *
      * @return True if the associated attribute exists
      */
     public boolean hasAttribute(Class<? extends Annotation> cls) {

src/main/java/com/lhkbob/entreri/Component.java

 package com.lhkbob.entreri;
 
 /**
- * <p>
- * Component represents a grouping of reusable and related states that are added
- * to an {@link Entity}. The specific state of a component is stored and defined
- * in {@link ComponentData} implementations. This separation is to support fast
- * iteration over blocks of packed, managed memory. All of the component data is
- * packed into buffers or arrays for cache locality. A single ComponentData
- * instance can then be used to access multiple Components.
- * </p>
- * <p>
- * Component instances represent the identity of the conceptual components,
- * while instances of ComponentData can be configured to read and write to
- * specific components. ComponentData's can change which component they
- * reference multiple times throughout their life time.
- * </p>
- * <p>
- * Component implements both {@link Ownable} and {@link Owner}. This can be used
- * to create hierarchies of both components and entities that share a lifetime.
- * When a component is removed from an entity, all of its owned objects are
- * disowned. If any of them were entities or components, they are also removed
- * from the system.
- * </p>
- * 
+ * <p/>
+ * Component represents a grouping of reusable and related states that are added to an
+ * {@link Entity}. The specific state of a component is stored and defined in {@link
+ * ComponentData} implementations. This separation is to support fast iteration over
+ * blocks of packed, managed memory. All of the component data is packed into buffers or
+ * arrays for cache locality. A single ComponentData instance can then be used to access
+ * multiple Components.
+ * <p/>
+ * Component instances represent the identity of the conceptual components, while
+ * instances of ComponentData can be configured to read and write to specific components.
+ * ComponentData's can change which component they reference multiple times throughout
+ * their life time.
+ * <p/>
+ * Component implements both {@link Ownable} and {@link Owner}. This can be used to create
+ * hierarchies of both components and entities that share a lifetime. When a component is
+ * removed from an entity, all of its owned objects are disowned. If any of them were
+ * entities or components, they are also removed from the system.
+ *
+ * @param <T> The ComponentData type defining the data of this component
+ *
  * @author Michael Ludwig
- * @param <T> The ComponentData type defining the data of this component
  */
 public final class Component<T extends ComponentData<T>> implements Ownable, Owner {
     private final ComponentRepository<T> owner;
     int index;
 
     /**
-     * Create a new Component stored in the given ComponentRepository, at the
-     * given array position within the ComponentRepository.
-     * 
+     * Create a new Component stored in the given ComponentRepository, at the given array
+     * position within the ComponentRepository.
+     *
      * @param owner The ComponentRepository owner
      * @param index The index within the owner
      */
     }
 
     /**
-     * Get a ComponentData instance that can be used to manipulate the state of
-     * this component. This is a convenience for allocating a new ComponentData
-     * instance and assigning it to this component. For tight loops, it is
-     * better to allocate a single ComponentData instance and use its
-     * {@link ComponentData#set(Component) set} method.
-     * 
-     * @return A ComponentData to access this component's state, or null if the
-     *         component is not live
+     * Get a ComponentData instance that can be used to manipulate the state of this
+     * component. This is a convenience for allocating a new ComponentData instance and
+     * assigning it to this component. For tight loops, it is better to allocate a single
+     * ComponentData instance and use its {@link ComponentData#set(Component) set}
+     * method.
+     *
+     * @return A ComponentData to access this component's state, or null if the component
+     *         is not live
      */
     public T getData() {
         T data = getEntitySystem().createDataInstance(getType());
     }
 
     /**
-     * @return True if the component is still attached to an entity in the
-     *         entity system, or false if it or its entity has been removed
+     * @return True if the component is still attached to an entity in the entity system,
+     *         or false if it or its entity has been removed
      */
     public boolean isLive() {
         return index != 0;
     }
 
     /**
-     * Return true if this component is enabled, or false if it is disabled and
-     * will appear as though it doesn't exist under default behavior. False is
-     * always returned if the component is not live.
-     * 
+     * Return true if this component is enabled, or false if it is disabled and will
+     * appear as though it doesn't exist under default behavior. False is always returned
+     * if the component is not live.
+     *
      * @return True if enabled
      */
     public boolean isEnabled() {
     }
 
     /**
-     * <p>
-     * Set whether or not this component is enabled. If a component is disabled,
-     * default usage will cause it to appear as the component has been removed.
-     * It will not be returned from {@link Entity#get(TypeId)} or be included in
-     * iterator results using {@link ComponentIterator}.
-     * </p>
-     * <p>
-     * Disabling and enabling components can be a more efficient way to simulate
-     * the adding and removing of components, because it does not remove or
-     * require the allocation of new data.
-     * </p>
-     * 
+     * <p/>
+     * Set whether or not this component is enabled. If a component is disabled, default
+     * usage will cause it to appear as the component has been removed. It will not be
+     * returned from {@link Entity#get(Class)} or be included in iterator results using
+     * {@link ComponentIterator}.
+     * <p/>
+     * Disabling and enabling components can be a more efficient way to simulate the
+     * adding and removing of components, because it does not remove or require the
+     * allocation of new data.
+     *
      * @param enable True if the component is to be enabled
      */
     public void setEnabled(boolean enable) {
     }
 
     /**
-     * Get the entity that this component is attached to. If the component has
-     * been removed from the entity, or is otherwise not live, this will return
-     * null.
-     * 
+     * Get the entity that this component is attached to. If the component has been
+     * removed from the entity, or is otherwise not live, this will return null.
+     *
      * @return The owning entity, or null
      */
     public Entity getEntity() {
     }
 
     /**
-     * Get the underlying index of this component used to access its properties.
-     * In most cases you can just use {@link ComponentData#getIndex()} because
-     * you'll have a ComponentData instance on hand. However, it can be useful
-     * to use this method to access decorated data to avoid setting the
-     * component data to a particular component just to get its index.
-     * 
+     * Get the underlying index of this component used to access its properties. In most
+     * cases you can just use {@link ComponentData#getIndex()} because you'll have a
+     * ComponentData instance on hand. However, it can be useful to use this method to
+     * access decorated data to avoid setting the component data to a particular component
+     * just to get its index.
+     *
      * @return The current index of component
      */
     public int getIndex() {
         } else {
             int entityId = owner.getEntitySystem()
                                 .getEntityByIndex(owner.getEntityIndex(index)).getId();
-            return "Component(" + getType().getSimpleName() + ", entity=" + entityId + ")";
+            return "Component(" + getType().getSimpleName() + ", entity=" + entityId +
+                   ")";
         }
     }
 }

src/main/java/com/lhkbob/entreri/ComponentData.java

 package com.lhkbob.entreri;
 
 /**
- * <p>
- * ComponentData is used to define types of components that can be added to
- * entities. For performance reasons, the identity of a component is represented
- * by instances of {@link Component}. ComponentData instances are used as views
- * into the data of the components. This allows multiple instances to have their
- * data packed together in primitive arrays or direct memory, allowing for
- * significantly faster iteration.
- * </p>
- * <p>
- * Additionally, by using a single ComponentData instance during the iteration,
- * there is no need to follow the usual object references needed for each
- * instance.
- * </p>
- * <p>
- * ComponentData's are defined like any other class, but they are intended to be
- * created and configured by a {@link ComponentDataFactory}. These factories may
- * impose certain restrictions or requirements in what constructors or fields
- * are valid. ComponentData implementations can define a default
- * ComponentDataFactory type with the {@link DefaultFactory} annotation. By
- * default ComponentData implementations are created using The
- * {@link ReflectionComponentDataFactory}
- * </p>
- * 
+ * <p/>
+ * ComponentData is used to define types of components that can be added to entities. For
+ * performance reasons, the identity of a component is represented by instances of {@link
+ * Component}. ComponentData instances are used as views into the data of the components.
+ * This allows multiple instances to have their data packed together in primitive arrays
+ * or direct memory, allowing for significantly faster iteration.
+ * <p/>
+ * <p/>
+ * Additionally, by using a single ComponentData instance during the iteration, there is
+ * no need to follow the usual object references needed for each instance.
+ * <p/>
+ * <p/>
+ * ComponentData's are defined like any other class, but they are intended to be created
+ * and configured by a {@link ComponentDataFactory}. These factories may impose certain
+ * restrictions or requirements in what constructors or fields are valid. ComponentData
+ * implementations can define a default ComponentDataFactory type with the {@link
+ * DefaultFactory} annotation. By default ComponentData implementations are created using
+ * The {@link ReflectionComponentDataFactory}
+ *
+ * @param <T> The self-referencing type of the ComponentData
+ *
  * @author Michael Ludwig
- * @param <T> The self-referencing type of the ComponentData
  */
 public abstract class ComponentData<T extends ComponentData<T>> {
     private int id;
     // to simplify implementation constructor requirements.
     ComponentRepository<T> owner;
 
-    protected ComponentData() {}
+    protected ComponentData() {
+    }
 
     /**
      * Get the Entity that owns this ComponentData. This is a convenience for
-     * <code>getComponent().getEntity()</code>. This should not be invoked if
-     * {@link #isValid()} returns false.
-     * 
+     * <code>getComponent().getEntity()</code>. This should not be invoked if {@link
+     * #isValid()} returns false.
+     *
      * @return The owning Entity
      */
     public final Entity getEntity() {
     }
 
     /**
-     * Return the index of this ComponentData within the IndexedDataStores that
-     * back the defined properties of a ComponentData. A ComponentData's index
-     * will change as calls to {@link #set(Component)} are made.
-     * 
+     * Return the index of this ComponentData within the IndexedDataStores that back the
+     * defined properties of a ComponentData. A ComponentData's index will change as calls
+     * to {@link #set(Component)} are made.
+     *
      * @return The index of the component used to access its IndexedDataStores.
      */
     public final int getIndex() {
     }
 
     /**
-     * <p>
-     * Return whether or not this ComponentData is still attached to the last
-     * Component passed into {@link #set(Component)}, and that that component is
-     * still live.
-     * </p>
-     * <p>
-     * It is possible for a ComponentData's component to be invalidated
-     * underneath it. This happens if the component or its owning entity is
-     * removed from the system, or if the entity system is
-     * {@link EntitySystem#compact() compacted}. Since this library is meant to
-     * be single-threaded (or externally synchronized), this should be
+     * <p/>
+     * Return whether or not this ComponentData is still attached to the last Component
+     * passed into {@link #set(Component)}, and that that component is still live.
+     * <p/>
+     * It is possible for a ComponentData's component to be invalidated underneath it.
+     * This happens if the component or its owning entity is removed from the system, or
+     * if the entity system is {@link EntitySystem#compact() compacted}. Since this
+     * library is meant to be single-threaded (or externally synchronized), this should be
      * predictable.
-     * </p>
-     * 
-     * @return True if this ComponentData is attached to the data of a Component
-     *         that is still live
+     *
+     * @return True if this ComponentData is attached to the data of a Component that is
+     *         still live
      */
     public final boolean isValid() {
         // we have to check the index of the ComponentData because the ComponentRepository
     }
 
     /**
-     * Return whether or not the component this data is attached to is enabled.
-     * This is an optimized shortcut for <code>getComponent().isEnabled()</code>
-     * 
+     * Return whether or not the component this data is attached to is enabled. This is an
+     * optimized shortcut for <code>getComponent().isEnabled()</code>
+     *
      * @return True if the component is enabled, false if disabled or invalid
      */
     public final boolean isEnabled() {
     }
 
     /**
-     * Set whether or not the component this data is attached to is enabled.
-     * This is an optimized shortcut for
-     * <code>getComponent().setEnabled(enable)</code>
-     * 
+     * Set whether or not the component this data is attached to is enabled. This is an
+     * optimized shortcut for <code>getComponent().setEnabled(enable)</code>
+     *
      * @param enable True if the component should be enabled
      */
     public final void setEnabled(boolean enable) {
     }
 
     /**
-     * <p>
-     * Get the current version of the data accessed by this ComponentData. When
-     * data is mutated by a ComponentData, implementations increment its
-     * associated component's version so comparing a previously cached version
-     * number can be used to determine when changes have been made.
-     * <p>
-     * Additionally, for a given component type, versions will be unique. Thus
-     * it is possible to identify when the components are replaced by new
-     * components as well.
-     * 
+     * <p/>
+     * Get the current version of the data accessed by this ComponentData. When data is
+     * mutated by a ComponentData, implementations increment its associated component's
+     * version so comparing a previously cached version number can be used to determine
+     * when changes have been made.
+     * <p/>
+     * Additionally, for a given component type, versions will be unique. Thus it is
+     * possible to identify when the components are replaced by new components as well.
+     *
      * @return The current version, or a negative number if the data is invalid
      */
     public final int getVersion() {
     }
 
     /**
-     * Increment the version of the component accessed by this instance. It is
-     * recommended for component data implementations to call this automatically
-     * from within their exposed mutators, but if necessary it can be invoked
-     * manually as well.
-     * 
+     * Increment the version of the component accessed by this instance. It is recommended
+     * for component data implementations to call this automatically from within their
+     * exposed mutators, but if necessary it can be invoked manually as well.
+     *
      * @see #getVersion()
      */
     public final void updateVersion() {
     }
 
     /**
-     * Return the Component that this data reads and writes to. If
-     * {@link #isValid()} returns false, the returned Component is undefined. It
-     * may be the proper component, another component in the system, or null, or
-     * throw an exception.
-     * 
+     * Return the Component that this data reads and writes to. If {@link #isValid()}
+     * returns false, the returned Component is undefined. It may be the proper component,
+     * another component in the system, or null, or throw an exception.
+     *
      * @return The component this data is attached to
      */
     public final Component<T> getComponent() {
     }
 
     /**
-     * <p>
-     * Set this ComponentData to read and write from the given Component. If the
-     * component reference is a non-null, live component, this ComponentData
-     * will be considered a valid ComponentData. While valid, its defined
-     * accessors and mutators will affect the property state of
-     * <tt>component</tt>.
-     * </p>
-     * <p>
-     * Invoking set() with another Component will shift this data to the new
-     * component, allowing it to mutate that.
-     * </p>
-     * <p>
-     * The ComponentData will remain valid until an action is taken that would
-     * invalidate the data or its component. At the moment, the only actions
-     * capable of this are removing the component or its entity from the system,
-     * or invoking {@link EntitySystem#compact()}.
-     * </p>
-     * 
+     * <p/>
+     * Set this ComponentData to read and write from the given Component. If the component
+     * reference is a non-null, live component, this ComponentData will be considered a
+     * valid ComponentData. While valid, its defined accessors and mutators will affect
+     * the property state of <tt>component</tt>.
+     * <p/>
+     * Invoking set() with another Component will shift this data to the new component,
+     * allowing it to mutate that.
+     * <p/>
+     * The ComponentData will remain valid until an action is taken that would invalidate
+     * the data or its component. At the moment, the only actions capable of this are
+     * removing the component or its entity from the system, or invoking {@link
+     * EntitySystem#compact()}.
+     *
      * @param component The component this data should point to
+     *
      * @return True if the data is now valid
-     * @throws IllegalArgumentException if component was not created by the same
-     *             entity system
+     *
+     * @throws IllegalArgumentException if component was not created by the same entity
+     *                                  system
      */
     public final boolean set(Component<T> component) {
         if (component == null) {
         } else {
             // we check repository since it is guaranteed type safe
             if (component.getRepository() != owner) {
-                throw new IllegalArgumentException("Component not created by expected EntitySystem");
+                throw new IllegalArgumentException(
+                        "Component not created by expected EntitySystem");
             }
 
             return setFast(component.index);
         } else {
             int entityId = owner.getEntitySystem()
                                 .getEntityByIndex(owner.getEntityIndex(index)).getId();
-            return "ComponentData(" + getClass().getSimpleName() + ", entity=" + entityId + ")";
+            return "ComponentData(" + getClass().getSimpleName() + ", entity=" +
+                   entityId + ")";
         }
     }
 
     /**
-     * Event hook called when this ComponentData is assigned to a valid
-     * component at the provided non-zero index.
-     * 
+     * Event hook called when this ComponentData is assigned to a valid component at the
+     * provided non-zero index.
+     *
      * @param index The new index
      */
     protected void onSet(int index) {
     }
 
     /**
-     * A slightly faster method that requires only an index to a component, and
-     * performs no validation. It also does not look up the component reference
-     * since it assumes it's valid. These are lazily done when needed.
-     * 
+     * A slightly faster method that requires only an index to a component, and performs
+     * no validation. It also does not look up the component reference since it assumes
+     * it's valid. These are lazily done when needed.
+     *
      * @param componentIndex The index of the component
+     *
      * @return True if the index is not 0
      */
     boolean setFast(int componentIndex) {

src/main/java/com/lhkbob/entreri/ComponentDataFactory.java

 import java.util.Set;
 
 /**
- * <p>
- * ComponentDataFactory is a factory interface used to create instances of
- * ComponentData to provide a flexible means to instantiate and configure
- * ComponentData's for a specific type of component. For most purposes, the
- * default {@link ReflectionComponentDataFactory} will be sufficient, unless the
- * conventions enforced by it are too restrictive.
- * </p>
- * <p>
- * The main purpose of the ComponentDataFactory is to act as the glue between
- * the set of Properties representing all of the components in a system, and the
- * ComponentData instances used to efficiently access their values in a clean
- * manner.
- * </p>
- * 
+ * <p/>
+ * ComponentDataFactory is a factory interface used to create instances of ComponentData
+ * to provide a flexible means to instantiate and configure ComponentData's for a specific
+ * type of component. For most purposes, the default {@link ReflectionComponentDataFactory}
+ * will be sufficient, unless the conventions enforced by it are too restrictive.
+ * <p/>
+ * The main purpose of the ComponentDataFactory is to act as the glue between the set of
+ * Properties representing all of the components in a system, and the ComponentData
+ * instances used to efficiently access their values in a clean manner.
+ *
+ * @param <T> The type of ComponentData created by the factory
+ *
  * @author Michael Ludwig
- * @param <T> The type of ComponentData created by the factory
  */
 public interface ComponentDataFactory<T extends ComponentData<T>> {
     /**
-     * <p>
-     * Return the named PropertyFactories that can be used to create all
-     * required Properties when configuring a new instance. The key of the map
-     * should be the same key that is specified when
-     * {@link #setProperty(ComponentData, Object, Property)} is called.
-     * </p>
-     * <p>
+     * <p/>
+     * Return the named PropertyFactories that can be used to create all required
+     * Properties when configuring a new instance. The key of the map should be the same
+     * key that is specified when {@link #setProperty(ComponentData, Object, Property)} is
+     * called.
+     * <p/>
      * An example of the keys might be the field names declared in the class.
-     * </p>
-     * 
+     *
      * @return The PropertyFactories created by this builder
      */
     public Map<?, PropertyFactory<?>> getPropertyFactories();
 
     /**
-     * Construct a new instance of T that has not been configured. This means it
-     * should not have any assigned properties, and to expect subsequent calls
-     * to {@link #setProperty(ComponentData, Object, Property)} to configure it.
-     * 
+     * Construct a new instance of T that has not been configured. This means it should
+     * not have any assigned properties, and to expect subsequent calls to {@link
+     * #setProperty(ComponentData, Object, Property)} to configure it.
+     *
      * @return A new instance
      */
     public T createInstance();
 
     /**
-     * Inject the given property into the instance, where the property is
-     * assumed to have been constructed by PropertyFactory from
-     * {@link #getPropertyFactories()} that is stored by <tt>key</tt>.
-     * 
+     * Inject the given property into the instance, where the property is assumed to have
+     * been constructed by PropertyFactory from {@link #getPropertyFactories()} that is
+     * stored by <tt>key</tt>.
+     *
      * @param instance The instance to configure
-     * @param key The key to the creating PropertyFactory or source of the
-     *            property
+     * @param key      The key to the creating PropertyFactory or source of the property
      * @param property The property instance to inject
+     *
      * @throws NullPointerException if any argument is null
      */
     public void setProperty(T instance, Object key, Property property);
 
     /**
-     * Get any additional component types that are required by the component
-     * type created by this factory instance. Most likely this will involve
-     * inspecting the type for a {@link Requires} annotation, but factory's
-     * might provide some other way of specifying or determining required
-     * component types.
-     * 
-     * @return The set of required component types, or empty if no other types
-     *         are required
+     * Get any additional component types that are required by the component type created
+     * by this factory instance. Most likely this will involve inspecting the type for a
+     * {@link Requires} annotation, but factory's might provide some other way of
+     * specifying or determining required component types.
+     *
+     * @return The set of required component types, or empty if no other types are
+     *         required
      */
     public Set<Class<? extends ComponentData<?>>> getRequiredComponentTypes();
 }

src/main/java/com/lhkbob/entreri/ComponentIterator.java

 import java.util.Iterator;
 
 /**
- * <p>
- * ComponentIterator is an {@link Iterator}-like class used for quickly
- * iterating over subsets of entities within an EntitySystem. Required and
- * optional ComponentData instances are added to it during initialization. These
- * then determine the constraints on the entities reported by the iterator.
- * ComponentIterator is reset-able, so the same instance can be reused for
- * multiple iterations.
- * </p>
- * <p>
- * The ComponentIterator will skip all entities that do not have components of
- * the required component types. This is very useful for Controllers because
- * they often have related component types that they want to fetch at the same
- * time. Optional ComponentData's will be updated if present, and will otherwise
- * be flagged as invalid.
- * </p>
- * <p>
- * The basic workflow for using a ComponentIterator is shown below. In the
- * example, the iterator is used to iterate over all entities that have both an
- * A and a B component, while optionally loading a C component if available.
- * 
+ * <p/>
+ * ComponentIterator is an {@link Iterator}-like class used for quickly iterating over
+ * subsets of entities within an EntitySystem. Required and optional ComponentData
+ * instances are added to it during initialization. These then determine the constraints
+ * on the entities reported by the iterator. ComponentIterator is reset-able, so the same
+ * instance can be reused for multiple iterations.
+ * <p/>
+ * The ComponentIterator will skip all entities that do not have components of the
+ * required component types. This is very useful for Controllers because they often have
+ * related component types that they want to fetch at the same time. Optional
+ * ComponentData's will be updated if present, and will otherwise be flagged as invalid.
+ * <p/>
+ * The basic workflow for using a ComponentIterator is shown below. In the example, the
+ * iterator is used to iterate over all entities that have both an A and a B component,
+ * while optionally loading a C component if available. <p/>
  * <pre>
  * // create ComponentData instances
  * A cdA = system.createDataInstance(TypeId.get(A.class));
  * B cdB = system.createDataInstance(TypeId.get(B.class));
  * C cdC = system.createDataInstance(TypeId.get(C.class));
- * 
+ *
  * // initialize iterator
  * ComponentIterator it = new ComponentIterator(system);
  * it.addRequired(cdA).addRequired(cdB).addOptional(cdC);
  * it.reset(); // not actually required for first iteration
- * 
+ *
  * // iterate
  * while(it.next()) {
  *    // cdA and cdB are both assigned to components of type A and B on the same
  *    }
  * }
  * </pre>
- * 
- * </p>
- * 
+ * <p/>
+ *
  * @author Michael Ludwig
  */
 public class ComponentIterator {
     private ComponentData<?> primary;
 
     /**
-     * Create a new ComponentIterator that will iterate over components or
-     * entities within the given EntitySystem. It will have no attached required
-     * or optional ComponentDatas.
-     * 
+     * Create a new ComponentIterator that will iterate over components or entities within
+     * the given EntitySystem. It will have no attached required or optional
+     * ComponentDatas.
+     *
      * @param system The EntitySystem of the iterator
+     *
      * @throws NullPointerException if system is null
      */
     public ComponentIterator(EntitySystem system) {
     }
 
     /**
-     * Set whether or not the enabled status of a component is ignored. If true,
-     * disabled components will be considered by this iterator. If false,
-     * disabled components will act as though they don't exist. This is
-     * equivalent to {@link Entity#get(TypeId, boolean)}.
-     * 
+     * Set whether or not the enabled status of a component is ignored. If true, disabled
+     * components will be considered by this iterator. If false, disabled components will
+     * act as though they don't exist. This is equivalent to {@link Entity#get(Class,
+     * boolean)}.
+     *
      * @param e The enable flag to set
+     *
      * @return This iterator for chaining purposes
      */
     public ComponentIterator setIgnoreEnabled(boolean e) {
     }
 
     /**
-     * Add the given ComponentData instance as a required component type for
-     * this iterator. Besides implicitly specifying the required type, the
-     * provided instance will be set to each component of that type during
-     * iteration. Thus it is recommended to hold onto instance for later use.
-     * 
-     * @param data The ComponentData that is used to access the required
-     *            component type data of its type
+     * Add the given ComponentData instance as a required component type for this
+     * iterator. Besides implicitly specifying the required type, the provided instance
+     * will be set to each component of that type during iteration. Thus it is recommended
+     * to hold onto instance for later use.
+     *
+     * @param data The ComponentData that is used to access the required component type
+     *             data of its type
+     *
      * @return This iterator to chain
-     * @throws NullPointerException if data is null
-     * @throws IllegalArgumentException if data was not created by the
-     *             EntitySystem of this iterator
+     *
+     * @throws NullPointerException     if data is null
+     * @throws IllegalArgumentException if data was not created by the EntitySystem of
+     *                                  this iterator
      */
     public ComponentIterator addRequired(ComponentData<?> data) {
         if (data == null) {
             throw new NullPointerException("ComponentData cannot be null");
         }
         if (data.owner.getEntitySystem() != system) {
-            throw new IllegalArgumentException("ComponentData not created by correct EntitySystem");
+            throw new IllegalArgumentException(
+                    "ComponentData not created by correct EntitySystem");
         }
 
         // check to see if the data should be the new primary
             // putting one data into the required array
             required = Arrays.copyOf(required, required.length + 1);
 
-            if (data.owner.getMaxComponentIndex() < primary.owner.getMaxComponentIndex()) {
+            if (data.owner.getMaxComponentIndex() <
+                primary.owner.getMaxComponentIndex()) {
                 // new primary
                 required[required.length - 1] = primary;
                 primary = data;
     }
 
     /**
-     * <p>
-     * Add the given ComponentData instance as an optional component type for
-     * this iterator. Besides implicitly specifying the required type, the
-     * provided instance will be set to each component of that type during
-     * iteration. Thus it is recommended to hold onto instance for later use.
-     * </p>
-     * <p>
-     * Entities are not required to have components of this type when reported
-     * by this iterator. It is important to check
-     * {@link ComponentData#isValid()} first.
-     * </p>
-     * 
-     * @param data The ComponentData that is used to access the required
-     *            component type data of its type
+     * <p/>
+     * Add the given ComponentData instance as an optional component type for this
+     * iterator. Besides implicitly specifying the required type, the provided instance
+     * will be set to each component of that type during iteration. Thus it is recommended
+     * to hold onto instance for later use.
+     * <p/>
+     * Entities are not required to have components of this type when reported by this
+     * iterator. It is important to check {@link ComponentData#isValid()} first.
+     *
+     * @param data The ComponentData that is used to access the required component type
+     *             data of its type
+     *
      * @return This iterator to chain
-     * @throws NullPointerException if data is null
-     * @throws IllegalArgumentException if data was not created by the
-     *             EntitySystem of this iterator
+     *
+     * @throws NullPointerException     if data is null
+     * @throws IllegalArgumentException if data was not created by the EntitySystem of
+     *                                  this iterator
      */
     public ComponentIterator addOptional(ComponentData<?> data) {
         if (data == null) {
             throw new NullPointerException("ComponentData cannot be null");
         }
         if (data.owner.getEntitySystem() != system) {
-            throw new IllegalArgumentException("ComponentData not created by correct EntitySystem");
+            throw new IllegalArgumentException(
+                    "ComponentData not created by correct EntitySystem");
         }
 
         // add the data to the optional array
     }
 
     /**
-     * <p>
-     * Advance the iterator to the next Entity that has components of all
-     * required types. All ComponentData's of the required types will be updated
-     * to access the components of the next entity. Optional ComponentData's
-     * will be updated to those components of the entity's, if they are
-     * attached. They may not be, in which case they will be flagged as invalid.
-     * </p>
-     * <p>
-     * It can be assumed that when an Entity is found that all required
-     * ComponentData's are valid and reference that entity's components of the
-     * appropriate type.
-     * </p>
-     * <p>
-     * True is returned if an Entity was found. False is returned if there were
-     * no more entities matching the requirements in the system. Additionally,
-     * if there are no required ComponentData's, then false is always returned.
-     * The iterator must be constrained by at least one required type.
-     * </p>
-     * 
-     * @return True if another entity was found and the required components (and
-     *         any present optional components) have been updated to that entity
+     * <p/>
+     * Advance the iterator to the next Entity that has components of all required types.
+     * All ComponentData's of the required types will be updated to access the components
+     * of the next entity. Optional ComponentData's will be updated to those components of
+     * the entity's, if they are attached. They may not be, in which case they will be
+     * flagged as invalid.
+     * <p/>
+     * It can be assumed that when an Entity is found that all required ComponentData's
+     * are valid and reference that entity's components of the appropriate type.
+     * <p/>
+     * True is returned if an Entity was found. False is returned if there were no more
+     * entities matching the requirements in the system. Additionally, if there are no
+     * required ComponentData's, then false is always returned. The iterator must be
+     * constrained by at least one required type.
+     *
+     * @return True if another entity was found and the required components (and any
+     *         present optional components) have been updated to that entity
      */
     public boolean next() {
         if (primary == null) {
                 if (ignoreEnabled || primary.isEnabled()) {
                     for (int i = 0; i < required.length; i++) {
                         component = required[i].owner.getComponentIndex(entity);
-                        if (!required[i].setFast(component) || (!ignoreEnabled && !required[i].isEnabled())) {
+                        if (!required[i].setFast(component) ||
+                            (!ignoreEnabled && !required[i].isEnabled())) {
                             found = false;
                             break;
                         }
                         // so now set all optional requirements as well
                         for (int i = 0; i < optional.length; i++) {
                             component = optional[i].owner.getComponentIndex(entity);
-                            optional[i].setFast(component); // we don't care if this is valid or not
+                            // we don't care if this is valid or not
+                            optional[i].setFast(component);
                         }
 
                         return true;
     }
 
     /**
-     * Reset this ComponentIterator to the beginning of the system to perform
-     * another complete iteration.
+     * Reset this ComponentIterator to the beginning of the system to perform another
+     * complete iteration.
      */
     public void reset() {
         index = 0;

src/main/java/com/lhkbob/entreri/ComponentRepository.java

  */
 package com.lhkbob.entreri;
 
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
 import com.lhkbob.entreri.property.BooleanProperty;
 import com.lhkbob.entreri.property.IntProperty;
 
+import java.lang.ref.WeakReference;
+import java.util.*;
+import java.util.Map.Entry;
+
 /**
- * ComponentRepository manages storing all the componentDatas of a specific type
- * for an EntitySystem. It also controls the IndexedDataStore's for the type's
- * set of properties. It is package-private because its details are low-level
- * and complex.
- * 
+ * ComponentRepository manages storing all the componentDatas of a specific type for an
+ * EntitySystem. It also controls the IndexedDataStore's for the type's set of properties.
+ * It is package-private because its details are low-level and complex.
+ *
+ * @param <T> The type of component stored by the index
+ *
  * @author Michael Ludwig
- * @param <T> The type of component stored by the index
  */
 final class ComponentRepository<T extends ComponentData<T>> {
     private final EntitySystem system;
     private int versionSeq;
 
     /**
-     * Create a ComponentRepository for the given system, that will store
-     * Components of the given type.
-     * 
+     * Create a ComponentRepository for the given system, that will store Components of
+     * the given type.
+     *
      * @param system The owning system
-     * @param type The type of component
+     * @param type   The type of component
+     *
      * @throws NullPointerException if system or type are null
      */
-    @SuppressWarnings({"rawtypes", "unchecked"})
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public ComponentRepository(EntitySystem system, Class<T> type,
                                ComponentDataFactory<T> factory) {
         if (system == null || type == null) {
 
         // decorate the component data with a boolean property to track enabled status
         enabledProperty = decorate(new BooleanProperty.Factory(true));
-        componentIdProperty = decorate(new IntProperty.Factory(0)); // we set a unique id for every component
+        // we set a unique id for every component
+        componentIdProperty = decorate(new IntProperty.Factory(0));
         componentVersionProperty = decorate(new IntProperty.Factory(0));
 
-        idSeq = 1; // start at 1, just like entity id sequences
-        versionSeq = 0;
+        idSeq = 1; // start at 1, just like entity id sequences versionSeq = 0;
 
         // initialize enabled and version for the 0th index
         enabledProperty.set(false, 0);
     }
 
     /**
-     * Given the index of a Component (e.g. {@link Component#getIndex()}, return
-     * the index of an entity within the owning system. The returned entity
-     * index can be safely passed to {@link EntitySystem#getEntityByIndex(int)}.
-     * 
+     * Given the index of a Component (e.g. {@link Component#getIndex()}, return the index
+     * of an entity within the owning system. The returned entity index can be safely
+     * passed to {@link EntitySystem#getEntityByIndex(int)}.
+     *
      * @param componentIndex The component index whose owning entity is fetched
-     * @return The index of the entity that has the given component index, or 0
-     *         if the component is not attached
+     *
+     * @return The index of the entity that has the given component index, or 0 if the
+     *         component is not attached
      */
     public int getEntityIndex(int componentIndex) {
-        if (componentIndex >= componentIndexToEntityIndex.length) {
-            System.out.println("problem!");
-        }
         return componentIndexToEntityIndex[componentIndex];
     }
 
     /**
-     * Given the index of an entity (e.g. {@link Entity#index}), return the
-     * index of the attached component of this ComponentRepository's type. The
-     * returned component index can be used in {@link #getComponent(int)} and
-     * related methods.
-     * 
+     * Given the index of an entity (e.g. {@link Entity#index}), return the index of the
+     * attached component of this ComponentRepository's type. The returned component index
+     * can be used in {@link #getComponent(int)} and related methods.
+     *
      * @param entityIndex The entity index to look up
-     * @return The index of the attached component, or 0 if the entity does not
-     *         have a component of this type attached
+     *
+     * @return The index of the attached component, or 0 if the entity does not have a
+     *         component of this type attached
      */
     public int getComponentIndex(int entityIndex) {
         return entityIndexToComponentRepository[entityIndex];
     }
 
     /**
-     * Ensure that this ComponentRepository has enough internal space to hold
-     * its entity-to-component mapping for the given number of entities.
-     * 
+     * Ensure that this ComponentRepository has enough internal space to hold its
+     * entity-to-component mapping for the given number of entities.
+     *
      * @param numEntities The new number of entities
      */
     public void expandEntityIndex(int numEntities) {
         if (entityIndexToComponentRepository.length < numEntities) {
-            entityIndexToComponentRepository = Arrays.copyOf(entityIndexToComponentRepository,
-                                                             (int) (numEntities * 1.5) + 1);
+            entityIndexToComponentRepository = Arrays
+                    .copyOf(entityIndexToComponentRepository,
+                            (int) (numEntities * 1.5) + 1);
         }
     }
 
      * @return Estimated memory usage of this component repository
      */
     public long estimateMemory() {
-        long total = estimateMemory(declaredProperties) + estimateMemory(decoratedProperties);
+        long total =
+                estimateMemory(declaredProperties) + estimateMemory(decoratedProperties);
 
         // also add in an estimate for other structures used by
         // this repository
 
     /**
      * @param componentIndex The component to look up
+     *
      * @return True if the component at componentIndex is enabled
      */
     public boolean isEnabled(int componentIndex) {
     }
 
     /**
-     * Set whether or not the component at <tt>componentIndex</tt> is enabled.
-     * This does nothing if the index is 0, preserving the guarantee that
-     * invalid component is considered disabled.
-     * 
+     * Set whether or not the component at <tt>componentIndex</tt> is enabled. This does
+     * nothing if the index is 0, preserving the guarantee that invalid component is
+     * considered disabled.
+     *
      * @param componentIndex The component index
-     * @param enabled True if the component is enabled
+     * @param enabled        True if the component is enabled
      */
     public void setEnabled(int componentIndex, boolean enabled) {
         if (componentIndex != 0) {
 
     /**
      * @param componentIndex The component index
+     *
      * @return The component id of the component at the given index
      */
     public int getId(int componentIndex) {
 
     /**
      * @param componentIndex The component index
+     *
      * @return The component version of the component at the given index
      */
     public int getVersion(int componentIndex) {
     }
 
     /**
-     * Increment the component's version at the given index. This does nothing
-     * if the index is 0, preserving the guarantee that an invalid component has
-     * a negative version.
-     * 
+     * Increment the component's version at the given index. This does nothing if the
+     * index is 0, preserving the guarantee that an invalid component has a negative
+     * version.
+     *
      * @param componentIndex
      */
     public void incrementVersion(int componentIndex) {
 
     /**
      * @param componentIndex The component index whose component is fetched
+     *
      * @return The component reference at the given index, may be null
      */
     public Component<T> getComponent(int componentIndex) {
     }
 
     /**
-     * Create a new component and attach to it the entity at the given entity
-     * index, the new component will have its values copied from the existing
-     * template.
-     * 
-     * @param entityIndex The entity index which the component is attached to
+     * Create a new component and attach to it the entity at the given entity index, the
+     * new component will have its values copied from the existing template.
+     *
+     * @param entityIndex  The entity index which the component is attached to
      * @param fromTemplate A template to assign values to the new component
+     *
      * @return A new component of type T
-     * @throws NullPointerException if fromTemplate is null
-     * @throws IllegalArgumentException if the template was not created by this
-     *             index
-     * @throws IllegalStateException if the template is not live
+     *
+     * @throws NullPointerException     if fromTemplate is null
+     * @throws IllegalArgumentException if the template was not created by this index
+     * @throws IllegalStateException    if the template is not live
      */
-    @SuppressWarnings({"unchecked", "rawtypes"})
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public Component<T> addComponent(int entityIndex, Component<T> fromTemplate) {
         if (fromTemplate.getEntitySystem() != getEntitySystem()) {
-            throw new IllegalArgumentException("Component not owned by expected EntitySystem");
+            throw new IllegalArgumentException(
+                    "Component not owned by expected EntitySystem");
         }
         if (!fromTemplate.getType().equals(type)) {
-            throw new IllegalArgumentException("Component not of expected type, expected: " + type + ", but was: " + fromTemplate.getType());
+            throw new IllegalArgumentException(
+                    "Component not of expected type, expected: " + type + ", but was: " +
+                    fromTemplate.getType());
         }
         if (!fromTemplate.isLive()) {
             throw new IllegalStateException("Template component is not live");
     }
 
     /**
-     * Create a new component and attach to it the entity at the given entity
-     * index. The component will have the default state as specified by its
-     * properties.
-     * 
+     * Create a new component and attach to it the entity at the given entity index. The
+     * component will have the default state as specified by its properties.
+     *
      * @param entityIndex The entity index which the component is attached to
-     * @param initParams The var-args of parameters that must match the
-     *            InitParams annotation of the type
+     *
      * @return A new component of type T
+     *
      * @throws IllegalArgumentException if initParams is incorrect
      */
     public Component<T> addComponent(int entityIndex) {
     /*
      * Allocate and store a new component and initialize it to its default state
      */
-    @SuppressWarnings({"unchecked", "rawtypes"})
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private Component<T> allocateComponent(int entityIndex) {
         if (entityIndexToComponentRepository[entityIndex] != 0) {
             removeComponent(entityIndex);
     }
 
     /**
-     * Create a new ComponentData of type T that can be used to view components
-     * in this index.
-     * 
+     * Create a new ComponentData of type T that can be used to view components in this
+     * index.
+     *
      * @return A new data instance
      */
     public T createDataInstance() {
     }
 
     /**
-     * Detach or remove any component of this index's type from the entity with
-     * the given index. True is returned if a component was removed, or false
-     * otherwise.
-     * 
+     * Detach or remove any component of this index's type from the entity with the given
+     * index. True is returned if a component was removed, or false otherwise.
+     *
      * @param entityIndex The entity's index whose component is removed
+     *
      * @return True if a component was removed
      */
     public boolean removeComponent(int entityIndex) {
     }
 
     /**
-     * <p>
-     * Compact the data of this ComponentRepository to account for removals and
-     * additions to the index. This will ensure that all active componentDatas
-     * are packed into the underlying arrays, and that they will be accessed in
-     * the same order as iterating over the entities directly.
-     * </p>
-     * <p>
-     * The map from old to new entity index must be used to properly update the
-     * component index's data so that the system is kept in sync.
-     * </p>
-     * 
+     * <p/>
+     * Compact the data of this ComponentRepository to account for removals and additions
+     * to the index. This will ensure that all active componentDatas are packed into the
+     * underlying arrays, and that they will be accessed in the same order as iterating
+     * over the entities directly.
+     * <p/>
+     * The map from old to new entity index must be used to properly update the component
+     * index's data so that the system is kept in sync.
+     *
      * @param entityOldToNewMap A map from old entity index to new index
-     * @param numEntities The number of entities that are in the system
+     * @param numEntities       The number of entities that are in the system
      */
     public void compact(int[] entityOldToNewMap, int numEntities) {
         // First sort the canonical componentDatas array
             @Override
             public int compare(Component<T> o1, Component<T> o2) {
                 if (o1 != null && o2 != null) {
-                    return componentIndexToEntityIndex[o1.index] - componentIndexToEntityIndex[o2.index];
+                    return componentIndexToEntityIndex[o1.index] -
+                           componentIndexToEntityIndex[o2.index];
                 } else if (o1 != null) {
                     return -1; // push null o2 to end of array
                 } else if (o2 != null) {
         if (componentInsert < .6 * components.length) {
             int newSize = (int) (1.2 * componentInsert) + 1;
             components = Arrays.copyOf(components, newSize);
-            componentIndexToEntityIndex = Arrays.copyOf(componentIndexToEntityIndex,
-                                                        newSize);
+            componentIndexToEntityIndex = Arrays
+                    .copyOf(componentIndexToEntityIndex, newSize);
             resizePropertyStores(declaredProperties, newSize);
             resizePropertyStores(decoratedProperties, newSize);
         }
     }
 
     /**
-     * Decorate the type information of this ComponentRepository to add a
-     * property created by the given factory. The returned property will have
-     * default data assigned for each current Component in the index, and will
-     * have the default value assigned for each new Component. Decorators can
-     * then access the returned property to manipulate the decorated component
-     * data.
-     * 
-     * @param <P> The type of property created
-     * @param factory The factory that will create a unique Property instance
-     *            associated with the decorated property and this index
+     * Decorate the type information of this ComponentRepository to add a property created
+     * by the given factory. The returned property will have default data assigned for
+     * each current Component in the index, and will have the default value assigned for
+     * each new Component. Decorators can then access the returned property to manipulate
+     * the decorated component data.
+     *
+     * @param <P>     The type of property created
+     * @param factory The factory that will create a unique Property instance associated
+     *                with the decorated property and this index
+     *
      * @return The property decorated onto the type of the index
      */
     public <P extends Property> P decorate(PropertyFactory<P> factory) {
-        int size = (declaredProperties.isEmpty() ? componentInsert : declaredProperties.get(0).property.getDataStore()
-                                                                                                       .size());
+        int size = (declaredProperties.isEmpty() ? componentInsert
+                                                 : declaredProperties.get(0).property
+                            .getDataStore().size());
         P prop = factory.create();
         DecoratedPropertyStore<P> pstore = new DecoratedPropertyStore<P>(factory, prop);
 
         abstract P getProperty();
     }
 
-    private static class DeclaredPropertyStore<P extends Property> extends PropertyStore<P> {
+    private static class DeclaredPropertyStore<P extends Property>
+            extends PropertyStore<P>
+
+    {
         final Object key;
         final P property;
 
         }
     }
 
-    private static class DecoratedPropertyStore<P extends Property> extends PropertyStore<P> {
+    private static class DecoratedPropertyStore<P extends Property>
+            extends PropertyStore<P> {
         final WeakReference<P> property;
 
         public DecoratedPropertyStore(PropertyFactory<P> creator, P property) {

src/main/java/com/lhkbob/entreri/DefaultFactory.java

  */
 package com.lhkbob.entreri;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
 
 /**
- * <p>
+ * <p/>
  * DefaultFactory is a type-level annotation that can be added to ComponentData
- * definitions to declare a different ComponentDataFactory than
- * {@link ReflectionComponentDataFactory} as the default. This default will be
- * used by any EntitySystem unless it has a per-system factory override that was
- * set with
- * {@link EntitySystem#setFactory(com.lhkbob.entreri.TypeId, ComponentDataFactory)}
- * </p>
- * <p>
- * Runtime exceptions will be thrown if the factory type declared by the
- * annotation does not have an accessible, supported constructor. The currently
- * supported constructors are:
- * <ol>
- * <li><code>ComponentDataFactory()</code></li>
- * <li><code>ComponentDataFactory(TypeId&lt;T&gt;)</code></li>
- * <li>
- * <code>ComponentDataFactory(Class&lt;T extends ComponentData&lt;T&gt;&gt;)</code>
- * </li>
- * </ol>
- * </p>
- * 
+ * definitions to declare a different ComponentDataFactory than {@link
+ * ReflectionComponentDataFactory} as the default. This default will be used by any
+ * EntitySystem unless it has a per-system factory override that was set with {@link
+ * EntitySystem#setFactory(Class, ComponentDataFactory)}
+ * <p/>
+ * <p/>
+ * Runtime exceptions will be thrown if the factory type declared by the annotation does
+ * not have an accessible, supported constructor. The currently supported constructors
+ * are: <ol> <li><code>ComponentDataFactory()</code></li> <li><code>ComponentDataFactory(TypeId&lt;T&gt;)</code></li>
+ * <li> <code>ComponentDataFactory(Class&lt;T extends ComponentData&lt;T&gt;&gt;)</code>
+ * </li> </ol>
+ *
  * @author Michael Ludwig
  */
 @Documented
 @Target(ElementType.TYPE)
 public @interface DefaultFactory {
     /**
-     * @return The ComponentDataFactory implementation used to create
-     *         ComponentData's
+     * @return The ComponentDataFactory implementation used to create ComponentData's
      */
     Class<? extends ComponentDataFactory<?>> value();
 }

src/main/java/com/lhkbob/entreri/Entity.java

 import java.util.NoSuchElementException;
 
 /**
- * <p>
- * An Entity represents a collection of Components within an EntitySystem.
- * Entities are created by calling {@link EntitySystem#addEntity()} or the
- * similar function that takes another Entity as a template.
- * </p>
- * <p>
- * Entities use instance equality, just like {@link Component}. Once created the
- * Entity object will not change its identity.
- * </p>
- * <p>
- * Entity implements both {@link Ownable} and {@link Owner}. This can be used to
- * create hierarchies of both components and entities that share a lifetime.
- * When an entity is removed from the system, all of its owned objects are
- * disowned. If any of them were entities or components, they are also removed
- * from the system.
- * </p>
- * 
+ * <p/>
+ * An Entity represents a collection of Components within an EntitySystem. Entities are
+ * created by calling {@link EntitySystem#addEntity()} or the similar function that takes
+ * another Entity as a template.
+ * <p/>
+ * Entities use instance equality, just like {@link Component}. Once created the Entity
+ * object will not change its identity.
+ * <p/>
+ * <p/>
+ * Entity implements both {@link Ownable} and {@link Owner}. This can be used to create
+ * hierarchies of both components and entities that share a lifetime. When an entity is
+ * removed from the system, all of its owned objects are disowned. If any of them were
+ * entities or components, they are also removed from the system.
+ *
  * @author Michael Ludwig
  */
-public final class Entity implements Iterable<Component<?>>, Comparable<Entity>, Ownable, Owner {
+public final class Entity
+        implements Iterable<Component<?>>, Comparable<Entity>, Ownable, Owner {
     private final EntitySystem system;
     private final int id;
 
     int index;
 
     /**
-     * Create an Entity that will be owned by the given system and is placed at
-     * the given index.
-     * 
+     * Create an Entity that will be owned by the given system and is placed at the given
+     * index.
+     *
      * @param system The owning system
-     * @param index The index into the system
-     * @param id The unique id of the entity in the system
+     * @param index  The index into the system
+     * @param id     The unique id of the entity in the system
      */
     Entity(EntitySystem system, int index, int id) {
         if (system == null) {
     }
 
     /**
-     * @return True if this Entity is still in its EntitySystem, or false if it
-     *         has been removed
+     * @return True if this Entity is still in its EntitySystem, or false if it has been
+     *         removed
      */
     public boolean isLive() {
         return index != 0;
     }
 
     /**
-     * <p>
-     * Get the Component instance of the given type that's attached to this
-     * Entity. A null value is returned if the component type has not been
-     * attached to the entity, or if the component is disabled.
-     * </p>
-     * <p>
-     * If the entity has a component of the given type, but it has been marked
-     * as disabled, this will return null. Use {@link #get(Class, boolean)} to
-     * override this behavior and return disabled components.
-     * </p>
-     * 
-     * @param <T> The parameterized type of ComponentData of the component
+     * <p/>
+     * Get the Component instance of the given type that's attached to this Entity. A null
+     * value is returned if the component type has not been attached to the entity, or if
+     * the component is disabled.
+     * <p/>
+     * If the entity has a component of the given type, but it has been marked as
+     * disabled, this will return null. Use {@link #get(Class, boolean)} to override this
+     * behavior and return disabled components.
+     *
+     * @param <T>           The parameterized type of ComponentData of the component
      * @param componentType The given type
+     *
      * @return The current Component of type T attached to this entity
+     *
      * @throws NullPointerException if id is null
      */
     public <T extends ComponentData<T>> Component<T> get(Class<T> componentType) {
     }
 
     /**
-     * Get the Component instance of the given type that's attached to this
-     * entity. If <tt>ignoreEnable</tt> is true, then disabled components will
-     * be returned as well.
-     * 
-     * @param <T> The parameterized type of ComponentData of the component
+     * Get the Component instance of the given type that's attached to this entity. If
+     * <tt>ignoreEnable</tt> is true, then disabled components will be returned as well.
+     *
+     * @param <T>           The parameterized type of ComponentData of the component
      * @param componentType The data type
-     * @param ignoreEnable True if disabled components should be returned as
-     *            well
+     * @param ignoreEnable  True if disabled components should be returned as well
+     *
      * @return The current Component of type T attached to this entity
+     *
      * @throws NullPointerException if componentType is null
      */
     public <T extends ComponentData<T>> Component<T> get(Class<T> componentType,
     }
 
     /**
-     * <p>
-     * Get the component of type T attached to this entity, by setting the given
-     * data's reference. This will return true if the data instance has been set
-     * to a valid component and that component is enabled. This is a shortcut
-     * for:
-     * 
+     * <p/>
+     * Get the component of type T attached to this entity, by setting the given data's
+     * reference. This will return true if the data instance has been set to a valid
+     * component and that component is enabled. This is a shortcut for:
+     * <p/>
      * <pre>
      * Component&lt;T&gt; c = entity.get(TypeId.get(T.class));
      * if (c != null &amp;&amp; c.isEnabled()) {
      *     }
      * }
      * </pre>
-     * 
-     * </p>
-     * <p>
-     * Note that there is no equivalent {@link #get(TypeId, boolean)} that takes
-     * a ComponentData. This is because the data instance will still be set to a
-     * valid component even when it's disabled. It is possible to identify this
-     * case if get() returns false but isValid() returns true.
-     * </p>
-     * 
-     * @param <T> The component data type
-     * @param data An instance of the data that will be set to this entity's
-     *            component
-     * @return True if the data now references a valid and enabled component,
-     *         and false if the component is invalid or if the component is
-     *         disabled
-     * @throws NullPointerException if data is null
-     * @throws IllegalArgumentException if the data was created by another
-     *             entity system
+     * <p/>
+     * <p/>
+     * <p/>
+     * Note that there is no equivalent {@link #get(Class boolean)} that takes a
+     * ComponentData. This is because the data instance will still be set to a valid
+     * component even when it's disabled. It is possible to identify this case if get()
+     * returns false but isValid() returns true.
+     *
+     * @param <T>  The component data type
+     * @param data An instance of the data that will be set to this entity's component
+     *
+     * @return True if the data now references a valid and enabled component, and false if
+     *         the component is invalid or if the component is disabled
+     *
+     * @throws NullPointerException     if data is null
+     * @throws IllegalArgumentException if the data was created by another entity system
      */
     public <T extends ComponentData<T>> boolean get(T data) {
         if (data.owner.getEntitySystem() != getEntitySystem()) {
-            throw new IllegalArgumentException("ComponentData was not created by expected EntitySystem");
+            throw new IllegalArgumentException(
+                    "ComponentData was not created by expected EntitySystem");
         }
 
         ComponentRepository<T> ci = data.owner;
     }
 
     /**
-     * <p>
-     * Add a new Component with a data type T to this Entity. If there already
-     * exists a component of type T, it is removed first, and a new one is
-     * instantiated.
-     * </p>
-     * 
-     * @param <T> The parameterized type of component being added
+     * <p/>
+     * Add a new Component with a data type T to this Entity. If there already exists a
+     * component of type T, it is removed first, and a new one is instantiated.
+     *
+     * @param <T>           The parameterized type of component being added
      * @param componentType The component type
+     *
      * @return A new component of type T
+     *
      * @throws NullPointerException if componentId is null
      */
     public <T extends ComponentData<T>> Component<T> add(Class<T> componentType) {
     }
 
     /**
-     * <p>
-     * Add a new Component with a data of type T to this Entity, but the new
-     * component's state will be cloned from the given Component instance. The
-     * <tt>toClone</tt> instance must still be live. If there already exists a
-     * component of type T, it is removed first, and a new one is instantiated.
-     * </p>
-     * <p>
+     * <p/>
+     * Add a new Component with a data of type T to this Entity, but the new component's
+     * state will be cloned from the given Component instance. The <tt>toClone</tt>
+     * instance must still be live. If there already exists a component of type T, it is
+     * removed first, and a new one is instantiated.
+     * <p/>
      * The new component is initialized by cloning the property values from
-     * <tt>toClone</tt> into the values of the new component. This is performed
-     * by invoking {@link PropertyFactory#clone(Property, int, Property, int)}
-     * with the factories that created each property. All default property
-     * factories perform a copy by value (or copy by reference for object
-     * types).
-     * </p>
-     * 
-     * @param <T> The parameterized type of component to add
+     * <tt>toClone</tt> into the values of the new component. This is performed by
+     * invoking {@link PropertyFactory#clone(Property, int, Property, int)} with the
+     * factories that created each property. All default property factories perform a copy
+     * by value (or copy by reference for object types).
+     *
+     * @param <T>     The parameterized type of component to add
      * @param toClone The existing T to clone when attaching to this component
+     *
      * @return A new component of type T
-     * @throws NullPointerException if toClone is null
-     * @throws IllegalArgumentException if toClone is not from the same system
-     *             as this entity
-     * @throws IllegalStateException if toClone is not a live component instance
+     *
+     * @throws NullPointerException     if toClone is null
+     * @throws IllegalArgumentException if toClone is not from the same system as this
+     *                                  entity
+     * @throws IllegalStateException    if toClone is not a live component instance
      */
-    @SuppressWarnings({"unchecked", "rawtypes"})
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public <T extends ComponentData<T>> Component<T> add(Component<T> toClone) {
         if (toClone == null) {
-            throw new NullPointerException("ComponentData template, toClone, cannot be null");
+            throw new NullPointerException(
+                    "ComponentData template, toClone, cannot be null");
         }
         ComponentRepository ci = system.getRepository(toClone.getType());
         return ci.addComponent(index, toClone);
     }
 
     /**
-     * <p>
-     * Remove any attached Component with the data type, T, from this Entity.
-     * True is returned if a component was removed, and false otherwise. If a
-     * component is removed, the component should no longer be used and it will
-     * return false from {@link Component#isLive()}. This will remove the
-     * component even if the component has been disabled.
-     * <p>
-     * When a Component is removed, it will set its owner to null, and disown
-     * all of its owned objects. If any of those owned objects are entities or
-     * components, they are removed from the system as well.
-     * 
-     * @param <T> The parameterized type of component to remove
+     * <p/>
+     * Remove any attached Component with the data type, T, from this Entity. True is
+     * returned if a component was removed, and false otherwise. If a component is
+     * removed, the component should no longer be used and it will return false from
+     * {@link Component#isLive()}. This will remove the component even if the component
+     * has been disabled.
+     * <p/>
+     * When a Component is removed, it will set its owner to null, and disown all of its
+     * owned objects. If any of those owned objects are entities or components, they are
+     * removed from the system as well.
+     *
+     * @param <T>           The parameterized type of component to remove
      * @param componentType The component type
+     *
      * @return True if a component was removed
+     *
      * @throws NullPointerException if componentId is null
      */
     public <T extends ComponentData<T>> boolean remove(Class<T> componentType) {
     }
 
     /**
-     * <p>
-     * Return an iterator over the components currently attached to the Entity.
-     * The iterator supports the remove operation and will detach the component
-     * from the entity.
-     * </p>
-     * <p>