⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memorypagestoretest.java

📁 shape file read and write
💻 JAVA
字号:
/*
 *    GeoTools - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.index.rtree.memory;

import junit.framework.TestCase;
import org.geotools.index.DataDefinition;
import org.geotools.index.TreeException;
import org.geotools.index.rtree.PageStore;

/**
 * DOCUMENT ME!
 * 
 * @author Tommaso Nolli
 * @source $URL:
 *         http://svn.geotools.org/geotools/trunk/gt/modules/plugin/shapefile/src/test/java/org/geotools/index/rtree/memory/MemoryPageStoreTest.java $
 */
public class MemoryPageStoreTest extends TestCase {
    /**
     * Constructor for MemoryPageStoreTest.
     * 
     * @param arg0
     */
    public MemoryPageStoreTest(String arg0) {
        super(arg0);
    }

    /*
     * Test for void MemoryPageStoreTest(DataDefinition)
     */
    public void testMemoryPageStoreTestDataDefinition() throws Exception {
        DataDefinition dd = new DataDefinition("US-ASCII");

        try {
            new MemoryPageStore(dd);
            fail("Cannot use an empty DataDefinition");
        } catch (TreeException e) {
            // OK
        }

        dd.addField(Integer.class);

        MemoryPageStore ps = new MemoryPageStore(dd);
        ps.close();
    }

    /*
     * Test for void MemoryPageStore(DataDefinition, int, int, short)
     */
    public void testMemoryPageStoreDataDefinitionintintshort() throws Exception {
        DataDefinition dd = new DataDefinition("US-ASCII");
        dd.addField(Integer.class);

        MemoryPageStore ps = null;

        try {
            ps = new MemoryPageStore(dd, 10, 10, PageStore.SPLIT_QUADRATIC);
            fail("MinNodeEntries must be <= MaxNodeEntries / 2");
        } catch (TreeException e) {
            // OK
        }

        try {
            ps = new MemoryPageStore(dd, 10, 5, (short) 1000);
            fail("SplitAlgorithm not supported");
        } catch (TreeException e) {
            // OK
        }

        ps = new MemoryPageStore(dd, 50, 25, PageStore.SPLIT_QUADRATIC);
        ps.close();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -