Commit b82233e9 authored by Noric Couderc's avatar Noric Couderc
Browse files

Changed how we print method invocations

Depending of the format we use, we'll print different things when
printing to CSV.
parent a2113828
package se.lth.cs.util
import se.lth.cs.papicounters.PAPICounter
import se.lth.cs.printFunction
import se.lth.cs.timing.OperationType
import se.lth.cs.timing.OperationTypeTable
......@@ -16,7 +17,7 @@ import se.lth.cs.timing.OperationTypeTable
*
*/
abstract class Feature {
fun toCSVFeature() : String {
open fun toCSVFeature() : String {
val s = this.toString()
if (s.contains(",")) {
return "\"%s\"".format(s)
......@@ -97,11 +98,23 @@ class FeatureRatio(val f1 : Feature, val f2 : Feature) : Feature() {
}
}
class MethodInvocations(val method : String) : Feature() {
class MethodInvocations(val method : String, val methodPrintFormat : String) : Feature() {
override fun featureType(): Type {
return Type.SOFTWARE
}
fun getMethodName(name : String): String {
return when (methodPrintFormat) {
"JAVA-STANDARD-FORMAT" -> printFunction(name)
"SYNTHETIC-RUN-FORMAT" -> name
else -> throw IllegalArgumentException("Format '$methodPrintFormat' was not recognized.")
}
}
override fun toCSVFeature() : String {
return getMethodName(method)
}
override fun accept(visitor: FeatureVisitor) {
visitor.visitMethodInvocations(this)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment