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

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

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

/**
 * @param  the type of the child entries
 * @param  the type of the data entries
 */
abstract class NodeBase implements Node {
    private MBR mbr;
    private Object[] data;

    public NodeBase (Object[] data) {
	this.data = data;
    }

    public int size () {
	return data.length;
    }

    @SuppressWarnings("unchecked")
    public N get (int i) {
	return (N)data[i];
    }
    
    public MBR getMBR (MBRConverter converter) {
	if (mbr == null)
	    mbr = computeMBR (converter);
	return mbr;
    }
    
    public abstract MBR computeMBR (MBRConverter converter);
    
    public MBR getUnion (MBR m1, MBR m2) {
	if (m1 == null)
	    return m2;
	return m1.union (m2);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy