Package org.geotools.caching.spatialindex

Examples of org.geotools.caching.spatialindex.Node


    }

    public void testGet() {
        store.put(n);

        Node g = store.get(id);
        assertEquals(n.getIdentifier(), g.getIdentifier());
    }
View Full Code Here


    }

    public void testRemove() {
        store.put(n);

        Node g = store.get(id);
        assertEquals(n.getIdentifier(), g.getIdentifier());
        store.remove(id);
        assertNull(store.get(id));
        store.put(n);
        g = store.get(id);
        assertEquals(n.getIdentifier(), g.getIdentifier());
    }
View Full Code Here

        Properties pset = this.store.getPropertySet();
        this.store.flush();
        this.store = DiskStorage.createInstance(pset);

        Node g = store.get(id);
        assertEquals(n.getIdentifier(), g.getIdentifier());
        store.remove(id);
        g = store.get(id);
        assertNull(g);
    }
View Full Code Here

    /**
     * Gets a particular node
     */
    public synchronized Node get(NodeIdentifier id) {
        Node node = null;
               
        Entry e = pageIndex.get(id);
        if (e == null) {
          return null;
        }
View Full Code Here

     * Converts an array of bytes into a node
     */
    private Node readNode(byte[] data, NodeIdentifier id) throws IOException, ClassNotFoundException {
      ByteArrayInputStream bais = new ByteArrayInputStream(data);
        ObjectInputStream ois = new ObjectInputStream(bais);
        Node node = null;
        try{
            node = (Node) ois.readObject();
        }finally{
            ois.close();
            bais.close();           
        }
        id = findUniqueInstance(id);
        node.setIdentifier(id);
        return node;
    }
View Full Code Here

     * Gets a particular node.
     * <p>First looks in buffer; if not found will
     * look in the underlying storage</p>
     */
    public Node get( NodeIdentifier id ) {
        Node ret = buffer.get(id);
        if (ret == null) {
            ret = storage.get(id);
            if (ret != null) {
                put(ret);
            }
View Full Code Here

     * Writes all dirty nodes to underlying disk storage.
     */
    public void flush() {
        synchronized (dirtyNodes) {
            for( Iterator<Node> it = dirtyNodes.iterator(); it.hasNext(); ) {
                Node entry = it.next();
                storage.put(entry);
            }
            dirtyNodes.clear();
        }
        storage.flush();
View Full Code Here

            //node identifiers in the data store
            for (int i = 0; i < this.rootNode.getChildrenCount(); i ++){
              RegionNodeIdentifier cid = (RegionNodeIdentifier)findUniqueInstance(this.rootNode.getChildIdentifier(i));
                ((GridRootNode)this.rootNode).setChildIdentifier(i, cid);
                if (cid.isValid()){
                  Node n = readNode(cid);
                  this.stats.addToDataCounter(n.getDataCount());
                }
            }
        }
    }
View Full Code Here

       //here we need to visit just the children that may intersect
        List<Integer> childrenindex = tmpRoot.getChildren(query);
        for( Iterator<Integer> iterator = childrenindex.iterator(); iterator.hasNext(); ) {
            Integer childid = (Integer) iterator.next();
            NodeIdentifier child = tmpRoot.getChildIdentifier(childid);
            Node childNode = readNode(child);
            v.visitNode(childNode);
            if (v.isDataVisitor()) {
                visitData(childNode, v, query, type);
            }
        }
View Full Code Here

        GridNode nodeToEvict = (GridNode) readNode(node); // FIXME: avoid to read node before
                                                          // eviction
        ret = nodeToEvict.getDataCount();
        // lets first evict all the children
        for( int i = 0; i < nodeToEvict.getChildrenCount(); i++ ) {
            Node n = readNode(nodeToEvict.getChildIdentifier(i));
            ret += n.getDataCount();
            n.clear();
            writeNode(n);
            evictcnt++;
        }
        // now evict the main node
        nodeToEvict.clear();
View Full Code Here

TOP

Related Classes of org.geotools.caching.spatialindex.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.