.github
abstract-document
abstract-factory
acyclic-visitor
adapter
aggregator-microservices
ambassador
api-gateway
arrange-act-assert
async-method-invocation
balking
bridge
builder
business-delegate
bytecode
caching
callback
chain
circuit-breaker
collection-pipeline
combinator
command
commander
composite
converter
cqrs
dao
data-bus
data-locality
data-mapper
data-transfer-object
decorator
delegation
dependency-injection
dirty-flag
double-buffer
double-checked-locking
double-dispatch
eip-aggregator
eip-message-channel
eip-publish-subscribe
eip-splitter
eip-wire-tap
etc
event-aggregator
event-asynchronous
event-driven-architecture
event-queue
event-sourcing
execute-around
extension-objects
facade
factory-kit
factory-method
feature-toggle
fluentinterface
flux
flyweight
front-controller
game-loop
guarded-suspension
half-sync-half-async
hexagonal
intercepting-filter
interpreter
iterator
layers
lazy-loading
leader-election
leader-followers
marker
master-worker-pattern
mediator
memento
model-view-controller
model-view-presenter
module
monad
monostate
multiton
mute-idiom
mutex
naked-objects
null-object
object-mother
object-pool
observer
page-object
partial-response
pipeline
poison-pill
priority-queue
private-class-data
producer-consumer
promise
property
prototype
proxy
queue-load-leveling
reactor
reader-writer-lock
repository
resource-acquisition-is-initialization
retry
role-object
saga
semaphore
servant
serverless
service-layer
service-locator
sharding
singleton
spatial-partition
etc
spatial-partition.urm.png
spatial-partition.urm.puml
src
README.md
pom.xml
specification
state
step-builder
strangler
strategy
subclass-sandbox
template-method
thread-pool
throttling
tls
tolerant-reader
trampoline
twin
typeobjectpattern
unit-of-work
update-method
value-object
visitor
zh
.all-contributorsrc
.gitignore
CONTRIBUTING.MD
LICENSE.md
PULL_REQUEST_TEMPLATE.md
README.md
checkstyle-suppressions.xml
license-plugin-header-style.xml
pom.xml
72 lines
2.4 KiB
Plaintext
72 lines
2.4 KiB
Plaintext
![]() |
@startuml
|
||
|
package com.iluwatar.spatialpartition {
|
||
|
class App {
|
||
|
- LOGGER : Logger {static}
|
||
|
+ App()
|
||
|
+ main(args : String[]) {static}
|
||
|
~ noSpatialPartition(height : int, width : int, numOfMovements : int, bubbles : Hashtable<Integer, Bubble>) {static}
|
||
|
~ withSpatialPartition(height : int, width : int, numOfMovements : int, bubbles : Hashtable<Integer, Bubble>) {static}
|
||
|
}
|
||
|
class Bubble {
|
||
|
- LOGGER : Logger {static}
|
||
|
- RANDOM : Random {static}
|
||
|
~ radius : int
|
||
|
~ Bubble(x : int, y : int, id : int, radius : int)
|
||
|
~ handleCollision(bubblesToCheck : ArrayList<Point<T>>, allBubbles : Hashtable<Integer, Bubble>)
|
||
|
~ move()
|
||
|
~ pop(allBubbles : Hashtable<Integer, Bubble>)
|
||
|
~ touches(b : Bubble) : boolean
|
||
|
}
|
||
|
abstract class Point<T> {
|
||
|
+ coordinateX : int
|
||
|
+ coordinateY : int
|
||
|
+ id : int
|
||
|
~ Point<T>(x : int, y : int, id : int)
|
||
|
~ handleCollision(ArrayList<Point<T>>, Hashtable<Integer, T>) {abstract}
|
||
|
~ move() {abstract}
|
||
|
~ touches(T) : boolean {abstract}
|
||
|
}
|
||
|
class QuadTree {
|
||
|
~ boundary : Rect
|
||
|
~ capacity : int
|
||
|
~ divided : boolean
|
||
|
~ northeast : QuadTree
|
||
|
~ northwest : QuadTree
|
||
|
~ points : Hashtable<Integer, Point<T>>
|
||
|
~ southeast : QuadTree
|
||
|
~ southwest : QuadTree
|
||
|
~ QuadTree(boundary : Rect, capacity : int)
|
||
|
~ divide()
|
||
|
~ insert(p : Point<T>)
|
||
|
~ query(r : Rect, relevantPoints : ArrayList<Point<T>>) : ArrayList<Point<T>>
|
||
|
}
|
||
|
class Rect {
|
||
|
~ coordinateX : double
|
||
|
~ coordinateY : double
|
||
|
~ height : double
|
||
|
~ width : double
|
||
|
~ Rect(x : double, y : double, width : double, height : double)
|
||
|
~ contains(p : Point<T>) : boolean
|
||
|
~ intersects(other : Rect) : boolean
|
||
|
}
|
||
|
class SpatialPartitionBubbles {
|
||
|
~ bubbles : Hashtable<Integer, Bubble>
|
||
|
~ quadTree : QuadTree
|
||
|
~ SpatialPartitionBubbles(bubbles : Hashtable<Integer, Bubble>, quadTree : QuadTree)
|
||
|
~ handleCollisionsUsingQt(b : Bubble)
|
||
|
}
|
||
|
abstract class SpatialPartitionGeneric<T> {
|
||
|
~ playerPositions : Hashtable<Integer, T>
|
||
|
~ quadTree : QuadTree
|
||
|
+ SpatialPartitionGeneric<T>()
|
||
|
~ handleCollisionsUsingQt(T) {abstract}
|
||
|
}
|
||
|
}
|
||
|
SpatialPartitionBubbles --> "-quadTree" QuadTree
|
||
|
SpatialPartitionGeneric --> "-quadTree" QuadTree
|
||
|
QuadTree --> "-boundary" Rect
|
||
|
QuadTree --> "-northwest" QuadTree
|
||
|
QuadTree --> "-southwest" QuadTree
|
||
|
Bubble --|> Point
|
||
|
SpatialPartitionBubbles --|> SpatialPartitionGeneric
|
||
|
@enduml
|