com.espertech.esper.spatial.quadtree.mxcif.MXCIFQuadTree Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esper Show documentation
Show all versions of esper Show documentation
Complex event processing and event series analysis component
/*
***************************************************************************************
* Copyright (C) 2006 EsperTech, Inc. All rights reserved. *
* http://www.espertech.com/esper *
* http://www.espertech.com *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
***************************************************************************************
*/
package com.espertech.esper.spatial.quadtree.mxcif;
/**
*
* Quad tree.
*
*
* Nodes can either be leaf nodes or branch nodes. Both leaf nodes and branch nodes have data. "Data" is modelled as a generic type.
*
*
* Branch nodes have 4 regions or child nodes that subdivide the parent region in NW/NE/SW/SE.
*
*
* The tree is polymorphic: leaf nodes can become branches and branches can become leafs.
*
*
* Manipulation and querying of the quad tree is done through tool classes.
* As the tree can be polymorphic users should not hold on to the root node as it could change.
*
*/
public class MXCIFQuadTree {
private final int leafCapacity;
private final int maxTreeHeight;
private MXCIFQuadTreeNode root;
public MXCIFQuadTree(int leafCapacity, int maxTreeHeight, MXCIFQuadTreeNode root) {
this.leafCapacity = leafCapacity;
this.maxTreeHeight = maxTreeHeight;
this.root = root;
}
public int getLeafCapacity() {
return leafCapacity;
}
public int getMaxTreeHeight() {
return maxTreeHeight;
}
public MXCIFQuadTreeNode getRoot() {
return root;
}
public void setRoot(MXCIFQuadTreeNode root) {
this.root = root;
}
public void clear() {
root = new MXCIFQuadTreeNodeLeaf<>(root.getBb(), root.getLevel(), null, 0);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy