- Notifications
You must be signed in to change notification settings - Fork0
Rollczi/LiteIndex
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
💜 LiteIndex - Fast and extensive library for indexing box/area in space by vectors/location/position based on hash indexing.
publicclassMain {publicstaticvoidmain(String[]args) {intSPACE_SIZE =10_000;intAREA_SIZE =80;// create indexSpaceIndex<Area,Location>index =SpaceIndex.<Area,Location>builder() .axisX(location ->location.getX()) .axisZ(location ->location.getZ()) .axisY(location ->location.getY()) .space(area ->area.getMin(),area ->area.getMax()) .indexing(IndexingAlgorithm.calculateOptimal(SPACE_SIZE,AREA_SIZE)) .concurrent(false) .build();// put areas to indexindex.put(newArea(newLocation(0,0,0),newLocation(10,10,10)));index.put(newArea(newLocation(3,3,3),newLocation(7,7,7)));index.put(newArea(newLocation(5,5,5),newLocation(15,15,15)));// fast searchList<Area>areas =index.get(newLocation(5,5,5)); }}
Variables:It's not limit, it's just for optimization and memory saving.
MAP_SIZE
- expected maximum size of spaceAREA_SIZE
- expected maximum size of area
SpaceIndex builder
axisX
- function for gettingX coordinateaxisZ
- function for gettingZ coordinateaxisY
- function for gettingY coordinatespace
- function for gettingmin andmax location from areaindexing
- set indexing algorithm (configure forbetter performance)concurrent
- set concurrent mode (if you want to use index in multiple threads)
SpaceIndex methods
put
- put area to indexget
- get areas by locationgetAll
- get all areas from indexgetFirst
- get first area by locationremove
- remove area from indexremoveAll
- remove all areas from indexcontains
- check if index contains areasize
- get size of index
IndexingAlgorithm
calculateOptimal
- calculate optimal indexing algorithm for your space and area sizechunk
- create indexing algorithm(advanced)
repositories { maven("https://repo.eternalcode.pl/releases")}
dependencies { implementation("dev.rollczi:liteindex:1.0.0")}
<repositories> <repository> <id>eternalcode-repo</id> <url>https://repo.eternalcode.pl/releases</url> </repository></repositories>
<dependencies> <dependency> <groupId>dev.rollczi</groupId> <artifactId>liteindex</artifactId> <version>1.0.0</version> </dependency></dependencies>