Class Network
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.network.Network
An abstract Network class to manage networks in a stateful way
- Author:
- meiamsome, TheBusyBiscuit
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
abstract NetworkComponent
This method assigns the givenLocation
a type ofNetworkComponent
for classification.boolean
void
display()
abstract int
getRange()
This method returns the range of theNetwork
.int
getSize()
This returns the size of thisNetwork
.void
abstract void
onClassificationChange
(Location l, NetworkComponent from, NetworkComponent to) void
tick()
This method updates thisNetwork
and serves as the starting point for any running operations.
-
Field Details
-
regulator
-
regulatorNodes
-
connectorNodes
-
terminusNodes
-
-
Constructor Details
-
Network
- Parameters:
manager
- TheNetworkManager
instanceregulator
- TheLocation
marking the regulator of thisNetwork
.
-
-
Method Details
-
getRange
public abstract int getRange()This method returns the range of theNetwork
. The range determines how far theNetwork
will search for nearby nodes from any given node. It basically translates to the maximum distance between nodes.- Returns:
- the range of this
Network
-
classifyLocation
This method assigns the givenLocation
a type ofNetworkComponent
for classification.- Parameters:
l
- TheLocation
to classify- Returns:
- The assigned type of
NetworkComponent
for thisLocation
-
onClassificationChange
- Parameters:
l
- TheLocation
that is changing its classificationfrom
- TheNetworkComponent
thisLocation
was previously classified asto
- TheNetworkComponent
thisLocation
is changing to
-
getSize
public int getSize()This returns the size of thisNetwork
. It is equivalent to the amount ofLocations
connected to thisNetwork
.- Returns:
- The size of this
Network
-
addLocationToNetwork
- Parameters:
l
- TheLocation
to add
-
markDirty
- Parameters:
l
- TheLocation
to update
-
connectsTo
-
display
public void display() -
getRegulator
- Returns:
- The
Location
of our regulator
-
tick
public void tick()This method updates thisNetwork
and serves as the starting point for any running operations.
-