Android Open Source - java-androidframework Android Pool






From Project

Back to project page java-androidframework.

License

The source code is released under:

This project is licensed under the [CC0 1.0 Agreement](http://creativecommons.org/publicdomain/zero/1.0/). To the extent possible under law, Pete Schmitz has waived all copyright and related or neigh...

If you think the Android project java-androidframework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gamepatriot.androidframework.framework;
//from w  w  w .  ja  v  a 2  s. c  o m
import java.util.Collection;

/**
 * An AndroidPool implementation should allow the storage and retrieval of an object to avoid re-instantiation.
 * 
 * @author Pete Schmitz, May 9, 2013
 *
 * @param <T>    The typecast of the objects to be pooled.
 */
public interface AndroidPool<T> {
  
  /** 
   * Get an object of the casted type associated with this pool. If an old one doesn't exist in the pool a new object of that type will be instantiated.
   * @return    A usable object of the pool's specificed typecast. Should never be null.
   */
  public T get();
  
  /**
   * Store an object of the typecasted class associated with this pool. A limit should be enforced to prevent unnecessary pool sizes.
   * @param $t  A non-null and instantiated object of the typecast associated with this pool. It will be stored until it's returned by a {@link #get()} call.
   * @return    Whether or not this object was added to the pool (Limit was hit or add request was null).
   */
  public boolean add(T $t);
  
  /**
   * Release the objects referenced in this pool and empty the pool.
   * @return    The collection of objects that were contained in this pool.
   */
  public Collection<T> release();
  
  /**
   * Return the number of objects in this pool.
   */
  public int size();
  
}




Java Source Code List

com.gamepatriot.androidframework.framework.AndroidAnimationData.java
com.gamepatriot.androidframework.framework.AndroidAtlas.java
com.gamepatriot.androidframework.framework.AndroidBasicShape.java
com.gamepatriot.androidframework.framework.AndroidGameData.java
com.gamepatriot.androidframework.framework.AndroidImage.java
com.gamepatriot.androidframework.framework.AndroidInputter.java
com.gamepatriot.androidframework.framework.AndroidMain.java
com.gamepatriot.androidframework.framework.AndroidMusicHandler.java
com.gamepatriot.androidframework.framework.AndroidPool.java
com.gamepatriot.androidframework.framework.AndroidRenderer.java
com.gamepatriot.androidframework.framework.AndroidScreen.java
com.gamepatriot.androidframework.framework.AndroidShape.java
com.gamepatriot.androidframework.framework.AndroidSoundHandler.java
com.gamepatriot.framework2d.classes.FPS.java
com.gamepatriot.framework2d.implementation.AnimationData.java
com.gamepatriot.framework2d.implementation.Atlas.java
com.gamepatriot.framework2d.implementation.BasicShape.java
com.gamepatriot.framework2d.implementation.GameData.java
com.gamepatriot.framework2d.implementation.Image.java
com.gamepatriot.framework2d.implementation.Inputter.java
com.gamepatriot.framework2d.implementation.Main.java
com.gamepatriot.framework2d.implementation.MusicHandler.java
com.gamepatriot.framework2d.implementation.Pool.java
com.gamepatriot.framework2d.implementation.Renderer.java
com.gamepatriot.framework2d.implementation.Screen.java
com.gamepatriot.framework2d.implementation.Shape.java
com.gamepatriot.framework2d.implementation.SoundHandler.java
com.gamepatriot.framework2d.screens.Example.java