[jboss-svn-commits] JBoss Portal SVN: r5508 - in trunk/common/src/main/org/jboss/portal: common/util test/common
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 30 05:45:11 EST 2006
Author: thomas.heute at jboss.com
Date: 2006-10-30 05:45:08 -0500 (Mon, 30 Oct 2006)
New Revision: 5508
Removed:
trunk/common/src/main/org/jboss/portal/common/util/LoopCollection.java
trunk/common/src/main/org/jboss/portal/test/common/LoopCollectionTestCase.java
Log:
Remove unused LoopCollection
Deleted: trunk/common/src/main/org/jboss/portal/common/util/LoopCollection.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/LoopCollection.java 2006-10-30 10:42:11 UTC (rev 5507)
+++ trunk/common/src/main/org/jboss/portal/common/util/LoopCollection.java 2006-10-30 10:45:08 UTC (rev 5508)
@@ -1,89 +0,0 @@
-package org.jboss.portal.common.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class LoopCollection
-{
- private List list;
-
- private int size;
-
- private int index;
-
- public LoopCollection(int size)
- {
- this.list = new ArrayList(size);
- this.size = size;
- this.index = -1;
- }
-
- public void put(Object value)
- {
- index++;
- if (index == size)
- {
- index = 0;
- }
- if (list.size() < size)
- {
- list.add(value);
- }
- else
- {
- list.set(index, value);
- }
- }
-
- public void setSize(int newSize)
- {
-
-
- if (newSize <= size)
- {
- List newList = new ArrayList(newSize);
- for (int i = 0; i < newSize; i++)
- {
- int cursor = index + 1 - newSize + i;
- if (cursor < 0) cursor += size;
- newList.add(list.get(cursor));
- }
- this.list = newList;
- this.index = newSize - 1;
- }
- this.size = newSize;
- }
-
- public int getSize()
- {
- return list.size();
- }
-
- /**
- * Return elements from oldest to nexest
- * @param i
- * @return
- */
- public Object get(int i)
- {
- if (i > list.size() || i < 0)
- {
- throw new IndexOutOfBoundsException();
- }
- else
- {
- if (list.size() < size)
- {
- return list.get(i);
- }
- else
- {
- int cursor = index + 1 - size + i;
- if (cursor < 0) cursor += size;
- return list.get(cursor);
- }
-
- }
- }
-
-}
Deleted: trunk/common/src/main/org/jboss/portal/test/common/LoopCollectionTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/LoopCollectionTestCase.java 2006-10-30 10:42:11 UTC (rev 5507)
+++ trunk/common/src/main/org/jboss/portal/test/common/LoopCollectionTestCase.java 2006-10-30 10:45:08 UTC (rev 5508)
@@ -1,73 +0,0 @@
-package org.jboss.portal.test.common;
-
-import org.jboss.portal.common.util.LoopCollection;
-import junit.framework.TestCase;
-
-public class LoopCollectionTestCase extends TestCase
-{
-
- public void test01()
- {
-
- LoopCollection loop = new LoopCollection(6);
-
- loop.put("a");
- loop.put("b");
- loop.put("c");
- assertTrue(loop.get(0).equals("a"));
- assertTrue(loop.get(1).equals("b"));
- assertTrue(loop.get(2).equals("c"));
- loop.put("d");
- loop.put("e");
- assertTrue(loop.get(0).equals("a"));
- assertTrue(loop.get(1).equals("b"));
- assertTrue(loop.get(2).equals("c"));
- assertTrue(loop.get(3).equals("d"));
- assertTrue(loop.get(4).equals("e"));
- loop.put("f");
- loop.put("g");
- loop.put("h");
- loop.put("i");
- assertTrue(loop.get(0).equals("d"));
- assertTrue(loop.get(1).equals("e"));
- assertTrue(loop.get(2).equals("f"));
- assertTrue(loop.get(3).equals("g"));
- assertTrue(loop.get(4).equals("h"));
- assertTrue(loop.get(5).equals("i"));
- loop.setSize(4);
- assertTrue(loop.get(0).equals("f"));
- assertTrue(loop.get(1).equals("g"));
- assertTrue(loop.get(2).equals("h"));
- assertTrue(loop.get(3).equals("i"));
- loop.setSize(2);
- assertTrue(loop.get(0).equals("h"));
- assertTrue(loop.get(1).equals("i"));
- loop.setSize(5);
- loop.put("k");
- loop.put("l");
- loop.put("m");
- assertTrue(loop.get(0).equals("h"));
- assertTrue(loop.get(1).equals("i"));
- assertTrue(loop.get(2).equals("k"));
- assertTrue(loop.get(3).equals("l"));
- assertTrue(loop.get(4).equals("m"));
- loop.setSize(10);
- loop.put("n");
- assertTrue(loop.get(0).equals("h"));
- assertTrue(loop.get(1).equals("i"));
- assertTrue(loop.get(2).equals("k"));
- assertTrue(loop.get(3).equals("l"));
- assertTrue(loop.get(4).equals("m"));
- assertTrue(loop.get(5).equals("n"));
- loop.setSize(4);
- assertTrue(loop.get(0).equals("k"));
- assertTrue(loop.get(1).equals("l"));
- assertTrue(loop.get(2).equals("m"));
- assertTrue(loop.get(3).equals("n"));
-
-
-
- }
-
-
-}
More information about the jboss-svn-commits
mailing list