removed obsolete classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@780822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5fc9eb4718
commit
e939bb7d88
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user