diff --git a/src/java/org/apache/poi/util/IntList2d.java b/src/java/org/apache/poi/util/IntList2d.java deleted file mode 100644 index 6b4817098..000000000 --- a/src/java/org/apache/poi/util/IntList2d.java +++ /dev/null @@ -1,88 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.poi.util; - -import java.util.List; -import java.util.ArrayList; - -/** - * Provides an interface for interacting with 2d arrays of integers. This - * implementation will return 0 for items not yet allocated and automatically - * increase the array size for set operations. You never get an index out of - * bounds. - * - * @author Glen Stampoultzis (glens at apache.org) - * @version $Id$ - */ -public class IntList2d -{ - // Implemented using a List of IntList's. - List rows = new ArrayList(); - - public int get(int col, int row) - { - if (row >= rows.size()) - { - return 0; - } - else - { - IntList cols = (IntList) rows.get(row); - if (col >= cols.size()) - return 0; - else - return cols.get( col ); - } - } - - public void set(int col, int row, int value) - { - resizeRows(row); - resizeCols(row,col); - IntList cols = (IntList) rows.get( row ); - cols.set( col, value ); - } - - private void resizeRows( int row ) - { - while (rows.size() <= row) - rows.add( new IntList() ); - } - - private void resizeCols( int row, int col ) - { - IntList cols = (IntList) rows.get( row ); - while (cols.size() <= col) - cols.add(0); - } - - public boolean isAllocated( int col, int row ) - { - if (row < rows.size()) - { - IntList cols = (IntList) rows.get( row ); - return ( col < cols.size() ); - } - else - { - return false; - } - } - - - -} diff --git a/src/java/org/apache/poi/util/List2d.java b/src/java/org/apache/poi/util/List2d.java deleted file mode 100644 index 0d1b11e48..000000000 --- a/src/java/org/apache/poi/util/List2d.java +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.poi.util; - -import java.util.List; -import java.util.ArrayList; - -/** - * Provides an interface for interacting with 2d arrays of objects. This - * implementation will return null for items not yet allocated and automatically - * increase the array size for set operations. You never get an index out of - * bounds. - * - * @author Glen Stampoultzis (glens at apache.org) - * @version $Id$ - */ -public class List2d -{ - // Implemented using a List of List's. - List rows = new ArrayList(); - - public Object get(int col, int row) - { - if (row >= rows.size()) - { - return null; - } - else - { - List cols = (List) rows.get(row); - if (col >= cols.size()) - return null; - else - return cols.get( col ); - } - } - - public void set(int col, int row, Object value) - { - resizeRows(row); - resizeCols(row,col); - List cols = (List) rows.get( row ); - cols.set( col, value ); - } - - private void resizeRows( int row ) - { - while (rows.size() <= row) - rows.add( new ArrayList() ); - } - - private void resizeCols( int row, int col ) - { - List cols = (List) rows.get( row ); - while (cols.size() <= col) - cols.add(null); - } - - -} diff --git a/src/testcases/org/apache/poi/util/AllPOIUtilTests.java b/src/testcases/org/apache/poi/util/AllPOIUtilTests.java index 6364c8c35..686aa549d 100755 --- a/src/testcases/org/apache/poi/util/AllPOIUtilTests.java +++ b/src/testcases/org/apache/poi/util/AllPOIUtilTests.java @@ -35,8 +35,6 @@ public final class AllPOIUtilTests { result.addTestSuite(TestHexDump.class); result.addTestSuite(TestIntegerField.class); result.addTestSuite(TestIntList.class); - result.addTestSuite(TestIntList2d.class); - result.addTestSuite(TestList2d.class); result.addTestSuite(TestLittleEndian.class); result.addTestSuite(TestLongField.class); result.addTestSuite(TestPOILogFactory.class); diff --git a/src/testcases/org/apache/poi/util/TestIntList2d.java b/src/testcases/org/apache/poi/util/TestIntList2d.java deleted file mode 100644 index df3a34294..000000000 --- a/src/testcases/org/apache/poi/util/TestIntList2d.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.poi.util; - -import junit.framework.TestCase; - -/** - * @version $Id$ - */ -public class TestIntList2d - extends TestCase -{ - public void testAccess() - throws Exception - { - IntList2d array = new IntList2d(); - assertEquals( 0, array.get( 0, 0 ) ); - assertEquals( 0, array.get( 1, 1 ) ); - assertEquals( 0, array.get( 100, 100 ) ); - array.set( 100, 100, 999 ); - assertEquals( 999, array.get( 100, 100 ) ); - assertEquals( 0, array.get( 0, 0 ) ); - array.set( 0, 0, 999 ); - assertEquals( 999, array.get( 0, 0 ) ); - - assertTrue(array.isAllocated( 0, 0 ) ); - assertTrue(array.isAllocated( 100, 100 ) ); - assertFalse(array.isAllocated( 200, 200 ) ); - - try - { - assertEquals( 0, array.get( -1, -1 ) ); - fail(); - } - catch ( ArrayIndexOutOfBoundsException e ) - { - // pass - } - } -} diff --git a/src/testcases/org/apache/poi/util/TestList2d.java b/src/testcases/org/apache/poi/util/TestList2d.java deleted file mode 100644 index 8433a9809..000000000 --- a/src/testcases/org/apache/poi/util/TestList2d.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.poi.util; - -import junit.framework.TestCase; - -/** - * @version $Id$ - */ -public class TestList2d - extends TestCase -{ - public void testAccess() - throws Exception - { - Object objectA = new Object(); - Object objectB = new Object(); - - List2d array = new List2d(); - assertNull( array.get( 0, 0 ) ); - assertNull( array.get( 1, 1 ) ); - assertNull( array.get( 100, 100 ) ); - array.set( 100, 100, objectA ); - assertSame( objectA, array.get( 100, 100 ) ); - assertNull( array.get( 0, 0 ) ); - array.set( 0, 0, objectB ); - assertSame( objectB, array.get( 0, 0 ) ); - - try - { - array.get( -1, -1 ); - fail(); - } - catch ( ArrayIndexOutOfBoundsException e ) - { - // pass - } - } -}