From 39b8a9aefdd679d3a1db66d8a5d906bb20b7f549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csan=C3=A1d=20Telbisz?= Date: Thu, 2 Nov 2023 22:40:38 +0100 Subject: [PATCH] xcfa procedure builder getters --- .../hu/bme/mit/theta/xcfa/model/Builders.kt | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/model/Builders.kt b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/model/Builders.kt index 6de9e40a60..b0dbbac1d2 100644 --- a/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/model/Builders.kt +++ b/subprojects/xcfa/xcfa/src/main/java/hu/bme/mit/theta/xcfa/model/Builders.kt @@ -83,10 +83,29 @@ class XcfaProcedureBuilder @JvmOverloads constructor( private lateinit var optimized: XcfaProcedureBuilder private lateinit var partlyOptimized: XcfaProcedureBuilder private var lastOptimized: Int = -1 - fun getParams(): List, ParamDirection>> = if (this::optimized.isInitialized) optimized.params else params - fun getVars(): Set> = if (this::optimized.isInitialized) optimized.vars else vars - fun getLocs(): Set = if (this::optimized.isInitialized) optimized.locs else locs - fun getEdges(): Set = if (this::optimized.isInitialized) optimized.edges else edges + fun getParams(): List, ParamDirection>> = when { + this::optimized.isInitialized -> optimized.params + this::partlyOptimized.isInitialized -> partlyOptimized.params + else -> params + } + + fun getVars(): Set> = when { + this::optimized.isInitialized -> optimized.vars + this::partlyOptimized.isInitialized -> partlyOptimized.vars + else -> vars + } + + fun getLocs(): Set = when { + this::optimized.isInitialized -> optimized.locs + this::partlyOptimized.isInitialized -> partlyOptimized.locs + else -> locs + } + + fun getEdges(): Set = when { + this::optimized.isInitialized -> optimized.edges + this::partlyOptimized.isInitialized -> partlyOptimized.edges + else -> edges + } fun optimize() { if (!this::optimized.isInitialized) {