From e77c9c8fbc067a6554f45557257c17d5b4f42fc5 Mon Sep 17 00:00:00 2001 From: Daniel Szekeres Date: Fri, 17 Sep 2021 14:08:01 +0200 Subject: [PATCH] modularization done --- build.gradle | 4 - settings.gradle | 2 +- src/main/kotlin/Main.kt | 163 ------------------ src/main/kotlin/cli/CLIMain.kt | 22 +-- src/main/kotlin/sacn/Activity.kt | 22 --- src/main/kotlin/sacn/ActivityCase.kt | 22 --- src/main/kotlin/sacn/ImmediateActivity.kt | 23 --- src/main/kotlin/sacn/InputGate.kt | 24 --- src/main/kotlin/sacn/OutputGate.kt | 24 --- src/main/kotlin/sacn/Place.kt | 22 --- .../kotlin/sacn/StochasticActivityNetwork.kt | 35 ---- .../kotlin/sacn/markingfunctions/Constant.kt | 22 --- .../sacn/markingfunctions/MarkingFunction.kt | 22 --- .../sacn/markingfunctions/PlaceReference.kt | 24 --- .../kotlin/sacn/markingfunctions/Product.kt | 22 --- src/main/kotlin/sacn/markingfunctions/Sum.kt | 22 --- .../sacn/markingpredicates/AndPredicate.kt | 26 --- .../sacn/markingpredicates/Comparison.kt | 24 --- .../markingpredicates/MarkingPredicate.kt | 25 --- stoatt-gspn/build.gradle | 3 + .../src}/main/kotlin/benchmark/examples.kt | 0 .../src}/main/kotlin/cli/FromPNPRO.kt | 0 .../src/main/kotlin/cli/GSPNCli.kt | 21 ++- .../src/main/kotlin/cli/Kanban.kt | 4 - .../src}/main/kotlin/gspn/Arc.kt | 0 .../main/kotlin/gspn/ExponentialTransition.kt | 10 +- .../src}/main/kotlin/gspn/GSPN.kt | 0 .../main/kotlin/gspn/ImmediateTransition.kt | 10 +- .../src}/main/kotlin/gspn/PNPROParser.kt | 0 .../src}/main/kotlin/gspn/Place.kt | 0 .../src}/main/kotlin/gspn/Transition.kt | 0 .../src}/main/kotlin/gspn/dsl.kt | 6 +- .../kotlin/gspn/rateexpressions/Constant.kt | 0 .../kotlin/gspn/rateexpressions/PlaceRef.kt | 0 .../kotlin/gspn/rateexpressions/Product.kt | 2 +- .../gspn/rateexpressions/RateExpression.kt | 0 .../main/kotlin/gspn/rateexpressions/Sum.kt | 0 stoatt-sft/build.gradle | 10 ++ .../src}/main/java/parser/Galileo.interp | 0 .../src}/main/java/parser/Galileo.tokens | 0 .../main/java/parser/GalileoBaseListener.java | 0 .../main/java/parser/GalileoBaseVisitor.java | 0 .../src}/main/java/parser/GalileoLexer.interp | 0 .../src}/main/java/parser/GalileoLexer.java | 0 .../src}/main/java/parser/GalileoLexer.tokens | 0 .../main/java/parser/GalileoListener.java | 0 .../src}/main/java/parser/GalileoParser.java | 20 ++- .../src}/main/java/parser/GalileoVisitor.java | 0 .../kotlin/benchmark/testtreeGenerator.kt | 0 .../src}/main/kotlin/cli/Calc.kt | 0 .../src}/main/kotlin/cli/Gen.kt | 0 .../src/main/kotlin/cli/SFTCli.kt | 18 +- .../kotlin/faulttree/AbstractBasicEvent.kt | 0 .../src}/main/kotlin/faulttree/AndGate.kt | 0 .../src}/main/kotlin/faulttree/BasicEvent.kt | 0 .../src}/main/kotlin/faulttree/DFTVar.kt | 0 .../src}/main/kotlin/faulttree/FaultTree.kt | 0 .../main/kotlin/faulttree/FaultTreeNode.kt | 0 .../kotlin/faulttree/FunctionalDependency.kt | 0 .../src}/main/kotlin/faulttree/OrGate.kt | 0 .../main/kotlin/faulttree/PHBasicEvent.kt | 0 .../main/kotlin/faulttree/PriorityAndGate.kt | 0 .../main/kotlin/faulttree/SequenceEnforcer.kt | 0 .../src}/main/kotlin/faulttree/StaticGate.kt | 0 .../src}/main/kotlin/faulttree/VotingGate.kt | 0 .../main/kotlin/faulttree/faultTreeMetrics.kt | 0 .../main/kotlin/faulttree/galileoParser.kt | 1 - .../main/kotlin/faulttree/kronsumBasedMTFF.kt | 0 .../main/kotlin/parser/GalileoListenerImpl.kt | 0 69 files changed, 83 insertions(+), 572 deletions(-) delete mode 100644 src/main/kotlin/Main.kt delete mode 100644 src/main/kotlin/sacn/Activity.kt delete mode 100644 src/main/kotlin/sacn/ActivityCase.kt delete mode 100644 src/main/kotlin/sacn/ImmediateActivity.kt delete mode 100644 src/main/kotlin/sacn/InputGate.kt delete mode 100644 src/main/kotlin/sacn/OutputGate.kt delete mode 100644 src/main/kotlin/sacn/Place.kt delete mode 100644 src/main/kotlin/sacn/StochasticActivityNetwork.kt delete mode 100644 src/main/kotlin/sacn/markingfunctions/Constant.kt delete mode 100644 src/main/kotlin/sacn/markingfunctions/MarkingFunction.kt delete mode 100644 src/main/kotlin/sacn/markingfunctions/PlaceReference.kt delete mode 100644 src/main/kotlin/sacn/markingfunctions/Product.kt delete mode 100644 src/main/kotlin/sacn/markingfunctions/Sum.kt delete mode 100644 src/main/kotlin/sacn/markingpredicates/AndPredicate.kt delete mode 100644 src/main/kotlin/sacn/markingpredicates/Comparison.kt delete mode 100644 src/main/kotlin/sacn/markingpredicates/MarkingPredicate.kt rename {src => stoatt-gspn/src}/main/kotlin/benchmark/examples.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/cli/FromPNPRO.kt (100%) rename src/main/kotlin/sacn/ExponentialActivity.kt => stoatt-gspn/src/main/kotlin/cli/GSPNCli.kt (68%) rename src/main/kotlin/cli/GSPN.kt => stoatt-gspn/src/main/kotlin/cli/Kanban.kt (98%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/Arc.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/ExponentialTransition.kt (93%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/GSPN.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/ImmediateTransition.kt (93%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/PNPROParser.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/Place.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/Transition.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/dsl.kt (93%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/rateexpressions/Constant.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/rateexpressions/PlaceRef.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/rateexpressions/Product.kt (96%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/rateexpressions/RateExpression.kt (100%) rename {src => stoatt-gspn/src}/main/kotlin/gspn/rateexpressions/Sum.kt (100%) rename {src => stoatt-sft/src}/main/java/parser/Galileo.interp (100%) rename {src => stoatt-sft/src}/main/java/parser/Galileo.tokens (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoBaseListener.java (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoBaseVisitor.java (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoLexer.interp (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoLexer.java (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoLexer.tokens (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoListener.java (100%) rename {src => stoatt-sft/src}/main/java/parser/GalileoParser.java (98%) rename {src => stoatt-sft/src}/main/java/parser/GalileoVisitor.java (100%) rename {src => stoatt-sft/src}/main/kotlin/benchmark/testtreeGenerator.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/cli/Calc.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/cli/Gen.kt (100%) rename src/main/kotlin/sacn/markingpredicates/OrPredicate.kt => stoatt-sft/src/main/kotlin/cli/SFTCli.kt (68%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/AbstractBasicEvent.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/AndGate.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/BasicEvent.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/DFTVar.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/FaultTree.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/FaultTreeNode.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/FunctionalDependency.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/OrGate.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/PHBasicEvent.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/PriorityAndGate.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/SequenceEnforcer.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/StaticGate.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/VotingGate.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/faultTreeMetrics.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/galileoParser.kt (98%) rename {src => stoatt-sft/src}/main/kotlin/faulttree/kronsumBasedMTFF.kt (100%) rename {src => stoatt-sft/src}/main/kotlin/parser/GalileoListenerImpl.kt (100%) diff --git a/build.gradle b/build.gradle index 5befd08..3c40e70 100644 --- a/build.gradle +++ b/build.gradle @@ -22,11 +22,7 @@ shadowJar { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - compile group: 'org.ejml', name: 'ejml-all', version: '0.39' - compile "delta:hu.bme.mit.delta: 0.0.1" - compile "org.antlr:antlr4-runtime:4.9.1" compile 'com.github.ajalt:clikt:2.3.0' - compile 'hu.bme.mit.inf:turnout-petrinet_2.12:0.1.0-SNAPSHOT' implementation 'hu.bme.mit.inf.stoatt:stoatt-core' implementation 'hu.bme.mit.inf.stoatt:stoatt-sft' diff --git a/settings.gradle b/settings.gradle index 0d5dcc5..32982b4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'SToATT' +rootProject.name = 'StoATT' includeBuild '/delta/hu.bme.mit.delta.collections' includeBuild '/delta/hu.bme.mit.delta' diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt deleted file mode 100644 index 83ed7ce..0000000 --- a/src/main/kotlin/Main.kt +++ /dev/null @@ -1,163 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - -import MDDExtensions.GSCompaction -import faulttree.BasicEvent -import faulttree.FaultTree -import faulttree.FaultTreeNode -import gspn.PetriNet -import gspn.Place -import gspn.Transition -import gspn.arc -import hu.bme.mit.delta.mdd.MddBuilder -import hu.bme.mit.delta.mdd.MddHandle -import org.ejml.simple.SimpleMatrix -import solver.ALSSolve -import solver.TTSquareMatrix -import solver.TTVector -import solver.solvers.AMEnALSSolve -import java.util.* -import kotlin.math.abs - -fun main(args: Array) { - - val N = PetriNet { - val A = p("A", 1) - val B = p("B", 0) - timed("AtoB", 30.0) { - input(arc(A, 1)) - out(arc(B, 1)) - } - timed("BtoA", 10.0) { - input(arc(B, 1)) - out(arc(A, 1)) - } - } - val sparse = true -// val sparse = false - val ss = if(!sparse) N.getSteadyStateDistribution(true, 0.0) { A -> - AMEnALSSolve( - A = A, - y = TTVector.zeros(A.modes), - residualThreshold = 1e-7, - maxSweeps = 50, - enrichmentRank = 2, - normalize = true, - verbose = true, - useApproxResidualForStopping = false - ) - } else N.getSteadyStateDistributionSparse(true, false) - ss.printElements() -} - -private fun compactionTest() { - val A = BasicEvent("A", 0.5) - val B = BasicEvent("B", 0.5) - val C = BasicEvent("C", 0.5) - val D = BasicEvent("D", 0.5) - val E = BasicEvent("E", 0.5) - val FT = FaultTree((A and B) or (C and D) and E) - val f = FT.nonFailureAsMdd() - val varOrdering = FT.getVariableOrdering() - val builder = MddBuilder(varOrdering.createSignatureFromTraceInfos(listOf("A", "B"))) - var c = builder.build(listOf(arrayOf(1, 1), arrayOf(1, 0), arrayOf(0, 1)), true) - c = c.union(MddBuilder(varOrdering.defaultSetSignature).build(Array(varOrdering.size) { 0 }, false)) - val compacted = GSCompaction.apply(f, c) - for (a in 0..1) - for (b in 0..1) - for (c1 in 0..1) - for (d in 0..1) - for (e in 0..1) - if (compacted[a, b, c1, d, e].data != f[a, b, c1, d, e].data) { - println("[$a, $b, $c1, $d, $e]: f=${f[a, b, c1, d, e].data} comp=${compacted[a, b, c1, d, e].data} care=${c[a, b, c1, d, e].data}") - } - return -} - -fun faultTreeGrowthTest() { - val rand = Random(123) - var topNode: FaultTreeNode = BasicEvent("ev0", rand.nextDouble() * 10.0) - for (i in 1..40) { - println("Number of leaves: ${i + 1}") - topNode = topNode and BasicEvent("ev$i", rand.nextDouble() * 10.0) - if (i < 28) continue - val ft = FaultTree(topNode) - val A = ft.getModifiedGenerator() - A.tt.roundRelative(1e-30) - val b = ft.getOperationalIndicatorVector() - val r = 3 - val ones = TTVector.ones(b.modes) - var x0 = TTVector.ones(b.modes) - for (j in 0 until r) { - x0 = x0 + x0.hadamard(ones) - } - x0.divAssign(r.toDouble()) - val relativeThreshold = 0.0001 - val residualThreshold = relativeThreshold * b.norm() - println(residualThreshold) -// val y = TTReGMRES(A, b, x0, 0.0001, verbose = true) - val y = ALSSolve(A, b, x0, residualThreshold, 15) - println() - } -} - -fun generateSPN(nPlaces: Int, nTransitions: Int, capacities: Int, minRate: Double = 1.0, maxRate: Double = 10.0) { - val rand = Random() - val p = arrayListOf() - repeat(nPlaces) { - p.add(Place("p$it", capacities)) - } - val t = arrayListOf() - repeat(nTransitions) { - val inps = rand.nextInt(4) - val outs = rand.nextInt(4) - } -} - -fun report(A: TTSquareMatrix, b: TTVector, x: TTVector, threshold: Double) = - report(A::times, b, x, threshold) - -fun report(linearMap: (TTVector) -> TTVector, b: TTVector, x: TTVector, threshold: Double) { - println("results:") - val resNorm = (b - linearMap(x)).norm() - println("residual norm: $resNorm ${if (resNorm < threshold) "<" else ">"} $threshold (threshold)") - println("relative residual norm: ${resNorm / b.norm()}") - print("solution vector: ") - if (x.numElements < 100) { - x.printElements(); println() - } else - println("First element: ${x[0]}") - println("TT ranks of the result: ${x.tt.cores.map { it.rows }}") - print("Non-nullness in absorbing states: ${x.tt.hadamard((TTVector.ones(x.modes) - b).tt).frobenius()}") - println() - println() -} - -private val rand = Random() -fun randSquareMtx(size: Int): SimpleMatrix { - return SimpleMatrix.random_DDRM(size, size, 0.0, 10.0, rand) -} - -fun SimpleMatrix.roundZeros(threshold: Double = 1E-14) { - for (i in 0 until numRows()) { - for (j in 0 until numCols()) { - if (abs(this[i, j]) < threshold) this[i, j] = 0.0 - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/cli/CLIMain.kt b/src/main/kotlin/cli/CLIMain.kt index 3f21c37..bbb2f02 100644 --- a/src/main/kotlin/cli/CLIMain.kt +++ b/src/main/kotlin/cli/CLIMain.kt @@ -21,18 +21,20 @@ package cli import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.subcommands -class TTReliabilityTool : CliktCommand() { +class StoATT : CliktCommand() { + override fun run() = Unit +} +class sft : CliktCommand() { + override fun run() = Unit +} + +class gspn : CliktCommand() { override fun run() = Unit } fun main(args: Array) = - TTReliabilityTool() - .subcommands( - Gen(), - Calc(), - GSPN().subcommands( - Kanban(), - FromPNPRO() - ) - ).main(args) + StoATT().subcommands( + sft().subcommands(Gen(), Calc()), + gspn().subcommands(Kanban(), FromPNPRO()) + ).main(args) diff --git a/src/main/kotlin/sacn/Activity.kt b/src/main/kotlin/sacn/Activity.kt deleted file mode 100644 index f339e2d..0000000 --- a/src/main/kotlin/sacn/Activity.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -abstract class Activity(val inputGates: ArrayList, val cases: ArrayList) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/ActivityCase.kt b/src/main/kotlin/sacn/ActivityCase.kt deleted file mode 100644 index 4b3592b..0000000 --- a/src/main/kotlin/sacn/ActivityCase.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -class ActivityCase(val weight: Double, val outputGates: ArrayList) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/ImmediateActivity.kt b/src/main/kotlin/sacn/ImmediateActivity.kt deleted file mode 100644 index 61e6933..0000000 --- a/src/main/kotlin/sacn/ImmediateActivity.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -class ImmediateActivity(inputGates: ArrayList, cases: ArrayList, val priority: Int) : - Activity(inputGates, cases) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/InputGate.kt b/src/main/kotlin/sacn/InputGate.kt deleted file mode 100644 index 2a2a863..0000000 --- a/src/main/kotlin/sacn/InputGate.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -import sacn.markingpredicates.MarkingPredicate - -class InputGate(val inputPlaces: ArrayList, val enablingFunction: MarkingPredicate) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/OutputGate.kt b/src/main/kotlin/sacn/OutputGate.kt deleted file mode 100644 index 07bbef7..0000000 --- a/src/main/kotlin/sacn/OutputGate.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -import sacn.markingfunctions.MarkingFunction - -class OutputGate(val outputPlaces: ArrayList, val outputFunction: Map) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/Place.kt b/src/main/kotlin/sacn/Place.kt deleted file mode 100644 index 9d242e9..0000000 --- a/src/main/kotlin/sacn/Place.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -class Place { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/StochasticActivityNetwork.kt b/src/main/kotlin/sacn/StochasticActivityNetwork.kt deleted file mode 100644 index 3c7a7d9..0000000 --- a/src/main/kotlin/sacn/StochasticActivityNetwork.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn - -class StochasticActivityNetwork(val places: ArrayList, val activities: ArrayList) { - init { - //TODO: references in expressions - if(activities.any { - it.inputGates.any { - it.inputPlaces.any { it !in places } - } || - it.cases.any { - it.outputGates.any { - it.outputPlaces.any { it !in places } - } - } - }) throw RuntimeException("Error: not all places referenced by activities are contained in the place list!") - } -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingfunctions/Constant.kt b/src/main/kotlin/sacn/markingfunctions/Constant.kt deleted file mode 100644 index b0b3e01..0000000 --- a/src/main/kotlin/sacn/markingfunctions/Constant.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingfunctions - -class Constant(val value: Double): MarkingFunction() { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingfunctions/MarkingFunction.kt b/src/main/kotlin/sacn/markingfunctions/MarkingFunction.kt deleted file mode 100644 index 04bacc5..0000000 --- a/src/main/kotlin/sacn/markingfunctions/MarkingFunction.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingfunctions - -abstract class MarkingFunction { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingfunctions/PlaceReference.kt b/src/main/kotlin/sacn/markingfunctions/PlaceReference.kt deleted file mode 100644 index 54f2a84..0000000 --- a/src/main/kotlin/sacn/markingfunctions/PlaceReference.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingfunctions - -import sacn.Place - -class PlaceReference(val place: Place): MarkingFunction() { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingfunctions/Product.kt b/src/main/kotlin/sacn/markingfunctions/Product.kt deleted file mode 100644 index a3c71c4..0000000 --- a/src/main/kotlin/sacn/markingfunctions/Product.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingfunctions - -class Product(vararg val inputs: MarkingFunction) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingfunctions/Sum.kt b/src/main/kotlin/sacn/markingfunctions/Sum.kt deleted file mode 100644 index f6e9efd..0000000 --- a/src/main/kotlin/sacn/markingfunctions/Sum.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingfunctions - -class Sum(vararg val inputs: MarkingFunction): MarkingFunction() { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingpredicates/AndPredicate.kt b/src/main/kotlin/sacn/markingpredicates/AndPredicate.kt deleted file mode 100644 index 816ea9b..0000000 --- a/src/main/kotlin/sacn/markingpredicates/AndPredicate.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingpredicates - -import sacn.Place - -class AndPredicate(vararg val inputs: MarkingPredicate): MarkingPredicate() { - override fun getReferencedPlaces(): Set = - inputs.fold(setOf()) {acc, next -> acc.union(next.getReferencedPlaces())} -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingpredicates/Comparison.kt b/src/main/kotlin/sacn/markingpredicates/Comparison.kt deleted file mode 100644 index c660b3c..0000000 --- a/src/main/kotlin/sacn/markingpredicates/Comparison.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingpredicates - -import sacn.markingfunctions.MarkingFunction - -class Comparison(val smaller: MarkingFunction, val larger: MarkingFunction) { -} \ No newline at end of file diff --git a/src/main/kotlin/sacn/markingpredicates/MarkingPredicate.kt b/src/main/kotlin/sacn/markingpredicates/MarkingPredicate.kt deleted file mode 100644 index 8f0e583..0000000 --- a/src/main/kotlin/sacn/markingpredicates/MarkingPredicate.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * Copyright 2021 Budapest University of Technology and Economics - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package sacn.markingpredicates - -import sacn.Place - -abstract class MarkingPredicate { - abstract fun getReferencedPlaces(): Set -} \ No newline at end of file diff --git a/stoatt-gspn/build.gradle b/stoatt-gspn/build.gradle index 99b5ed6..d4e957a 100644 --- a/stoatt-gspn/build.gradle +++ b/stoatt-gspn/build.gradle @@ -18,8 +18,11 @@ plugins { id 'org.jetbrains.kotlin.jvm' version '1.3.50' + id 'application' } +mainClassName = 'cli.GSPNCliKt' + group 'hu.bme.mit.inf.stoatt' repositories { diff --git a/src/main/kotlin/benchmark/examples.kt b/stoatt-gspn/src/main/kotlin/benchmark/examples.kt similarity index 100% rename from src/main/kotlin/benchmark/examples.kt rename to stoatt-gspn/src/main/kotlin/benchmark/examples.kt diff --git a/src/main/kotlin/cli/FromPNPRO.kt b/stoatt-gspn/src/main/kotlin/cli/FromPNPRO.kt similarity index 100% rename from src/main/kotlin/cli/FromPNPRO.kt rename to stoatt-gspn/src/main/kotlin/cli/FromPNPRO.kt diff --git a/src/main/kotlin/sacn/ExponentialActivity.kt b/stoatt-gspn/src/main/kotlin/cli/GSPNCli.kt similarity index 68% rename from src/main/kotlin/sacn/ExponentialActivity.kt rename to stoatt-gspn/src/main/kotlin/cli/GSPNCli.kt index b0b317a..35b008c 100644 --- a/src/main/kotlin/sacn/ExponentialActivity.kt +++ b/stoatt-gspn/src/main/kotlin/cli/GSPNCli.kt @@ -16,13 +16,18 @@ * */ -package sacn +package cli -import gspn.rateexpressions.RateExpression +import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.subcommands -class ExponentialActivity( - inputGates: ArrayList, - cases: ArrayList, - rate: RateExpression -) : Activity(inputGates, cases) { -} \ No newline at end of file +class GSPNCli : CliktCommand() { + override fun run() = Unit +} + +fun main(args: Array) = + GSPNCli() + .subcommands( + Kanban(), + FromPNPRO() + ).main(args) diff --git a/src/main/kotlin/cli/GSPN.kt b/stoatt-gspn/src/main/kotlin/cli/Kanban.kt similarity index 98% rename from src/main/kotlin/cli/GSPN.kt rename to stoatt-gspn/src/main/kotlin/cli/Kanban.kt index b841730..ef59425 100644 --- a/src/main/kotlin/cli/GSPN.kt +++ b/stoatt-gspn/src/main/kotlin/cli/Kanban.kt @@ -33,10 +33,6 @@ import solver.TTVector import solver.product import kotlin.random.Random -class GSPN: CliktCommand() { - override fun run() = Unit -} - class Kanban: CliktCommand() { val N by argument().int().restrictTo(min = 1) val random by option().flag(default = false) diff --git a/src/main/kotlin/gspn/Arc.kt b/stoatt-gspn/src/main/kotlin/gspn/Arc.kt similarity index 100% rename from src/main/kotlin/gspn/Arc.kt rename to stoatt-gspn/src/main/kotlin/gspn/Arc.kt diff --git a/src/main/kotlin/gspn/ExponentialTransition.kt b/stoatt-gspn/src/main/kotlin/gspn/ExponentialTransition.kt similarity index 93% rename from src/main/kotlin/gspn/ExponentialTransition.kt rename to stoatt-gspn/src/main/kotlin/gspn/ExponentialTransition.kt index 5ee16b1..1384012 100644 --- a/src/main/kotlin/gspn/ExponentialTransition.kt +++ b/stoatt-gspn/src/main/kotlin/gspn/ExponentialTransition.kt @@ -25,11 +25,11 @@ import solver.TTSquareMatrix import solver.TensorTrain class ExponentialTransition( - name: String, - inputs: ArrayList, - outputs: ArrayList, - inhibitors: ArrayList, - val rate: RateExpression + name: String, + inputs: ArrayList, + outputs: ArrayList, + inhibitors: ArrayList, + val rate: RateExpression ) : Transition(name, inputs, outputs, inhibitors) { override fun toTT(varOrder: MddVariableOrder, places: ArrayList): TTSquareMatrix { diff --git a/src/main/kotlin/gspn/GSPN.kt b/stoatt-gspn/src/main/kotlin/gspn/GSPN.kt similarity index 100% rename from src/main/kotlin/gspn/GSPN.kt rename to stoatt-gspn/src/main/kotlin/gspn/GSPN.kt diff --git a/src/main/kotlin/gspn/ImmediateTransition.kt b/stoatt-gspn/src/main/kotlin/gspn/ImmediateTransition.kt similarity index 93% rename from src/main/kotlin/gspn/ImmediateTransition.kt rename to stoatt-gspn/src/main/kotlin/gspn/ImmediateTransition.kt index 9e0f9d2..dfe1e63 100644 --- a/src/main/kotlin/gspn/ImmediateTransition.kt +++ b/stoatt-gspn/src/main/kotlin/gspn/ImmediateTransition.kt @@ -25,11 +25,11 @@ import solver.TTVector import solver.TensorTrain class ImmediateTransition( - name: String, - inputs: ArrayList, - outputs: ArrayList, - inhibitors: ArrayList, - val priority: Int + name: String, + inputs: ArrayList, + outputs: ArrayList, + inhibitors: ArrayList, + val priority: Int ) : Transition(name, inputs, outputs, inhibitors) { override fun toTT(varOrder: MddVariableOrder, places: ArrayList): TTSquareMatrix { val rateVector = TTVector.ones(places.map { it.capacity+1 }.toTypedArray()) diff --git a/src/main/kotlin/gspn/PNPROParser.kt b/stoatt-gspn/src/main/kotlin/gspn/PNPROParser.kt similarity index 100% rename from src/main/kotlin/gspn/PNPROParser.kt rename to stoatt-gspn/src/main/kotlin/gspn/PNPROParser.kt diff --git a/src/main/kotlin/gspn/Place.kt b/stoatt-gspn/src/main/kotlin/gspn/Place.kt similarity index 100% rename from src/main/kotlin/gspn/Place.kt rename to stoatt-gspn/src/main/kotlin/gspn/Place.kt diff --git a/src/main/kotlin/gspn/Transition.kt b/stoatt-gspn/src/main/kotlin/gspn/Transition.kt similarity index 100% rename from src/main/kotlin/gspn/Transition.kt rename to stoatt-gspn/src/main/kotlin/gspn/Transition.kt diff --git a/src/main/kotlin/gspn/dsl.kt b/stoatt-gspn/src/main/kotlin/gspn/dsl.kt similarity index 93% rename from src/main/kotlin/gspn/dsl.kt rename to stoatt-gspn/src/main/kotlin/gspn/dsl.kt index fc7c9a7..c0ea1cb 100644 --- a/src/main/kotlin/gspn/dsl.kt +++ b/stoatt-gspn/src/main/kotlin/gspn/dsl.kt @@ -62,10 +62,10 @@ object PetriNet { operator fun RateExpression.plus(d: Double) = this + Constant(d) operator fun Double.plus(r: RateExpression) = r + Constant(this) operator fun RateExpression.minus(d: Double) = this + Constant(-d) -operator fun RateExpression.times(d: Double) = this*Constant(d) +operator fun RateExpression.times(d: Double) = this* Constant(d) operator fun Double.times(r: RateExpression) = r*this -operator fun Double.times(place: Place) = this*PlaceRef(place) -operator fun Place.times(d: Double) = PlaceRef(this)*d +operator fun Double.times(place: Place) = this* PlaceRef(place) +operator fun Place.times(d: Double) = PlaceRef(this) *d operator fun RateExpression.times(place: Place) = this * PlaceRef(place) fun arc(place: Place, weight: Int = 1) = Arc.ConstantArc(place, weight) fun reset(place: Place, resetTo: Int) = Arc.ResetArc(place, resetTo) \ No newline at end of file diff --git a/src/main/kotlin/gspn/rateexpressions/Constant.kt b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Constant.kt similarity index 100% rename from src/main/kotlin/gspn/rateexpressions/Constant.kt rename to stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Constant.kt diff --git a/src/main/kotlin/gspn/rateexpressions/PlaceRef.kt b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/PlaceRef.kt similarity index 100% rename from src/main/kotlin/gspn/rateexpressions/PlaceRef.kt rename to stoatt-gspn/src/main/kotlin/gspn/rateexpressions/PlaceRef.kt diff --git a/src/main/kotlin/gspn/rateexpressions/Product.kt b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Product.kt similarity index 96% rename from src/main/kotlin/gspn/rateexpressions/Product.kt rename to stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Product.kt index f9a4f5c..5f36407 100644 --- a/src/main/kotlin/gspn/rateexpressions/Product.kt +++ b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Product.kt @@ -65,7 +65,7 @@ class Product(val terms: List) : RateExpression() { } return@map core }.toMutableList() - val c = terms.filterIsInstance().fold(1.0) {acc, next -> acc * next.value} + val c = terms.filterIsInstance().fold(1.0) { acc, next -> acc * next.value} return TTVector(TensorTrain(ArrayList(cores))) * c } diff --git a/src/main/kotlin/gspn/rateexpressions/RateExpression.kt b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/RateExpression.kt similarity index 100% rename from src/main/kotlin/gspn/rateexpressions/RateExpression.kt rename to stoatt-gspn/src/main/kotlin/gspn/rateexpressions/RateExpression.kt diff --git a/src/main/kotlin/gspn/rateexpressions/Sum.kt b/stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Sum.kt similarity index 100% rename from src/main/kotlin/gspn/rateexpressions/Sum.kt rename to stoatt-gspn/src/main/kotlin/gspn/rateexpressions/Sum.kt diff --git a/stoatt-sft/build.gradle b/stoatt-sft/build.gradle index 8991776..230c88c 100644 --- a/stoatt-sft/build.gradle +++ b/stoatt-sft/build.gradle @@ -19,8 +19,11 @@ plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.3.50' + id 'application' } +mainClassName = 'cli.SFTCliKt' + repositories { mavenCentral() } @@ -37,3 +40,10 @@ compileJava { sourceCompatibility = 11 targetCompatibility = 11 } + +compileKotlin { + kotlinOptions.jvmTarget = "11" +} +compileTestKotlin { + kotlinOptions.jvmTarget = "11" +} \ No newline at end of file diff --git a/src/main/java/parser/Galileo.interp b/stoatt-sft/src/main/java/parser/Galileo.interp similarity index 100% rename from src/main/java/parser/Galileo.interp rename to stoatt-sft/src/main/java/parser/Galileo.interp diff --git a/src/main/java/parser/Galileo.tokens b/stoatt-sft/src/main/java/parser/Galileo.tokens similarity index 100% rename from src/main/java/parser/Galileo.tokens rename to stoatt-sft/src/main/java/parser/Galileo.tokens diff --git a/src/main/java/parser/GalileoBaseListener.java b/stoatt-sft/src/main/java/parser/GalileoBaseListener.java similarity index 100% rename from src/main/java/parser/GalileoBaseListener.java rename to stoatt-sft/src/main/java/parser/GalileoBaseListener.java diff --git a/src/main/java/parser/GalileoBaseVisitor.java b/stoatt-sft/src/main/java/parser/GalileoBaseVisitor.java similarity index 100% rename from src/main/java/parser/GalileoBaseVisitor.java rename to stoatt-sft/src/main/java/parser/GalileoBaseVisitor.java diff --git a/src/main/java/parser/GalileoLexer.interp b/stoatt-sft/src/main/java/parser/GalileoLexer.interp similarity index 100% rename from src/main/java/parser/GalileoLexer.interp rename to stoatt-sft/src/main/java/parser/GalileoLexer.interp diff --git a/src/main/java/parser/GalileoLexer.java b/stoatt-sft/src/main/java/parser/GalileoLexer.java similarity index 100% rename from src/main/java/parser/GalileoLexer.java rename to stoatt-sft/src/main/java/parser/GalileoLexer.java diff --git a/src/main/java/parser/GalileoLexer.tokens b/stoatt-sft/src/main/java/parser/GalileoLexer.tokens similarity index 100% rename from src/main/java/parser/GalileoLexer.tokens rename to stoatt-sft/src/main/java/parser/GalileoLexer.tokens diff --git a/src/main/java/parser/GalileoListener.java b/stoatt-sft/src/main/java/parser/GalileoListener.java similarity index 100% rename from src/main/java/parser/GalileoListener.java rename to stoatt-sft/src/main/java/parser/GalileoListener.java diff --git a/src/main/java/parser/GalileoParser.java b/stoatt-sft/src/main/java/parser/GalileoParser.java similarity index 98% rename from src/main/java/parser/GalileoParser.java rename to stoatt-sft/src/main/java/parser/GalileoParser.java index ef19b6e..aa4e8c5 100644 --- a/src/main/java/parser/GalileoParser.java +++ b/stoatt-sft/src/main/java/parser/GalileoParser.java @@ -1,12 +1,28 @@ +/* + * + * Copyright 2021 Budapest University of Technology and Economics + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + // Generated from E:/egyetem/onlab_tdk/Impl/Linalg/src/main/antlr\Galileo.g4 by ANTLR 4.9.1 package parser; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; import java.util.List; -import java.util.Iterator; import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) diff --git a/src/main/java/parser/GalileoVisitor.java b/stoatt-sft/src/main/java/parser/GalileoVisitor.java similarity index 100% rename from src/main/java/parser/GalileoVisitor.java rename to stoatt-sft/src/main/java/parser/GalileoVisitor.java diff --git a/src/main/kotlin/benchmark/testtreeGenerator.kt b/stoatt-sft/src/main/kotlin/benchmark/testtreeGenerator.kt similarity index 100% rename from src/main/kotlin/benchmark/testtreeGenerator.kt rename to stoatt-sft/src/main/kotlin/benchmark/testtreeGenerator.kt diff --git a/src/main/kotlin/cli/Calc.kt b/stoatt-sft/src/main/kotlin/cli/Calc.kt similarity index 100% rename from src/main/kotlin/cli/Calc.kt rename to stoatt-sft/src/main/kotlin/cli/Calc.kt diff --git a/src/main/kotlin/cli/Gen.kt b/stoatt-sft/src/main/kotlin/cli/Gen.kt similarity index 100% rename from src/main/kotlin/cli/Gen.kt rename to stoatt-sft/src/main/kotlin/cli/Gen.kt diff --git a/src/main/kotlin/sacn/markingpredicates/OrPredicate.kt b/stoatt-sft/src/main/kotlin/cli/SFTCli.kt similarity index 68% rename from src/main/kotlin/sacn/markingpredicates/OrPredicate.kt rename to stoatt-sft/src/main/kotlin/cli/SFTCli.kt index dc36ad0..325f07e 100644 --- a/src/main/kotlin/sacn/markingpredicates/OrPredicate.kt +++ b/stoatt-sft/src/main/kotlin/cli/SFTCli.kt @@ -16,12 +16,18 @@ * */ -package sacn.markingpredicates +package cli -import sacn.Place +import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.core.subcommands -class OrPredicate(vararg val inputs: MarkingPredicate): MarkingPredicate() { - override fun getReferencedPlaces(): Set = - inputs.fold(setOf()) {acc, next -> acc.union(next.getReferencedPlaces())} +class SFTCli : CliktCommand() { + override fun run() = Unit +} -} \ No newline at end of file +fun main(args: Array) = + SFTCli() + .subcommands( + Gen(), + Calc() + ).main(args) diff --git a/src/main/kotlin/faulttree/AbstractBasicEvent.kt b/stoatt-sft/src/main/kotlin/faulttree/AbstractBasicEvent.kt similarity index 100% rename from src/main/kotlin/faulttree/AbstractBasicEvent.kt rename to stoatt-sft/src/main/kotlin/faulttree/AbstractBasicEvent.kt diff --git a/src/main/kotlin/faulttree/AndGate.kt b/stoatt-sft/src/main/kotlin/faulttree/AndGate.kt similarity index 100% rename from src/main/kotlin/faulttree/AndGate.kt rename to stoatt-sft/src/main/kotlin/faulttree/AndGate.kt diff --git a/src/main/kotlin/faulttree/BasicEvent.kt b/stoatt-sft/src/main/kotlin/faulttree/BasicEvent.kt similarity index 100% rename from src/main/kotlin/faulttree/BasicEvent.kt rename to stoatt-sft/src/main/kotlin/faulttree/BasicEvent.kt diff --git a/src/main/kotlin/faulttree/DFTVar.kt b/stoatt-sft/src/main/kotlin/faulttree/DFTVar.kt similarity index 100% rename from src/main/kotlin/faulttree/DFTVar.kt rename to stoatt-sft/src/main/kotlin/faulttree/DFTVar.kt diff --git a/src/main/kotlin/faulttree/FaultTree.kt b/stoatt-sft/src/main/kotlin/faulttree/FaultTree.kt similarity index 100% rename from src/main/kotlin/faulttree/FaultTree.kt rename to stoatt-sft/src/main/kotlin/faulttree/FaultTree.kt diff --git a/src/main/kotlin/faulttree/FaultTreeNode.kt b/stoatt-sft/src/main/kotlin/faulttree/FaultTreeNode.kt similarity index 100% rename from src/main/kotlin/faulttree/FaultTreeNode.kt rename to stoatt-sft/src/main/kotlin/faulttree/FaultTreeNode.kt diff --git a/src/main/kotlin/faulttree/FunctionalDependency.kt b/stoatt-sft/src/main/kotlin/faulttree/FunctionalDependency.kt similarity index 100% rename from src/main/kotlin/faulttree/FunctionalDependency.kt rename to stoatt-sft/src/main/kotlin/faulttree/FunctionalDependency.kt diff --git a/src/main/kotlin/faulttree/OrGate.kt b/stoatt-sft/src/main/kotlin/faulttree/OrGate.kt similarity index 100% rename from src/main/kotlin/faulttree/OrGate.kt rename to stoatt-sft/src/main/kotlin/faulttree/OrGate.kt diff --git a/src/main/kotlin/faulttree/PHBasicEvent.kt b/stoatt-sft/src/main/kotlin/faulttree/PHBasicEvent.kt similarity index 100% rename from src/main/kotlin/faulttree/PHBasicEvent.kt rename to stoatt-sft/src/main/kotlin/faulttree/PHBasicEvent.kt diff --git a/src/main/kotlin/faulttree/PriorityAndGate.kt b/stoatt-sft/src/main/kotlin/faulttree/PriorityAndGate.kt similarity index 100% rename from src/main/kotlin/faulttree/PriorityAndGate.kt rename to stoatt-sft/src/main/kotlin/faulttree/PriorityAndGate.kt diff --git a/src/main/kotlin/faulttree/SequenceEnforcer.kt b/stoatt-sft/src/main/kotlin/faulttree/SequenceEnforcer.kt similarity index 100% rename from src/main/kotlin/faulttree/SequenceEnforcer.kt rename to stoatt-sft/src/main/kotlin/faulttree/SequenceEnforcer.kt diff --git a/src/main/kotlin/faulttree/StaticGate.kt b/stoatt-sft/src/main/kotlin/faulttree/StaticGate.kt similarity index 100% rename from src/main/kotlin/faulttree/StaticGate.kt rename to stoatt-sft/src/main/kotlin/faulttree/StaticGate.kt diff --git a/src/main/kotlin/faulttree/VotingGate.kt b/stoatt-sft/src/main/kotlin/faulttree/VotingGate.kt similarity index 100% rename from src/main/kotlin/faulttree/VotingGate.kt rename to stoatt-sft/src/main/kotlin/faulttree/VotingGate.kt diff --git a/src/main/kotlin/faulttree/faultTreeMetrics.kt b/stoatt-sft/src/main/kotlin/faulttree/faultTreeMetrics.kt similarity index 100% rename from src/main/kotlin/faulttree/faultTreeMetrics.kt rename to stoatt-sft/src/main/kotlin/faulttree/faultTreeMetrics.kt diff --git a/src/main/kotlin/faulttree/galileoParser.kt b/stoatt-sft/src/main/kotlin/faulttree/galileoParser.kt similarity index 98% rename from src/main/kotlin/faulttree/galileoParser.kt rename to stoatt-sft/src/main/kotlin/faulttree/galileoParser.kt index 7548efd..5b7c6ef 100644 --- a/src/main/kotlin/faulttree/galileoParser.kt +++ b/stoatt-sft/src/main/kotlin/faulttree/galileoParser.kt @@ -25,7 +25,6 @@ import parser.GalileoLexer import parser.GalileoListenerImpl import parser.GalileoParser import java.io.InputStream -import java.util.* object galileoParser { fun parse(stream: InputStream): FaultTree { diff --git a/src/main/kotlin/faulttree/kronsumBasedMTFF.kt b/stoatt-sft/src/main/kotlin/faulttree/kronsumBasedMTFF.kt similarity index 100% rename from src/main/kotlin/faulttree/kronsumBasedMTFF.kt rename to stoatt-sft/src/main/kotlin/faulttree/kronsumBasedMTFF.kt diff --git a/src/main/kotlin/parser/GalileoListenerImpl.kt b/stoatt-sft/src/main/kotlin/parser/GalileoListenerImpl.kt similarity index 100% rename from src/main/kotlin/parser/GalileoListenerImpl.kt rename to stoatt-sft/src/main/kotlin/parser/GalileoListenerImpl.kt