Class Web
- java.lang.Object
-
- com.runemate.game.api.hybrid.location.navigation.web.Web
-
- All Implemented Interfaces:
Renderable
,IWeb
- Direct Known Subclasses:
SerializableWeb
public class Web extends java.lang.Object implements Renderable, IWeb
A graph of nodes and vertices used to build WebPaths for complex navigation. Webs are fast, can operate on regions that are not currently loaded, and can navigate with obstacles and teleports.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addVertex(WebVertex vertex)
void
addVertices(WebVertex... vertices)
Adds the vertices to the appropriate lists (i.e.void
addVertices(java.util.Collection<WebVertex> vertices)
long
countVerticesOn(@NonNull Coordinate coordinate)
long
countVerticesWithin(@NonNull Area area)
WebVertex
getFirstVertexOn(Coordinate coordinate)
<T extends WebVertex>
TgetFirstVertexOn(Coordinate coordinate, java.lang.Class<T> type)
WebVertex
getFirstVertexOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> predicate)
WebPathBuilder
getPathBuilder()
java.util.Collection<TeleportVertex>
getTeleports()
WebVertex
getVertexNearestTo(Locatable locatable)
WebVertex
getVertexNearestTo(Locatable locatable, boolean ignorePlane)
<T extends WebVertex>
TgetVertexNearestTo(Locatable locatable, java.lang.Class<T> type)
<T extends WebVertex>
TgetVertexNearestTo(Locatable locatable, java.lang.Class<T> type, boolean ignorePlane)
WebVertex
getVertexNearestTo(Locatable locatable, java.util.function.Predicate<WebVertex> predicate)
WebVertex
getVertexOn(Coordinate coordinate)
Deprecated.<T extends WebVertex>
TgetVertexOn(Coordinate coordinate, java.lang.Class<T> type)
Deprecated.WebVertex
getVertexOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> predicate)
Deprecated.java.util.List<WebVertex>
getVertices()
<T extends WebVertex>
java.util.List<T>getVertices(java.lang.Class<T> clazz)
@Nullable java.util.List<WebVertex>
getVerticesOn(@NonNull Coordinate coordinate)
<T extends WebVertex>
java.util.List<T>getVerticesOn(Coordinate coordinate, java.lang.Class<T> type)
java.util.List<WebVertex>
getVerticesOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> filter)
java.util.Collection<WebVertex>
getVerticesReachableFrom(WebVertex source)
Uses BFS to calculate the reachable vertices from the given root@NonNull java.util.List<WebVertex>
getVerticesWithin(@NonNull Area area)
<T extends WebVertex>
@NonNull java.util.List<T>getVerticesWithin(@NonNull Area area, java.lang.Class<T> type)
@NonNull java.util.List<WebVertex>
getVerticesWithin(@NonNull Area area, java.util.function.Predicate<WebVertex> predicate)
boolean
hasVerticesOn(@NonNull Coordinate coordinate)
boolean
hasVerticesWithin(@NonNull Area area)
void
removeVertex(WebVertex vertex)
void
removeVertices(WebVertex... vertices)
Removes the vertices from the appropriate lists (i.e.void
removeVertices(java.util.Collection<WebVertex> vertices)
int
removeVertices(java.util.function.Predicate<WebVertex> removal_condition)
void
render(java.awt.Graphics2D g2d)
Renders this entity onto the givenGraphics2D
, use is discouragedvoid
render(javafx.scene.canvas.GraphicsContext gc)
Renders this entity onto the givenGraphicsContext
WebVertex
replaceVertex(WebVertex vertex)
Deprecated.WebVertex
replaceVertex(WebVertex vertex, double cost)
Deprecated.WebVertex
replaceVertex(WebVertex vertex, java.util.function.BiFunction<WebVertex,WebVertex,java.lang.Double> weight_calculator)
Deprecated.java.util.List<WebVertex>
replaceVertices(WebVertex vertex, java.util.function.BiFunction<WebVertex,WebVertex,java.lang.Double> weight_calculator)
void
retainVertices(java.util.Collection<WebVertex> vertices)
-
-
-
Constructor Detail
-
Web
public Web()
-
Web
public Web(int estimatedVertexCount)
-
Web
public Web(java.util.Collection<WebVertex> vertices)
-
-
Method Detail
-
addVertex
public void addVertex(WebVertex vertex)
-
addVertices
public final void addVertices(WebVertex... vertices)
Adds the vertices to the appropriate lists (i.e. basic, teleports, support, etc)
-
addVertices
public void addVertices(java.util.Collection<WebVertex> vertices)
-
getPathBuilder
public WebPathBuilder getPathBuilder()
-
getTeleports
public java.util.Collection<TeleportVertex> getTeleports()
-
getVertexNearestTo
public <T extends WebVertex> T getVertexNearestTo(Locatable locatable, java.lang.Class<T> type)
-
getVertexNearestTo
public <T extends WebVertex> T getVertexNearestTo(Locatable locatable, java.lang.Class<T> type, boolean ignorePlane)
-
getVertexNearestTo
public WebVertex getVertexNearestTo(Locatable locatable, java.util.function.Predicate<WebVertex> predicate)
-
getVertexOn
@Deprecated public WebVertex getVertexOn(Coordinate coordinate)
Deprecated.See Web#getVerticesOn or Web#getFirstVertexOn- Parameters:
coordinate
-- Returns:
-
getFirstVertexOn
public WebVertex getFirstVertexOn(Coordinate coordinate)
-
getFirstVertexOn
public <T extends WebVertex> T getFirstVertexOn(Coordinate coordinate, java.lang.Class<T> type)
-
getFirstVertexOn
public WebVertex getFirstVertexOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> predicate)
-
getVerticesOn
@Nullable public @Nullable java.util.List<WebVertex> getVerticesOn(@NonNull @NonNull Coordinate coordinate)
-
hasVerticesOn
public boolean hasVerticesOn(@NonNull @NonNull Coordinate coordinate)
-
countVerticesOn
public long countVerticesOn(@NonNull @NonNull Coordinate coordinate)
-
getVerticesWithin
@NonNull public @NonNull java.util.List<WebVertex> getVerticesWithin(@NonNull @NonNull Area area)
-
getVerticesWithin
@NonNull public <T extends WebVertex> @NonNull java.util.List<T> getVerticesWithin(@NonNull @NonNull Area area, java.lang.Class<T> type)
-
getVerticesWithin
@NonNull public @NonNull java.util.List<WebVertex> getVerticesWithin(@NonNull @NonNull Area area, java.util.function.Predicate<WebVertex> predicate)
-
hasVerticesWithin
public boolean hasVerticesWithin(@NonNull @NonNull Area area)
-
countVerticesWithin
public long countVerticesWithin(@NonNull @NonNull Area area)
-
getVertexOn
@Deprecated public final WebVertex getVertexOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> predicate)
Deprecated.See Web#getVerticesOn or Web#getFirstVertexOn- Parameters:
coordinate
-- Returns:
-
getVertexOn
@Deprecated public final <T extends WebVertex> T getVertexOn(Coordinate coordinate, java.lang.Class<T> type)
Deprecated.See Web#getVerticesOn or Web#getFirstVertexOn- Parameters:
coordinate
-- Returns:
-
getVerticesOn
public final <T extends WebVertex> java.util.List<T> getVerticesOn(Coordinate coordinate, java.lang.Class<T> type)
-
getVerticesOn
public final java.util.List<WebVertex> getVerticesOn(Coordinate coordinate, java.util.function.Predicate<WebVertex> filter)
-
getVertices
public final <T extends WebVertex> java.util.List<T> getVertices(java.lang.Class<T> clazz)
-
getVertices
public java.util.List<WebVertex> getVertices()
-
getVerticesReachableFrom
public java.util.Collection<WebVertex> getVerticesReachableFrom(WebVertex source)
Uses BFS to calculate the reachable vertices from the given root
-
removeVertex
public final void removeVertex(WebVertex vertex)
-
removeVertices
public final void removeVertices(WebVertex... vertices)
Removes the vertices from the appropriate lists (i.e. basic, bank, or teleports)
-
removeVertices
public final int removeVertices(java.util.function.Predicate<WebVertex> removal_condition)
-
removeVertices
public void removeVertices(java.util.Collection<WebVertex> vertices)
-
retainVertices
public void retainVertices(java.util.Collection<WebVertex> vertices)
-
replaceVertex
@Deprecated public final WebVertex replaceVertex(WebVertex vertex)
Deprecated.See replaceVertices- Parameters:
vertex
-- Returns:
-
replaceVertex
@Deprecated public final WebVertex replaceVertex(WebVertex vertex, double cost)
Deprecated.See replaceVertices- Parameters:
vertex
-- Returns:
-
replaceVertex
@Deprecated public final WebVertex replaceVertex(WebVertex vertex, java.util.function.BiFunction<WebVertex,WebVertex,java.lang.Double> weight_calculator)
Deprecated.See replaceVertices TODO document and improve- Parameters:
vertex
-weight_calculator
-- Returns:
-
replaceVertices
public final java.util.List<WebVertex> replaceVertices(WebVertex vertex, java.util.function.BiFunction<WebVertex,WebVertex,java.lang.Double> weight_calculator)
-
render
public void render(java.awt.Graphics2D g2d)
Description copied from interface:Renderable
Renders this entity onto the givenGraphics2D
, use is discouraged- Specified by:
render
in interfaceRenderable
-
render
public void render(javafx.scene.canvas.GraphicsContext gc)
Description copied from interface:Renderable
Renders this entity onto the givenGraphicsContext
- Specified by:
render
in interfaceRenderable
-
-