From 8a45cc4517e22563783d602e9f79a010c0d83b03 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 19 Apr 2018 16:24:35 +0300 Subject: [PATCH] Cosmetic changes in meta structure. JSON changed to json-simple and moved to separate module. --- .../src/main/java/inr/numass/client/Cli.java | 2 +- .../numass/control/cryotemp/PKT8Channel.kt | 4 ++-- .../inr/numass/control/cryotemp/PKT8Device.kt | 4 ++-- .../inr/numass/control/dante/DanteClient.kt | 2 +- .../inr/numass/control/magnet/LambdaMagnet.kt | 14 +++++------ .../numass/control/magnet/fx/MagnetDisplay.kt | 8 +++---- .../inr/numass/control/msp/MspDevice.kt | 6 ++--- .../inr/numass/control/msp/MspDisplay.kt | 6 ++--- .../kotlin/inr/numass/control/FXExtensions.kt | 4 ++-- .../numass/control/readvac/MKSVacDevice.kt | 2 +- .../inr/numass/control/readvac/VacDisplay.kt | 6 ++--- .../kotlin/inr/numass/data/NumassDataUtils.kt | 2 +- .../kotlin/inr/numass/data/SpectrumAdapter.kt | 8 +++---- .../numass/data/analyzers/NumassAnalyzer.kt | 12 +++++----- .../kotlin/inr/numass/data/api/NumassPoint.kt | 4 ++-- .../kotlin/inr/numass/data/api/NumassSet.kt | 2 +- .../numass/data/storage/ClassicNumassPoint.kt | 6 ++--- .../numass/data/storage/NumassDataLoader.kt | 4 ++-- .../numass/data/storage/ProtoNumassPoint.kt | 2 +- .../numass/scripts/temp/JoinSpectra.groovy | 4 ++-- .../plotfit/PlotFitResultAction.java | 2 +- .../numass/actions/MonitorCorrectAction.java | 24 +++++++++---------- .../inr/numass/data/SpectrumGenerator.java | 2 +- .../inr/numass/data/SpectrumInformation.java | 2 +- .../inr/numass/utils/UnderflowCorrection.java | 2 +- .../src/main/kotlin/inr/numass/NumassUtils.kt | 10 ++++---- .../inr/numass/actions/MergeDataAction.kt | 14 +++++------ .../inr/numass/actions/SummaryAction.kt | 4 ++-- .../main/kotlin/inr/numass/data/Generator.kt | 4 ++-- .../numass/scripts/DifferentialSpectrum.kt | 2 +- .../inr/numass/scripts/utils/ScanTree.kt | 4 ++-- .../inr/numass/subthreshold/Threshold.kt | 2 +- .../numass/tasks/NumassFitScanSummaryTask.kt | 2 +- .../inr/numass/tasks/NumassFitScanTask.kt | 14 +++++------ .../kotlin/inr/numass/tasks/NumassTasks.kt | 2 +- .../java/inr/numass/server/HandlerUtils.java | 2 +- .../java/inr/numass/server/NumassNote.java | 2 +- .../inr/numass/server/NumassRootHandler.java | 1 - .../inr/numass/scripts/TestClient.groovy | 1 - .../numass/scripts/TestFileTransfer.groovy | 1 - .../inr/numass/scripts/TestNotes.groovy | 1 - .../numass/scripts/TestRemoteClient.groovy | 1 - .../inr/numass/scripts/TestStateChange.groovy | 1 - .../numass/scripts/TestStorageAccess.groovy | 1 - .../main/kotlin/inr/numass/viewer/HVView.kt | 2 +- .../kotlin/inr/numass/viewer/SpectrumView.kt | 2 +- 46 files changed, 100 insertions(+), 107 deletions(-) diff --git a/numass-client/src/main/java/inr/numass/client/Cli.java b/numass-client/src/main/java/inr/numass/client/Cli.java index c2bd6dfc..12a46ead 100644 --- a/numass-client/src/main/java/inr/numass/client/Cli.java +++ b/numass-client/src/main/java/inr/numass/client/Cli.java @@ -69,7 +69,7 @@ public class Cli { String stateName = args[1]; Map states = client.getStates(stateName); if (states != null) { - System.out.println(states.get(stateName).stringValue()); + System.out.println(states.get(stateName).getString()); } else { System.out.println("Error: operaton failed"); } diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Channel.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Channel.kt index fb11ca06..c438444d 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Channel.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Channel.kt @@ -32,10 +32,10 @@ internal fun createChannel(meta: Meta): PKT8Channel { if (meta.hasValue("coefs")) { when (transformationType) { "default", "hyperbolic" -> { - val coefs = meta.getValue("coefs").listValue() + val coefs = meta.getValue("coefs").getList() val r0 = meta.getDouble("r0", 1000.0) return PKT8Channel(meta) { r -> - coefs?.indices?.sumByDouble { coefs[it].doubleValue() * Math.pow(r0 / r, it.toDouble()) } ?: -1.0 + coefs?.indices?.sumByDouble { coefs[it].getDouble() * Math.pow(r0 / r, it.toDouble()) } ?: -1.0 } } else -> throw RuntimeException("Unknown transformation type") diff --git a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt index 427470af..6e932dc8 100644 --- a/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt +++ b/numass-control/cryotemp/src/main/kotlin/inr/numass/control/cryotemp/PKT8Device.kt @@ -122,8 +122,8 @@ class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) { //update parameters from meta meta.optValue("pga").ifPresent { - logger.info("Setting dynamic range to " + it.intValue()) - val response = sendAndWait("g" + it.intValue()).trim { it <= ' ' } + logger.info("Setting dynamic range to " + it.getInt()) + val response = sendAndWait("g" + it.getInt()).trim { it <= ' ' } if (response.contains("=")) { updateState(PGA, Integer.parseInt(response.substring(4))) } else { diff --git a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt index 052dde81..22fc89fd 100644 --- a/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt +++ b/numass-control/dante/src/main/kotlin/inr/numass/control/dante/DanteClient.kt @@ -284,7 +284,7 @@ class DanteClient(val ip: String, chainLength: Int) : AutoCloseable { val en_fil_flattop = meta.getInt("energy_filter.flat_top") val fast_peak_time = meta.getInt("fast_filter.peaking_time") val fast_flattop = meta.getInt("fast_filter.flat_top") - val recovery_time = meta.getValue("recovery_time").longValue() + val recovery_time = meta.getValue("recovery_time").getLong() val zero_peak_rate = meta.getInt("zero_peak_rate") val inverted_input = meta.getInt("inverted_input", 0) diff --git a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt index 592eaa14..29d69c79 100644 --- a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt +++ b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/LambdaMagnet.kt @@ -84,26 +84,26 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A //output values of current and voltage private var outCurrent by valueState("outCurrent", getter = { s2d(controller.getParameter(address, "PC")) }) { _, value -> - setCurrent(value.doubleValue()) + setCurrent(value.getDouble()) return@valueState value }.doubleDelegate private var outVoltage = valueState("outVoltage", getter = { s2d(controller.getParameter(address, "PV")) }) { _, value -> - if (!controller.setParameter(address, "PV", value.doubleValue())) { + if (!controller.setParameter(address, "PV", value.getDouble())) { notifyError("Can't set the target voltage") } return@valueState value }.doubleDelegate val output = valueState("output", getter = { controller.talk(address, "OUT?") == "OK" }) { _, value -> - setOutputMode(value.booleanValue()) - if (!value.booleanValue()) { + setOutputMode(value.getBoolean()) + if (!value.getBoolean()) { status = MagnetStatus.OFF } } val monitoring = valueState("monitoring", getter = { monitorTask != null }) { _, value -> - if (value.booleanValue()) { + if (value.getBoolean()) { startMonitorTask() } else { stopMonitorTask() @@ -115,7 +115,7 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A * */ val updating = valueState("updating", getter = { updateTask != null }) { _, value -> - if (value.booleanValue()) { + if (value.getBoolean()) { startUpdateTask() } else { stopUpdateTask() @@ -235,7 +235,7 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A stopUpdateTask() updateTask = repeatOnDeviceThread(Duration.ofMillis(delay)) { try { - val measuredI = current.readBlocking().doubleValue() + val measuredI = current.readBlocking().getDouble() val targetI = target.doubleValue if (Math.abs(measuredI - targetI) > CURRENT_PRECISION) { val nextI = nextI(measuredI, targetI) diff --git a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt index a4c74390..b2eb959b 100644 --- a/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt +++ b/numass-control/magnet/src/main/kotlin/inr/numass/control/magnet/fx/MagnetDisplay.kt @@ -90,13 +90,13 @@ class MagnetDisplay : DeviceDisplayFX() { device.states.getState("status")?.onChange{ runLater { - this.statusLabel.text = it.stringValue() + this.statusLabel.text = it.getString() } } device.output.onChange { Platform.runLater { - if (it.booleanValue()) { + if (it.getBoolean()) { this.statusLabel.textFill = Color.BLUE } else { this.statusLabel.textFill = Color.BLACK @@ -105,7 +105,7 @@ class MagnetDisplay : DeviceDisplayFX() { } device.updating.onChange { - val updateTaskRunning = it.booleanValue() + val updateTaskRunning = it.getBoolean() runLater { this.setButton.isSelected = updateTaskRunning targetIField.isDisable = updateTaskRunning @@ -114,7 +114,7 @@ class MagnetDisplay : DeviceDisplayFX() { device.monitoring.onChange { runLater { - monitorButton.isScaleShape = it.booleanValue() + monitorButton.isScaleShape = it.getBoolean() } } diff --git a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt index 3dda5007..5fe4ec47 100644 --- a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt +++ b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDevice.kt @@ -69,17 +69,17 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { val controlled = valueState(CONTROLLED_STATE) { value -> runOnDeviceThread { - val res = control(value.booleanValue()) + val res = control(value.getBoolean()) updateState(CONTROLLED_STATE, res) } } val filament = valueState("filament") { value -> - selectFilament(value.intValue()) + selectFilament(value.getInt()) } val filamentOn = valueState("filamentOn") { value -> - setFilamentOn(value.booleanValue()) + setFilamentOn(value.getBoolean()) } var peakJumpZero: Double by valueState("peakJump.zero").doubleDelegate diff --git a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt index 385a7e49..128346b0 100644 --- a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt +++ b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt @@ -141,7 +141,7 @@ class MspDisplay() : DeviceDisplayFX(), NamedValueListener { device.filamentOn.asBooleanProperty().bindBidirectional(selectedProperty()) } deviceStateIndicator(this@MspDisplay, "filamentStatus", false) { - when (it.stringValue()) { + when (it.getString()) { "ON" -> Paint.valueOf("red") "OFF" -> Paint.valueOf("blue") "WARM-UP", "COOL-DOWN" -> Paint.valueOf("yellow") @@ -185,13 +185,13 @@ class MspDisplay() : DeviceDisplayFX(), NamedValueListener { val pl = plottables[change.key] as TimePlot? val value = change.valueAdded if (pl != null) { - if (value.doubleValue() > 0) { + if (value.getDouble() > 0) { pl.put(value) } else { pl.put(Value.NULL) } val titleBase = pl.config.getString("titleBase") - val title = String.format("%s (%.4g)", titleBase, value.doubleValue()) + val title = String.format("%s (%.4g)", titleBase, value.getDouble()) pl.configureValue("title", title) } } diff --git a/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt b/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt index 5cf53e9d..65851bfd 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/FXExtensions.kt @@ -81,7 +81,7 @@ fun Indicator.bind(connection: DeviceDisplayFX<*>, state: String, transform: ((V bind(connection.valueStateProperty(state)) { when { it.isNull -> Color.GRAY - it.booleanValue() -> Color.GREEN + it.getBoolean() -> Color.GREEN else -> Color.RED } } @@ -119,7 +119,7 @@ fun Node.deviceStateToggle(connection: DeviceDisplayFX<*>, state: String, title: } connection.valueStateProperty(state).onChange { runLater { - isSelected = it?.booleanValue() ?: false + isSelected = it?.getBoolean() ?: false } } } diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt index 508bc0f4..36c92f07 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/MKSVacDevice.kt @@ -41,7 +41,7 @@ class MKSVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) { var power by valueState("power", getter = { talk("FP?") == "ON" }) { old, value -> if (old != value) { - setPowerOn(value.booleanValue()) + setPowerOn(value.getBoolean()) } }.booleanDelegate diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacDisplay.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacDisplay.kt index d618b019..68e9e20c 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacDisplay.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacDisplay.kt @@ -67,7 +67,7 @@ open class VacDisplay : DeviceDisplayFX() { // Sensor.MEASUREMENT_RESULT_STATE -> { // if(state.getBoolean(Sensor.RESULT_SUCCESS)) { // val res by state.value(Sensor.RESULT_VALUE) -// val time by state.timeValue(Sensor.RESULT_TIMESTAMP) +// val time by state.getTime(Sensor.RESULT_TIMESTAMP) // onResult(res, time) // } else{ // Platform.runLater { @@ -76,7 +76,7 @@ open class VacDisplay : DeviceDisplayFX() { // } // } // Sensor.MEASUREMENT_ERROR_STATE -> { -// val message by state.stringValue("message") +// val message by state.getString("message") // message(message) // } // } @@ -135,7 +135,7 @@ open class VacDisplay : DeviceDisplayFX() { prefHeight = 60.0 alignment = Pos.CENTER_RIGHT textProperty().bind(valueProperty) - device.meta.optValue("color").ifPresent { colorValue -> textFill = Color.valueOf(colorValue.stringValue()) } + device.meta.optValue("color").ifPresent { colorValue -> textFill = Color.valueOf(colorValue.getString()) } style { fontSize = 24.pt fontWeight = FontWeight.BOLD diff --git a/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt b/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt index 424c3598..06a461b5 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt @@ -67,7 +67,7 @@ val NumassBlock.channel: Int? get() = if (this is ProtoBlock) { this.channel } else { - this.meta.optValue("channel").map { it.intValue() }.nullable + this.meta.optValue("channel").map { it.getInt() }.nullable } diff --git a/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt b/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt index 522c1d73..12b2b8a6 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/SpectrumAdapter.kt @@ -51,7 +51,7 @@ class SpectrumAdapter : BasicAdapter { } fun getTime(point: Values): Double { - return this.optComponent(point, POINT_LENGTH_NAME).map { it.doubleValue() }.orElse(1.0) + return this.optComponent(point, POINT_LENGTH_NAME).map { it.getDouble() }.orElse(1.0) } fun buildSpectrumDataPoint(x: Double, count: Long, t: Double): Values { @@ -69,14 +69,14 @@ class SpectrumAdapter : BasicAdapter { when (component) { "count" -> return super.optComponent(values, Y_VALUE_KEY) Y_VALUE_KEY -> return super.optComponent(values, Y_VALUE_KEY) - .map { it -> it.doubleValue() / getTime(values) } + .map { it -> it.getDouble() / getTime(values) } .map { Value.of(it) } Y_ERROR_KEY -> { val err = super.optComponent(values, Y_ERROR_KEY) return if (err.isPresent) { - Optional.of(Value.of(err.get().doubleValue() / getTime(values))) + Optional.of(Value.of(err.get().getDouble() / getTime(values))) } else { - val y = getComponent(values, Y_VALUE_KEY).doubleValue() + val y = getComponent(values, Y_VALUE_KEY).getDouble() if (y < 0) { Optional.empty() } else if (y == 0.0) { diff --git a/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt b/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt index 95bec135..5b06723c 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/analyzers/NumassAnalyzer.kt @@ -85,7 +85,7 @@ interface NumassAnalyzer { * @return */ fun getCount(block: NumassBlock, config: Meta): Long { - return analyze(block, config).getValue(COUNT_KEY).numberValue().toLong() + return analyze(block, config).getValue(COUNT_KEY).getNumber().toLong() } /** @@ -96,7 +96,7 @@ interface NumassAnalyzer { * @return */ fun getLength(block: NumassBlock, config: Meta): Long { - return analyze(block, config).getValue(LENGTH_KEY).numberValue().toLong() + return analyze(block, config).getValue(LENGTH_KEY).getNumber().toLong() } fun getAmplitudeSpectrum(block: NumassBlock, config: Meta): Table { @@ -133,7 +133,7 @@ interface NumassAnalyzer { fun Table.countInWindow(loChannel: Short, upChannel: Short): Long { return this.rows.filter { row -> row.getInt(NumassAnalyzer.CHANNEL_KEY) in loChannel..(upChannel - 1) - }.mapToLong { it -> it.getValue(NumassAnalyzer.COUNT_KEY).numberValue().toLong() }.sum() + }.mapToLong { it -> it.getValue(NumassAnalyzer.COUNT_KEY).getNumber().toLong() }.sum() } /** @@ -200,10 +200,10 @@ fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = nu val builder = ListTable.Builder(format) var chan = loChannel - ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.min().orElse(0) + ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.getInt() }.min().orElse(0) val top = upChannel - ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.max().orElse(1) + ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.getInt() }.max().orElse(1) while (chan < top - binSize) { val count = AtomicLong(0) @@ -216,7 +216,7 @@ fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = nu this.rows.filter { row -> row.getInt(NumassAnalyzer.CHANNEL_KEY) in binLo..(binUp - 1) }.forEach { row -> - count.addAndGet(row.getValue(NumassAnalyzer.COUNT_KEY, 0).longValue()) + count.addAndGet(row.getValue(NumassAnalyzer.COUNT_KEY, 0).getLong()) countRate.accumulateAndGet(row.getDouble(NumassAnalyzer.COUNT_RATE_KEY, 0.0)) { d1, d2 -> d1 + d2 } countRateDispersion.accumulateAndGet(Math.pow(row.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY, 0.0), 2.0)) { d1, d2 -> d1 + d2 } } diff --git a/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt index e63b117b..ca9260c1 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/api/NumassPoint.kt @@ -45,7 +45,7 @@ interface NumassPoint : Metoid, NumassBlock { * @return */ override val startTime: Instant - get() = meta.optValue(START_TIME_KEY).map { it.timeValue() }.orElseGet { firstBlock.startTime } + get() = meta.optValue(START_TIME_KEY).map { it.getTime() }.orElseGet { firstBlock.startTime } /** * Get the length key of meta or calculate length as a sum of block lengths. The latter could be a bit slow @@ -54,7 +54,7 @@ interface NumassPoint : Metoid, NumassBlock { */ override val length: Duration get() = Duration.ofNanos( - meta.optValue(LENGTH_KEY).map { it.longValue() } + meta.optValue(LENGTH_KEY).map { it.getLong() } .orElseGet { blocks.mapToLong { it -> it.length.toNanos() }.sum() } ) diff --git a/numass-core/src/main/kotlin/inr/numass/data/api/NumassSet.kt b/numass-core/src/main/kotlin/inr/numass/data/api/NumassSet.kt index 3ac8ca51..33155ba9 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/api/NumassSet.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/api/NumassSet.kt @@ -39,7 +39,7 @@ interface NumassSet : Named, Metoid, Iterable, Provider { * @return */ val startTime: Instant - get() = meta.optValue(NumassPoint.START_TIME_KEY).map{ it.timeValue() }.orElseGet { firstPoint.startTime } + get() = meta.optValue(NumassPoint.START_TIME_KEY).map{ it.getTime() }.orElseGet { firstPoint.startTime } val hvData: Optional get() = Optional.empty() diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt index 30cf79be..64176af4 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/ClassicNumassPoint.kt @@ -31,16 +31,16 @@ class ClassicNumassPoint(private val envelope: Envelope) : NumassPoint { override val blocks: Stream get() { val length: Long = if (envelope.meta.hasValue("external_meta.acquisition_time")) { - envelope.meta.getValue("external_meta.acquisition_time").longValue() + envelope.meta.getValue("external_meta.acquisition_time").getLong() } else { - envelope.meta.getValue("acquisition_time").longValue() + envelope.meta.getValue("acquisition_time").getLong() } return Stream.of(ClassicBlock(startTime, Duration.ofSeconds(length))) } override val startTime: Instant get() = if (meta.hasValue("start_time")) { - meta.getValue("start_time").timeValue() + meta.getValue("start_time").getTime() } else { super.startTime } diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt index e4566910..82b29fe7 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/NumassDataLoader.kt @@ -111,7 +111,7 @@ class NumassDataLoader( } override val startTime: Instant - get() = meta.optValue("start_time").map { it.timeValue() }.orElseGet { super.startTime } + get() = meta.optValue("start_time").map { it.getTime() }.orElseGet { super.startTime } override val isOpen: Boolean @@ -178,7 +178,7 @@ class NumassDataLoader( */ private fun readTime(meta: Meta): Instant { return if (meta.hasValue("start_time")) { - meta.getValue("start_time").timeValue() + meta.getValue("start_time").getTime() } else { Instant.EPOCH } diff --git a/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt b/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt index 4aca7c95..ce14f825 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/storage/ProtoNumassPoint.kt @@ -42,7 +42,7 @@ class ProtoNumassPoint(val proto: NumassProto.Point, override val meta: Meta) : override val startTime: Instant get() = if (meta.hasValue("start_time")) { - meta.getValue("start_time").timeValue() + meta.getValue("start_time").getTime() } else { super.startTime } diff --git a/numass-main/src/main/groovy/inr/numass/scripts/temp/JoinSpectra.groovy b/numass-main/src/main/groovy/inr/numass/scripts/temp/JoinSpectra.groovy index ffbb781f..503514f5 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/temp/JoinSpectra.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/temp/JoinSpectra.groovy @@ -30,8 +30,8 @@ Table.metaClass.withBinning { int binning -> } Table.metaClass.withDeadTime { double dt = 6.5 -> - double totalCR = delegate.getColumn(NumassAnalyzer.COUNT_RATE_KEY).stream().mapToDouble { it.doubleValue() }.sum() -// long totalCount = delegate.getColumn(NumassAnalyzer.COUNT_RATE_KEY).stream().mapToLong() { it.longValue() }.sum() + double totalCR = delegate.getColumn(NumassAnalyzer.COUNT_RATE_KEY).stream().mapToDouble { it.getDouble() }.sum() +// long totalCount = delegate.getColumn(NumassAnalyzer.COUNT_RATE_KEY).stream().mapToLong() { it.getLong() }.sum() // double time = totalCount / totalCR double factor = 1d / (1d - dt * 1e-6 * totalCR) return ColumnTable.copy(delegate) diff --git a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java index 437f9f1e..7034a541 100644 --- a/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java +++ b/numass-main/src/main/java/hep/dataforge/plotfit/PlotFitResultAction.java @@ -71,7 +71,7 @@ public class PlotFitResultAction extends OneToOneAction { fit.setSmoothing(true); // ensuring all data points are calculated explicitly StreamSupport.stream(data.spliterator(), false) - .map(dp -> Adapters.getXValue(adapter, dp).doubleValue()).sorted().forEach(fit::calculateIn); + .map(dp -> Adapters.getXValue(adapter, dp).getDouble()).sorted().forEach(fit::calculateIn); frame.add(fit); diff --git a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java index 15ef9024..508ee7b7 100644 --- a/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java +++ b/numass-main/src/main/java/inr/numass/actions/MonitorCorrectAction.java @@ -89,21 +89,21 @@ public class MonitorCorrectAction extends OneToOneAction { double corrFactor = corr.getKey(); double corrErr = corr.getValue(); - double pointErr = dp.getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).doubleValue() / getCR(dp); + double pointErr = dp.getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).getDouble() / getCR(dp); double err = Math.sqrt(corrErr * corrErr + pointErr * pointErr) * getCR(dp); if (dp.getNames().contains("Monitor")) { - pb.putValue("Monitor", Value.of(dp.getValue("Monitor").doubleValue() / corrFactor)); + pb.putValue("Monitor", Value.of(dp.getValue("Monitor").getDouble() / corrFactor)); } else { pb.putValue("Monitor", corrFactor); } - pb.putValue(NumassAnalyzer.COUNT_RATE_KEY, Value.of(dp.getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue() / corrFactor)); + pb.putValue(NumassAnalyzer.COUNT_RATE_KEY, Value.of(dp.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble() / corrFactor)); pb.putValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY, Value.of(err)); } else { - double corrFactor = dp.getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue() / norm; + double corrFactor = dp.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble() / norm; if (dp.getNames().contains("Monitor")) { - pb.putValue("Monitor", Value.of(dp.getValue("Monitor").doubleValue() / corrFactor)); + pb.putValue("Monitor", Value.of(dp.getValue("Monitor").getDouble() / corrFactor)); } else { pb.putValue("Monitor", corrFactor); } @@ -112,8 +112,8 @@ public class MonitorCorrectAction extends OneToOneAction { } if (meta.getBoolean("calculateRelative", false)) { - pb.putValue("relCR", pb.build().getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue() / norm); - pb.putValue("relCRerr", pb.build().getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).doubleValue() / norm); + pb.putValue("relCR", pb.build().getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble() / norm); + pb.putValue("relCRerr", pb.build().getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).getDouble() / norm); } dataList.add(pb.build()); @@ -179,7 +179,7 @@ public class MonitorCorrectAction extends OneToOneAction { } double corrFactor = (getCR(previousMonitor.getValue()) * (1 - p) + getCR(nextMonitor.getValue()) * p) / norm; - double corrErr = previousMonitor.getValue().getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).doubleValue() / getCR(previousMonitor.getValue()) / Math.sqrt(2); + double corrErr = previousMonitor.getValue().getValue(NumassAnalyzer.COUNT_RATE_ERROR_KEY).getDouble() / getCR(previousMonitor.getValue()) / Math.sqrt(2); return new Pair<>(corrFactor, corrErr); } @@ -200,19 +200,19 @@ public class MonitorCorrectAction extends OneToOneAction { } private boolean isMonitorPoint(double monitor, Values point) { - return point.getValue(NumassPoint.HV_KEY).doubleValue() == monitor; + return point.getValue(NumassPoint.HV_KEY).getDouble() == monitor; } private Instant getTime(Values point) { - return point.getValue(NumassAnalyzer.TIME_KEY).timeValue(); + return point.getValue(NumassAnalyzer.TIME_KEY).getTime(); } private int getTotal(Values point) { - return point.getValue(NumassAnalyzer.COUNT_KEY).intValue(); + return point.getValue(NumassAnalyzer.COUNT_KEY).getInt(); } private double getCR(Values point) { - return point.getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue(); + return point.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble(); } private TreeMap getMonitorIndex(double monitor, Iterable data) { diff --git a/numass-main/src/main/java/inr/numass/data/SpectrumGenerator.java b/numass-main/src/main/java/inr/numass/data/SpectrumGenerator.java index 2ddfcd26..0b7e85d0 100644 --- a/numass-main/src/main/java/inr/numass/data/SpectrumGenerator.java +++ b/numass-main/src/main/java/inr/numass/data/SpectrumGenerator.java @@ -173,7 +173,7 @@ public class SpectrumGenerator implements Generator { } private double getX(Values point) { - return Adapters.getXValue(adapter,point).doubleValue(); + return Adapters.getXValue(adapter,point).getDouble(); } public void setGeneratorType(GeneratorType type) { diff --git a/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java b/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java index a223d9d9..e9a25c5a 100644 --- a/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java +++ b/numass-main/src/main/java/inr/numass/data/SpectrumInformation.java @@ -73,7 +73,7 @@ public class SpectrumInformation { * Нужно вычислять сразу всю матрицу для каждой точки, тогда количество * вызовов производных будет строго равно 1. */ - res = res.add(getPointInfoMatrix(set, Adapters.getXValue(adapter,dp).doubleValue(), adapter.getTime(dp), names).getMatrix()); + res = res.add(getPointInfoMatrix(set, Adapters.getXValue(adapter,dp).getDouble(), adapter.getTime(dp), names).getMatrix()); } return new NamedMatrix(names, res); diff --git a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java index c963cb52..d768d2ca 100644 --- a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java +++ b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java @@ -79,7 +79,7 @@ public class UnderflowCorrection { double norm = spectrum.getRows().filter(row -> { int channel = row.getInt(CHANNEL_KEY); return channel > xLow && channel < upper; - }).mapToDouble(it -> it.getValue(COUNT_RATE_KEY).numberValue().longValue()).sum(); + }).mapToDouble(it -> it.getValue(COUNT_RATE_KEY).getNumber().longValue()).sum(); double[] fitRes = getUnderflowExpParameters(spectrum, xLow, xHigh, binning); double a = fitRes[0]; diff --git a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt index 65f1b523..93fa83b9 100644 --- a/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt +++ b/numass-main/src/main/kotlin/inr/numass/NumassUtils.kt @@ -210,7 +210,7 @@ fun addSetMarkers(frame: JFreeChartFrame, sets: Collection) { val paint = Color(0.0f, 0.0f, 1.0f, 0.1f) sets.stream().forEach { val start = it.startTime; - val stop = it.meta.optValue("end_time").map { it.timeValue() } + val stop = it.meta.optValue("end_time").map { it.getTime() } .orElse(start.plusSeconds(300)) .minusSeconds(60) val marker = IntervalMarker(start.toEpochMilli().toDouble(), stop.toEpochMilli().toDouble(), paint) @@ -252,10 +252,10 @@ fun Values.unbox(): Map { for (field in this.names) { val value = this.getValue(field) val obj: Any? = when (value.type) { - ValueType.BOOLEAN -> value.booleanValue() - ValueType.NUMBER -> value.doubleValue() - ValueType.STRING -> value.stringValue() - ValueType.TIME -> value.timeValue() + ValueType.BOOLEAN -> value.getBoolean() + ValueType.NUMBER -> value.getDouble() + ValueType.STRING -> value.getString() + ValueType.TIME -> value.getTime() ValueType.NULL -> null } res.put(field, obj) diff --git a/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt index 025a5d0c..f5c5d18c 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/MergeDataAction.kt @@ -68,15 +68,15 @@ class MergeDataAction : ManyToOneAction() { return dp1 } - val voltage = dp1.getValue(NumassPoint.HV_KEY).doubleValue() - val t1 = dp1.getValue(NumassPoint.LENGTH_KEY).doubleValue() - val t2 = dp2.getValue(NumassPoint.LENGTH_KEY).doubleValue() + val voltage = dp1.getValue(NumassPoint.HV_KEY).getDouble() + val t1 = dp1.getValue(NumassPoint.LENGTH_KEY).getDouble() + val t2 = dp2.getValue(NumassPoint.LENGTH_KEY).getDouble() val time = t1 + t2 - val total = (dp1.getValue(NumassAnalyzer.COUNT_KEY).intValue() + dp2.getValue(NumassAnalyzer.COUNT_KEY).intValue()).toLong() + val total = (dp1.getValue(NumassAnalyzer.COUNT_KEY).getInt() + dp2.getValue(NumassAnalyzer.COUNT_KEY).getInt()).toLong() - val cr1 = dp1.getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue() - val cr2 = dp2.getValue(NumassAnalyzer.COUNT_RATE_KEY).doubleValue() + val cr1 = dp1.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble() + val cr2 = dp2.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble() val cr = (cr1 * t1 + cr2 * t2) / (t1 + t2) @@ -97,7 +97,7 @@ class MergeDataAction : ManyToOneAction() { throw IllegalArgumentException() } for (dp in d) { - val uset = dp.getValue(NumassPoint.HV_KEY).doubleValue() + val uset = dp.getValue(NumassPoint.HV_KEY).getDouble() if (!points.containsKey(uset)) { points.put(uset, ArrayList()) } diff --git a/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt b/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt index f4a254e5..972d5e2a 100644 --- a/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt +++ b/numass-main/src/main/kotlin/inr/numass/actions/SummaryAction.kt @@ -82,8 +82,8 @@ object SummaryAction : ManyToOneAction() { values[2 * i + 1] = `val` val err = Value.of(value.parameters.getError(parNames[i])) values[2 * i + 2] = err - val weight = 1.0 / err.doubleValue() / err.doubleValue() - av[i] += `val`.doubleValue() * weight + val weight = 1.0 / err.getDouble() / err.getDouble() + av[i] += `val`.getDouble() * weight weights[i] += weight } values[values.size - 1] = Value.of(value.chi2) diff --git a/numass-main/src/main/kotlin/inr/numass/data/Generator.kt b/numass-main/src/main/kotlin/inr/numass/data/Generator.kt index 182ac5ee..5ca8f7c8 100644 --- a/numass-main/src/main/kotlin/inr/numass/data/Generator.kt +++ b/numass-main/src/main/kotlin/inr/numass/data/Generator.kt @@ -60,8 +60,8 @@ fun generateEvents( val channels = DoubleArray(spectrum.size()) val values = DoubleArray(spectrum.size()) for (i in 0 until spectrum.size()) { - channels[i] = spectrum.get(CHANNEL_KEY, i).doubleValue() - values[i] = spectrum.get(COUNT_RATE_KEY, i).doubleValue() + channels[i] = spectrum.get(CHANNEL_KEY, i).getDouble() + values[i] = spectrum.get(COUNT_RATE_KEY, i).getDouble() } val distribution = EnumeratedRealDistribution(channels, values) diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt b/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt index eebe3258..5105f32b 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt @@ -81,7 +81,7 @@ fun main(args: Array) { val res = subtractAmplitudeSpectrum(spectrum1, spectrum0) - val norm = res.getColumn(COUNT_RATE_KEY).stream().mapToDouble { it.doubleValue() }.sum() + val norm = res.getColumn(COUNT_RATE_KEY).stream().mapToDouble { it.getDouble() }.sum() integralFrame.add(DataPlot.plot("point_$hv", AMPLITUDE_ADAPTER, spectrum0)) diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt index 3934c4eb..2aab12e3 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt @@ -42,11 +42,11 @@ private fun createSummaryNode(storage: Storage): MetaBuilder { // .setNode("meta", point.meta) point.meta.useValue("acquisition_time") { - pointBuilder.setValue("length", it.doubleValue()) + pointBuilder.setValue("length", it.getDouble()) } point.meta.useValue("events") { - pointBuilder.setValue("count", it.listValue().stream().mapToInt { it.intValue() }.sum()) + pointBuilder.setValue("count", it.getList().stream().mapToInt { it.getInt() }.sum()) } setBuilder.putNode(pointBuilder) diff --git a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt index 2ed60495..e4790b66 100644 --- a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt +++ b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt @@ -98,7 +98,7 @@ object Threshold { private fun norm(spectrum: Table, xLow: Int, upper: Int): Double { return spectrum.rows.filter { row -> row.getInt(CHANNEL_KEY) in (xLow + 1)..(upper - 1) - }.mapToDouble { it.getValue(COUNT_RATE_KEY).doubleValue() }.sum() + }.mapToDouble { it.getValue(COUNT_RATE_KEY).getDouble() }.sum() } private val expPointNames = arrayOf("U", "amp", "expConst", "correction"); diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanSummaryTask.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanSummaryTask.kt index 1c9125dc..3c28406a 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanSummaryTask.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanSummaryTask.kt @@ -60,7 +60,7 @@ object NumassFitScanSummaryTask : AbstractTask
() { } builder.row( - Math.sqrt(pars.getValue("msterile2").doubleValue()), + Math.sqrt(pars.getValue("msterile2").getDouble()), pars.getValue("U2"), pars.getError("U2"), limit, diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt index d40e3612..1759e32b 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassFitScanTask.kt @@ -30,12 +30,12 @@ object NumassFitScanTask : AbstractTask() { val scanValues: Value = if (config.hasValue("masses")) { ListValue(config.getValue("masses") - .listValue().stream() - .map { it -> Math.pow(it.doubleValue() * 1000, 2.0) } + .getList().stream() + .map { it -> Math.pow(it.getDouble() * 1000, 2.0) } .collect(Collectors.toList()) ) } else { - config.getValue("values", Value.of("[2.5e5, 1e6, 2.25e6, 4e6, 6.25e6, 9e6]")) + config.getValue("hep/dataforge/values", Value.of("[2.5e5, 1e6, 2.25e6, 4e6, 6.25e6, 9e6]")) } val action = FitAction() @@ -46,12 +46,12 @@ object NumassFitScanTask : AbstractTask() { val fitConfig = config.getMeta("fit") sourceNode.dataStream().forEach { table -> - for (i in 0 until scanValues.listValue().size) { - val `val` = scanValues.listValue()[i] + for (i in 0 until scanValues.getList().size) { + val `val` = scanValues.getList()[i] val overrideMeta = MetaBuilder(fitConfig) - val resultName = String.format("%s[%s=%s]", table.name, scanParameter, `val`.stringValue()) - // overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.stringValue())); + val resultName = String.format("%s[%s=%s]", table.name, scanParameter, `val`.getString()) + // overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.getString())); if (overrideMeta.hasMeta("params.$scanParameter")) { overrideMeta.setValue("params.$scanParameter.value", `val`) diff --git a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt index 05083bde..cd0a9010 100644 --- a/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt +++ b/numass-main/src/main/kotlin/inr/numass/tasks/NumassTasks.kt @@ -259,7 +259,7 @@ val plotFitTask = task("plotFit") { // ensuring all data points are calculated explicitly StreamSupport.stream(data.spliterator(), false) - .map { dp -> Adapters.getXValue(adapter, dp).doubleValue() }.sorted().forEach { fit.calculateIn(it) } + .map { dp -> Adapters.getXValue(adapter, dp).getDouble() }.sorted().forEach { fit.calculateIn(it) } frame.add(DataPlot.plot("data", adapter, data)) diff --git a/numass-server/src/main/java/inr/numass/server/HandlerUtils.java b/numass-server/src/main/java/inr/numass/server/HandlerUtils.java index 89d457ea..7a7d24b1 100644 --- a/numass-server/src/main/java/inr/numass/server/HandlerUtils.java +++ b/numass-server/src/main/java/inr/numass/server/HandlerUtils.java @@ -33,7 +33,7 @@ public class HandlerUtils { } b.append(String.format("

%s : %s

%n", - pair.getFirst(), color, pair.getSecond().stringValue())); + pair.getFirst(), color, pair.getSecond().getString())); }); b.append("\n"); return b.toString(); diff --git a/numass-server/src/main/java/inr/numass/server/NumassNote.java b/numass-server/src/main/java/inr/numass/server/NumassNote.java index b058281d..03c22f56 100644 --- a/numass-server/src/main/java/inr/numass/server/NumassNote.java +++ b/numass-server/src/main/java/inr/numass/server/NumassNote.java @@ -37,7 +37,7 @@ public class NumassNote implements Serializable { public static NumassNote buildFrom(Meta meta) { String text = meta.getString("text", ""); if (meta.hasValue("time")) { - Instant time = meta.getValue("time").timeValue(); + Instant time = meta.getValue("time").getTime(); return new NumassNote(text, time); } else { return new NumassNote(text); diff --git a/numass-server/src/main/java/inr/numass/server/NumassRootHandler.java b/numass-server/src/main/java/inr/numass/server/NumassRootHandler.java index 6c40e804..b7991305 100644 --- a/numass-server/src/main/java/inr/numass/server/NumassRootHandler.java +++ b/numass-server/src/main/java/inr/numass/server/NumassRootHandler.java @@ -11,7 +11,6 @@ import hep.dataforge.server.ServletUtils; import hep.dataforge.storage.api.Loader; import hep.dataforge.storage.api.StateLoader; import hep.dataforge.storage.api.Storage; -import hep.dataforge.storage.commons.JSONMetaWriter; import org.slf4j.LoggerFactory; import ratpack.handling.Context; import ratpack.handling.Handler; diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy index 631360df..0bec4e33 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy @@ -16,7 +16,6 @@ package inr.numass.scripts import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.StorageManager new StorageManager().startGlobal(); diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy index 05b9b0e2..15560341 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy @@ -8,7 +8,6 @@ package inr.numass.scripts import hep.dataforge.io.MetaStreamWriter import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.StorageManager import inr.numass.client.NumassClient diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy index 095d48ec..1d50a9ec 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy @@ -7,7 +7,6 @@ package inr.numass.scripts import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.StorageManager import inr.numass.client.NumassClient diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy index f870bdfd..f7014221 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy @@ -16,7 +16,6 @@ package inr.numass.scripts import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.StorageManager import inr.numass.client.NumassClient diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy index 4d3f8af1..09257c5f 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy @@ -8,7 +8,6 @@ package inr.numass.scripts import hep.dataforge.io.MetaStreamWriter import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.StorageManager import inr.numass.client.NumassClient diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy index 2b0dd426..2f03f7e1 100644 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy +++ b/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy @@ -10,7 +10,6 @@ import hep.dataforge.io.MetaStreamWriter import hep.dataforge.io.envelopes.Envelope import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder -import hep.dataforge.storage.commons.JSONMetaWriter import hep.dataforge.storage.commons.LoaderFactory import hep.dataforge.storage.commons.StorageManager import hep.dataforge.tables.ValueMap diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt index 1b9ae02e..b33bae4f 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/HVView.kt @@ -58,7 +58,7 @@ class HVView : View(title = "High voltage time plot", icon = ImageView(dfIcon)) hvData.ifPresent { for (dp in it) { val plot: TimePlot = frame[change.key] as TimePlot? ?: TimePlot(change.key).apply { frame.add(this) } - plot.put(dp.getValue("timestamp").timeValue(), dp.getValue("value")) + plot.put(dp.getValue("timestamp").getTime(), dp.getValue("value")) } } container.progress = 1.0; diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt index 33c23d66..ec6dae3a 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt @@ -154,7 +154,7 @@ class SpectrumView( } fun add(key: String, value: NumassSet) { - data.put(key, NumassDataCache(value)) + data[key] = NumassDataCache(value) } fun remove(key: String) {