Skip to content

Commit

Permalink
core: stdcm: remove duplicate block check
Browse files Browse the repository at this point in the history
This is now checked in the infra explorer anyway
(and in a more efficient way)

Signed-off-by: Eloi Charpentier <eloi.charpentier.42@gmail.com>
  • Loading branch information
eckter committed Dec 20, 2024
1 parent 51e20ae commit 7cda595
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal constructor(
*/
fun makeAllEdges(): Collection<STDCMEdge> {
return try {
if (getEnvelope() == null || hasDuplicateBlocks()) {
if (getEnvelope() == null) {
listOf()
} else {
val delays = getDelaysPerOpening()
Expand Down Expand Up @@ -217,17 +217,6 @@ internal constructor(
return if (res == null || graph.delayManager.isRunTimeTooLong(res)) null else res
}

/** Returns true if the current block is already present in the path to this edge */
private fun hasDuplicateBlocks(): Boolean {
var node = prevNode
while (true) {
val prevEdge = node.previousEdge ?: return false
if (!prevEdge.endAtStop && prevEdge.block == infraExplorer.getCurrentBlock())
return true
node = prevEdge.previousNode
}
}

companion object {
fun fromNode(
graph: STDCMGraph,
Expand Down

0 comments on commit 7cda595

Please sign in to comment.