public class LinkNet
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
LinkNet.GroupMap |
Constructor and Description |
---|
LinkNet() |
LinkNet(LinkNet src)
Make a copy of a LinkNet
|
Modifier and Type | Method and Description |
---|---|
int |
addBranch(int fromBusNdx,
int toBusNdx)
Add a branch.
|
void |
addBus(int bus)
Explicitly add buses to the system so that isolated buses are tracked
|
void |
addBuses(int[] vbuses)
Explicitly add buses to the system so that isolated buses are tracked
|
void |
addBuses(int startofs,
int count)
Explicitly add buses to the system so that isolated buses are tracked
|
boolean |
eliminateBranch(int brofs)
Remove a branch from service.
|
boolean |
ensureCapacity(int maxBusNdx,
int branchCount)
Ensure there is enough storage for the number of buses and branches
specified.
|
int |
findBranch(int fromBusNdx,
int toBusNdx)
Look for a branch between the two buses.
|
int |
findBranchElim(int fromBusNdx,
int toBusNdx)
Look for a branch between the two buses, even if is marked as eliminated.
|
int[] |
findBranches(int busNdx)
Return all of the branches for a specific bus.
|
int[] |
findBranchesElim(int busNdx)
Return all of the eliminated branches for a specific bus.
|
int[] |
findBuses(int busNdx)
Return the buses connected to the specified bus.
|
int[][] |
findConnections(int busNdx)
Return both buses and branches in a single call.
|
int[][] |
findElimConnections(int busNdx)
Return both buses and branches in a single call for eliminated branches.
|
LinkNet.GroupMap |
findGroupMap() |
int[][] |
findGroups()
Determine all connected groups of buses.
|
void |
forEachInGroup(int startBus,
java.util.function.IntConsumer bf)
Apply a function to each bus located within group as the given bus.
|
int[] |
getAllBuses()
Return an array of all valid bus indexes.
|
int |
getBranchCount()
Return the number of branches in the LinkNet.
|
int[] |
getBusesForBranch(int br)
Return the buses for a branch.
|
int |
getConnectionCount(int busNdx)
Return the number of connections for a bus.
|
int[] |
getConnectionCounts() |
int[] |
getElimConnectionCounts() |
int |
getMaxBusNdx()
Return the maximum bus index used plus 1.
|
static void |
main(java.lang.String[] args)
Just for unit testing.
|
boolean |
restoreBranch(int brofs) |
public static final int Empty
public static final int NoNode
public LinkNet()
public LinkNet(LinkNet src)
src
- public void addBuses(int[] vbuses)
public void addBuses(int startofs, int count)
public void addBus(int bus)
public boolean ensureCapacity(int maxBusNdx, int branchCount)
maxBusNdx
- Maximum bus number to be used.branchCount
- Maximum number of branches.public int getBranchCount()
public int getMaxBusNdx()
public int addBranch(int fromBusNdx, int toBusNdx)
fromBusNdx
- From bus index of branchtoBusNdx
- To bus index of branchpublic int findBranch(int fromBusNdx, int toBusNdx)
fromBusNdx
- From bus indextoBusNdx
- To bus indexpublic int findBranchElim(int fromBusNdx, int toBusNdx)
fromBusNdx
- From bus indextoBusNdx
- To bus indexpublic int getConnectionCount(int busNdx)
busNdx
- public int[] findBranches(int busNdx)
busNdx
- Starting bus.public int[] findBranchesElim(int busNdx)
busNdx
- Starting bus.public int[] findBuses(int busNdx)
busNdx
- Bus to find connections for.public int[][] findConnections(int busNdx)
public int[][] findElimConnections(int busNdx)
public int[] getAllBuses()
public int[] getBusesForBranch(int br)
br
- public int[][] findGroups()
public LinkNet.GroupMap findGroupMap()
public boolean eliminateBranch(int brofs)
brofs
- public boolean restoreBranch(int brofs)
public void forEachInGroup(int startBus, java.util.function.IntConsumer bf)
startBus
- bf
- Function to applypublic static void main(java.lang.String[] args)
args
- public int[] getConnectionCounts()
public int[] getElimConnectionCounts()