Commit 9ec27f82 by Tomasz Ciesielczyk

data storage bug fix

parent db231b3a
No preview for this file type
package psnc.m2dc.rtm.commands.java
val APP_VERSION = "1.0.646_62715"
\ No newline at end of file
val APP_VERSION = "1.0.647_42725"
\ No newline at end of file
package psnc.m2dc.rtm.client
const val APP_VERSION = "1.1.646_62715"
\ No newline at end of file
const val APP_VERSION = "1.1.647_42726"
\ No newline at end of file
......@@ -102,6 +102,14 @@ class ResourceDAO(val storage: TreeStorage) {
fun getNodes(): Map<String, Resource> {
val obj = LightStorage.getObjectsTree("nodes")
// val _obj_list= LightStorage.instance.getNodes("nodes")
// val _obj = obj.values.firstOrNull()!!
// val __obj_list=obj.values.first()
// val __obj = _obj.makeObject()
// val ___obj_list=__obj_list.makeObject()
// val ___obj = RTMProperties.JSONParser.fromJson<Resource>(__obj!!.toJsonObj(), object : TypeToken<Resource>() {}.type)
val m = LightStorage.convert<Resource>(obj)
return m.map { it.id to it }.toMap()
}
......
......@@ -139,20 +139,23 @@ object SettingsDAO : DataDAO() {
var suspendPowerUsage: Double? = null
var actions = false
f.forEachLine {
val fields = it.split("\t")
if (it.startsWith("actions")) {
actions = true
}
if (first) {
min0 = fields[0].toDouble()
min100 = fields[2].toDouble()
max0 = fields[1].toDouble()
max100 = fields[3].toDouble()
suspendPowerUsage = fields[4].toDoubleOrNull()
first = false
} else if (!actions) {
if (fields.isNotEmpty()) {
set.add(fields[0].toDouble())
if (!it.startsWith("#")) {
val fields = it.split("\t")
if (it.startsWith("actions")) {
actions = true
//break loop?
}
if (first) {
min0 = fields[0].toDouble()
min100 = fields[2].toDouble()
max0 = fields[1].toDouble()
max100 = fields[3].toDouble()
suspendPowerUsage = fields[4].toDoubleOrNull()
first = false
} else if (!actions) {
if (fields.isNotEmpty()) {
set.add(fields[0].toDouble())
}
}
}
......@@ -174,21 +177,23 @@ object SettingsDAO : DataDAO() {
var first = true
var actions = ""
f.forEachLine { line ->
val lineFields = line.split("\t")
if (first) {
first = false
} else if (!line.startsWith("actions") && actions.isEmpty()) {
cm.setPower(PowerMeasurement.init(
powerSetting = lineFields[0].toDouble(),
modelDetails = pm,
power = lineFields[1].toDoubleOrNull(),
utilization = lineFields[3].toDoubleOrNull() ?: defaultUtilization,
performance = lineFields[2].toDoubleOrNull()
), pm.min0)
} else if (line.startsWith("actions")) {
actions = " "
} else {
actions += line
if (!line.startsWith("#")) {
val lineFields = line.split("\t")
if (first) {
first = false
} else if (!line.startsWith("actions") && actions.isEmpty()) {
cm.setPower(PowerMeasurement.init(
powerSetting = lineFields[0].toDouble(),
modelDetails = pm,
power = lineFields[1].toDoubleOrNull(),
utilization = lineFields[3].toDoubleOrNull() ?: defaultUtilization,
performance = lineFields[2].toDoubleOrNull()
), pm.min0)
} else if (line.startsWith("actions")) {
actions = " "
} else {
actions += line
}
}
}
if (actions.length > 2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment