Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sonc.quad;
- import java.util.HashSet;
- import java.util.Set;
- public class PointQuadtree<T extends HasPoint> extends java.lang.Object
- {
- Trie<T> root;
- PointQuadtree(double topLeftX, double topLeftY, double bottomRightX, double bottomRightY)
- {
- root = new LeafTrie<T>(topLeftX, topLeftY, bottomRightX, bottomRightY);
- }
- public void delete(T point)
- {
- root.delete(point);
- }
- public T find(T point)
- {
- return root.find(point);
- }
- public Set<T> findNear(double x, double y, double radius)
- {
- Set<T> pointsInCircule = new HashSet<T>();
- root.collectNear(x, y, radius, pointsInCircule);
- return pointsInCircule;
- }
- public Set<T> getAll()
- {
- Set<T> pointsInTree = new HashSet<T>();
- root.collectAll(pointsInTree);
- return pointsInTree;
- }
- public void insert(T point)
- {
- root = root.insert(point);
- }
- public void insertReplace(T point)
- {
- root = root.insertReplace(point);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement