L2ObjectSet.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * $Header: L2ObjectSet.java, 22/07/2005 13:22:46 luisantonioa Exp $
  3. *
  4. * $Author: luisantonioa $
  5. * $Date: 22/07/2005 13:22:46 $
  6. * $Revision: 1 $
  7. * $Log: L2ObjectSet.java,v $
  8. * Revision 1 22/07/2005 13:22:46 luisantonioa
  9. * Added copyright notice
  10. *
  11. *
  12. * This program is free software: you can redistribute it and/or modify it under
  13. * the terms of the GNU General Public License as published by the Free Software
  14. * Foundation, either version 3 of the License, or (at your option) any later
  15. * version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but WITHOUT
  18. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  19. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  20. * details.
  21. *
  22. * You should have received a copy of the GNU General Public License along with
  23. * this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. package com.l2jserver.gameserver.util;
  26. import java.util.Iterator;
  27. import com.l2jserver.Config;
  28. import com.l2jserver.gameserver.model.L2Object;
  29. import com.l2jserver.gameserver.model.actor.L2Playable;
  30. /**
  31. * This class ...
  32. *
  33. * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
  34. * @param <T>
  35. */
  36. public abstract class L2ObjectSet<T extends L2Object> implements Iterable<T>
  37. {
  38. public static L2ObjectSet<L2Object> createL2ObjectSet()
  39. {
  40. switch (Config.SET_TYPE)
  41. {
  42. case WorldObjectSet:
  43. return new WorldObjectSet<L2Object>();
  44. default:
  45. return new L2ObjectHashSet<L2Object>();
  46. }
  47. }
  48. public static L2ObjectSet<L2Playable> createL2PlayerSet()
  49. {
  50. switch (Config.SET_TYPE)
  51. {
  52. case WorldObjectSet:
  53. return new WorldObjectSet<L2Playable>();
  54. default:
  55. return new L2ObjectHashSet<L2Playable>();
  56. }
  57. }
  58. public abstract int size();
  59. public abstract boolean isEmpty();
  60. public abstract void clear();
  61. public abstract void put(T obj);
  62. public abstract void remove(T obj);
  63. public abstract boolean contains(T obj);
  64. @Override
  65. public abstract Iterator<T> iterator();
  66. }