All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.khelekore.prtree.InternalNode Maven / Gradle / Ivy

There is a newer version: 1.11
Show newest version
package org.khelekore.prtree;

import java.util.List;
import java.util.PriorityQueue;

class InternalNode extends NodeBase, T> {
    public InternalNode (Object[] data) {
	super (data);
    }

    @Override public MBR computeMBR (MBRConverter converter) {
	MBR ret = null;
	for (int i = 0, s = size (); i < s; i++)
	    ret = getUnion (ret, get (i).getMBR (converter));
	return ret;
    }

    public void expand (MBR mbr, NodeFilter filter,
			MBRConverter converter, List found,
			List> nodesToExpand) {
	for (int i = 0, s = size (); i < s; i++) {
	    Node n = get (i);
	    if (mbr.intersects (n.getMBR (converter)))
		nodesToExpand.add (n);
	}
    }

    public void find (MBR mbr, MBRConverter converter,
		      List result, NodeFilter filter) {
	for (int i = 0, s = size (); i < s; i++) {
	    Node n = get (i);
	    if (mbr.intersects (n.getMBR (converter)))
		n.find (mbr, converter, result, filter);
	}
    }

    public void nnExpand (DistanceCalculator dc,
			  NodeFilter filter,
			  List> drs,
			  int maxHits,
			  PriorityQueue> queue,
			  MinDistComparator> mdc) {
	int s = size ();
	for (int i = 0; i < s; i++) {
	    Node n = get (i);
	    MBR mbr = n.getMBR (mdc.converter);
	    double minDist = MinDist.get (mbr, mdc.p);
	    int t = drs.size ();
	    // drs is sorted so we can check only the last entry
	    if (t < maxHits || minDist <= drs.get (t - 1).getDistance ())
		queue.add (n);
	}
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy