L2ObjectSet.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.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. */
  35. public abstract class L2ObjectSet<T extends L2Object> implements Iterable<T>
  36. {
  37. public static L2ObjectSet<L2Object> createL2ObjectSet()
  38. {
  39. switch (Config.SET_TYPE)
  40. {
  41. case WorldObjectSet:
  42. return new WorldObjectSet<L2Object>();
  43. default:
  44. return new L2ObjectHashSet<L2Object>();
  45. }
  46. }
  47. public static L2ObjectSet<L2Playable> createL2PlayerSet()
  48. {
  49. switch (Config.SET_TYPE)
  50. {
  51. case WorldObjectSet:
  52. return new WorldObjectSet<L2Playable>();
  53. default:
  54. return new L2ObjectHashSet<L2Playable>();
  55. }
  56. }
  57. public abstract int size();
  58. public abstract boolean isEmpty();
  59. public abstract void clear();
  60. public abstract void put(T obj);
  61. public abstract void remove(T obj);
  62. public abstract boolean contains(T obj);
  63. public abstract Iterator<T> iterator();
  64. }