ProtoNetwork

class ProtoNetwork<T : Network<T>>(state: NetworkState, val type: NetworkType<T>, val uuid: UUID = UUID.randomUUID(), val nodes: MutableMap<BlockPos, MutableNetworkNodeConnection> = HashMap()) : NetworkData<T>

An uninitialized network that is still in creation.

Constructors

Link copied to clipboard
constructor(state: NetworkState, type: NetworkType<T>, uuid: UUID = UUID.randomUUID(), nodes: MutableMap<BlockPos, MutableNetworkNodeConnection> = HashMap())

Properties

Link copied to clipboard
Link copied to clipboard

Whether this ProtoNetwork has been modified since the last network was built from it.

Link copied to clipboard
lateinit var network: Network<T>

The Network that has been built from this ProtoNetwork.

Link copied to clipboard

The NetworkNodes within this NetworkData and the BlockFaces through which NetworkEndPoints connect to it.

Link copied to clipboard
open override val type: NetworkType<T>

The type of this NetworkData.

Link copied to clipboard
open override val uuid: UUID

The unique identifier of this NetworkData.

Functions

Link copied to clipboard
fun addAll(network: NetworkData<T>)

Adds all ProtoNetwork.nodes of the given ProtoNetwork to this ProtoNetwork. Should only be called for ProtoNetworks of the same type.

Link copied to clipboard

Adds a bridge to this ProtoNetwork.

Link copied to clipboard
fun addEndPoint(endPoint: NetworkNode, faces: Set<BlockFace>): Boolean

Adds faces to the NetworkEndPoint at endPoint.pos, or adds endPoint and faces to the ProtoNetwork.

fun addEndPoint(endPoint: NetworkNode, face: BlockFace): Boolean

Adds face to the NetworkEndPoint at endPoint.pos, or adds endPoint and face to the ProtoNetwork.

Link copied to clipboard

Enlarges the cluster using the ProtoNetworks of nodes. Enlarging a cluster also initializes / updates the clusters of all ProtoNetworks that are clustered with it.

suspend fun enlargeCluster(node: NetworkNode)

Enlarges the cluster using the ProtoNetworks of node. Enlarging a cluster also initializes / updates the clusters of all ProtoNetworks that are clustered with it.

Link copied to clipboard

Creates an immutable copy of this ProtoNetwork.

Link copied to clipboard
suspend fun initCluster()

Completely builds the cluster based on nodes. Building a cluster also initializes / updates the clusters of all ProtoNetworks that are clustered with it.

Link copied to clipboard

Invalidates the cluster of this ProtoNetwork, requiring it to be rebuilt via initCluster.

Link copied to clipboard

Checks whether this ProtoNetwork is empty.

Link copied to clipboard
fun markDirty()

Marks this ProtoNetwork and its cluster as dirty, requiring them to be rebuilt.

Link copied to clipboard

Removes all nodes from this NetworkData.

Link copied to clipboard
fun removeFace(endPoint: NetworkEndPoint, face: BlockFace): Boolean

Removes a face through which the NetworkEndPoint at endPoint.pos connects to this ProtoNetwork.

Link copied to clipboard

Remove the NetworkNode at node.pos from this ProtoNetwork.

Link copied to clipboard
open override fun toString(): String