@startuml package com.iluwatar.spatialpartition { class App { - LOGGER : Logger {static} + App() + main(args : String[]) {static} ~ noSpatialPartition(height : int, width : int, numOfMovements : int, bubbles : Hashtable) {static} ~ withSpatialPartition(height : int, width : int, numOfMovements : int, bubbles : Hashtable) {static} } class Bubble { - LOGGER : Logger {static} - RANDOM : Random {static} ~ radius : int ~ Bubble(x : int, y : int, id : int, radius : int) ~ handleCollision(bubblesToCheck : ArrayList>, allBubbles : Hashtable) ~ move() ~ pop(allBubbles : Hashtable) ~ touches(b : Bubble) : boolean } abstract class Point { + coordinateX : int + coordinateY : int + id : int ~ Point(x : int, y : int, id : int) ~ handleCollision(ArrayList>, Hashtable) {abstract} ~ move() {abstract} ~ touches(T) : boolean {abstract} } class QuadTree { ~ boundary : Rect ~ capacity : int ~ divided : boolean ~ northeast : QuadTree ~ northwest : QuadTree ~ points : Hashtable> ~ southeast : QuadTree ~ southwest : QuadTree ~ QuadTree(boundary : Rect, capacity : int) ~ divide() ~ insert(p : Point) ~ query(r : Rect, relevantPoints : ArrayList>) : ArrayList> } class Rect { ~ coordinateX : double ~ coordinateY : double ~ height : double ~ width : double ~ Rect(x : double, y : double, width : double, height : double) ~ contains(p : Point) : boolean ~ intersects(other : Rect) : boolean } class SpatialPartitionBubbles { ~ bubbles : Hashtable ~ quadTree : QuadTree ~ SpatialPartitionBubbles(bubbles : Hashtable, quadTree : QuadTree) ~ handleCollisionsUsingQt(b : Bubble) } abstract class SpatialPartitionGeneric { ~ playerPositions : Hashtable ~ quadTree : QuadTree + SpatialPartitionGeneric() ~ handleCollisionsUsingQt(T) {abstract} } } SpatialPartitionBubbles --> "-quadTree" QuadTree SpatialPartitionGeneric --> "-quadTree" QuadTree QuadTree --> "-boundary" Rect QuadTree --> "-northwest" QuadTree QuadTree --> "-southwest" QuadTree Bubble --|> Point SpatialPartitionBubbles --|> SpatialPartitionGeneric @enduml