From bfb73dd3003e080b7e81b7d13a38cbaea951affa Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 21 Mar 2018 17:02:57 +0300 Subject: [PATCH] Fix for color picker in plot config --- .../inr/numass/control/msp/MspDevice.kt | 76 +- .../java/inr/numass/data/NumassProto.java | 4576 ----------------- .../kotlin/inr/numass/data/NumassDataUtils.kt | 27 +- .../numass/data/analyzers/NumassAnalyzer.kt | 17 +- .../numass/data/storage/ProtoNumassPoint.kt | 28 +- .../main/proto/inr/numas/numass-proto.proto | 5 +- .../numass/scripts/underflow/Underflow.groovy | 2 +- .../inr/numass/utils/UnderflowCorrection.java | 4 +- .../kotlin/inr/numass/data/Visualization.kt | 14 +- .../numass/scripts/DifferentialSpectrum.kt | 1 + .../inr/numass/scripts/InversedChain.kt | 2 +- .../inr/numass/scripts/InversedChainProto.kt | 3 +- .../numass/scripts/tristan/AnalyzeTristan.kt | 55 +- .../inr/numass/subthreshold/Threshold.kt | 16 +- .../kotlin/inr/numass/viewer/AmplitudeView.kt | 4 +- .../kotlin/inr/numass/viewer/SpectrumView.kt | 2 +- 16 files changed, 164 insertions(+), 4668 deletions(-) delete mode 100644 numass-core/gen/main/java/inr/numass/data/NumassProto.java 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 a010f3d4..7bb2f073 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 @@ -24,7 +24,9 @@ import hep.dataforge.control.connections.Roles import hep.dataforge.control.devices.Device import hep.dataforge.control.devices.PortSensor import hep.dataforge.control.measurements.AbstractMeasurement +import hep.dataforge.control.ports.GenericPortController import hep.dataforge.control.ports.Port +import hep.dataforge.control.ports.PortFactory import hep.dataforge.description.ValueDef import hep.dataforge.exceptions.ControlException import hep.dataforge.exceptions.MeasurementException @@ -76,11 +78,12 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { private val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S")) + @Throws(ControlException::class) override fun init() { super.init() connection.weakOnError(this::notifyError) - onResponse("FilamentStatus"){ + onResponse("FilamentStatus") { val status = it[0, 2] updateLogicalState("filamentOn", status == "ON") updateLogicalState("filamentStatus", status) @@ -92,45 +95,22 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { * Add reaction on specific response */ private fun onResponse(command: String, action: (MspResponse) -> Unit) { - connection.weakOnPhrase({it.startsWith(command)}){ + connection.weakOnPhrase({ it.startsWith(command) }) { action(MspResponse(it)) } } - /* - - override fun acceptPhrase(message: String) { - dispatchEvent( - EventBuilder - .make("msp") - .setMetaValue("response", message.trim { it <= ' ' }).build() - ) - val response = MspResponse(message) - - when (response.commandName) { - // all possible async messages - "FilamentStatus" -> { - val status = response[0, 2] - updateLogicalState("filamentOn", status == "ON") - updateLogicalState("filamentStatus", status) - } - } - if (measurementDelegate != null) { - measurementDelegate!!.accept(response) - } + override fun connect(meta: Meta): GenericPortController { + val portName = meta.getString("name") + logger.info("Connecting to port {}", portName) + val port: Port = PortFactory.build(meta) + return GenericPortController(context, port, "\r\r") } - override fun error(errorMessage: String?, error: Throwable?) { - notifyError(errorMessage, error) - } - - */ - - override fun buildPort(portName: String?): Port = super.buildPort(portName).apply { setDelimiter("\r\r") } @Throws(ControlException::class) override fun shutdown() { - super.stopMeasurement(true) + super.stopMeasurement() if (connected) { setFilamentOn(false) setConnected(false) @@ -151,6 +131,10 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { } } + override fun setMeasurement(oldMeta: Meta?, newMeta: Meta) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + @Throws(ControlException::class) override fun computeState(stateName: String): Any = when (stateName) { "connected" -> false @@ -190,7 +174,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { if (response.isOK) { sensorName = response[2, 1] } else { - notifyError(response.errorDescription(), null) + notifyError(response.errorDescription, null) return false } //PENDING определеить в конфиге номер прибора @@ -200,7 +184,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { updateLogicalState("selected", true) // selected = true; } else { - notifyError(response.errorDescription(), null) + notifyError(response.errorDescription, null) return false } @@ -210,7 +194,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { // invalidateState("controlled"); updateLogicalState("controlled", true) } else { - notifyError(response.errorDescription(), null) + notifyError(response.errorDescription, null) return false } // connected = true; @@ -266,7 +250,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { @Throws(PortException::class) private fun commandAndWait(commandName: String, vararg parameters: Any): MspResponse { send(buildCommand(commandName, *parameters)) - val response = connection.waitFor(timeout) { str: String -> str.trim { it <= ' ' }.startsWith(commandName) } + val response = connection.waitFor(TIMEOUT) { str: String -> str.trim { it <= ' ' }.startsWith(commandName) } return MspResponse(response) } @@ -276,7 +260,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { if (response.isOK) { updateLogicalState("filament", response[1, 1]) } else { - logger.error("Failed to set filament with error: {}", response.errorDescription()) + logger.error("Failed to set filament with error: {}", response.errorDescription) } } @@ -341,13 +325,14 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { } } - fun errorDescription(): String? { - return if (isOK) { - null - } else { - get(2, 1) + val errorDescription: String + get() { + return if (isOK) { + throw RuntimeException("Not a error") + } else { + get(2, 1) + } } - } operator fun get(lineNo: Int, columnNo: Int): String = data[lineNo][columnNo] } @@ -425,12 +410,13 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { } - @Synchronized override fun result(result: Values, time: Instant) { + @Synchronized + override fun result(result: Values, time: Instant) { super.result(result, time) helper.push(result) } - internal fun error(errorMessage: String?, error: Throwable?) { + private fun error(errorMessage: String?, error: Throwable?) { if (error == null) { error(MeasurementException(errorMessage)) } else { @@ -467,7 +453,7 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) { } companion object { - val MSP_DEVICE_TYPE = "numass.msp" + const val MSP_DEVICE_TYPE = "numass.msp" private val TIMEOUT = Duration.ofMillis(200) } diff --git a/numass-core/gen/main/java/inr/numass/data/NumassProto.java b/numass-core/gen/main/java/inr/numass/data/NumassProto.java deleted file mode 100644 index 568c0ae5..00000000 --- a/numass-core/gen/main/java/inr/numass/data/NumassProto.java +++ /dev/null @@ -1,4576 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: inr/numas/numass-proto.proto - -package inr.numass.data; - -public final class NumassProto { - private NumassProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - public interface PointOrBuilder extends - // @@protoc_insertion_point(interface_extends:inr.numass.data.Point) - com.google.protobuf.MessageOrBuilder { - - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - java.util.List - getChannelsList(); - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - inr.numass.data.NumassProto.Point.Channel getChannels(int index); - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - int getChannelsCount(); - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - java.util.List - getChannelsOrBuilderList(); - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - inr.numass.data.NumassProto.Point.ChannelOrBuilder getChannelsOrBuilder( - int index); - } - /** - * Protobuf type {@code inr.numass.data.Point} - */ - public static final class Point extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:inr.numass.data.Point) - PointOrBuilder { - private static final long serialVersionUID = 0L; - // Use Point.newBuilder() to construct. - private Point(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Point() { - channels_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Point( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownFieldProto3( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - channels_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - channels_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.parser(), extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - channels_ = java.util.Collections.unmodifiableList(channels_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.class, inr.numass.data.NumassProto.Point.Builder.class); - } - - public interface ChannelOrBuilder extends - // @@protoc_insertion_point(interface_extends:inr.numass.data.Point.Channel) - com.google.protobuf.MessageOrBuilder { - - /** - *
-       * The number of measuring channel
-       * 
- * - * uint64 num = 1; - */ - long getNum(); - - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - java.util.List - getBlocksList(); - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - inr.numass.data.NumassProto.Point.Channel.Block getBlocks(int index); - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - int getBlocksCount(); - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - java.util.List - getBlocksOrBuilderList(); - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder getBlocksOrBuilder( - int index); - } - /** - *
-     * A single channel for multichannel detector readout
-     * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel} - */ - public static final class Channel extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel) - ChannelOrBuilder { - private static final long serialVersionUID = 0L; - // Use Channel.newBuilder() to construct. - private Channel(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Channel() { - num_ = 0L; - blocks_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Channel( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownFieldProto3( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - - num_ = input.readUInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - blocks_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - blocks_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.parser(), extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - blocks_ = java.util.Collections.unmodifiableList(blocks_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.class, inr.numass.data.NumassProto.Point.Channel.Builder.class); - } - - public interface BlockOrBuilder extends - // @@protoc_insertion_point(interface_extends:inr.numass.data.Point.Channel.Block) - com.google.protobuf.MessageOrBuilder { - - /** - *
-         * Block start in epoch nanos
-         * 
- * - * uint64 time = 1; - */ - long getTime(); - - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - java.util.List - getFramesList(); - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - inr.numass.data.NumassProto.Point.Channel.Block.Frame getFrames(int index); - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - int getFramesCount(); - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - java.util.List - getFramesOrBuilderList(); - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder getFramesOrBuilder( - int index); - - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - boolean hasEvents(); - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - inr.numass.data.NumassProto.Point.Channel.Block.Events getEvents(); - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder getEventsOrBuilder(); - } - /** - *
-       *A continuous measurement block
-       * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block} - */ - public static final class Block extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block) - BlockOrBuilder { - private static final long serialVersionUID = 0L; - // Use Block.newBuilder() to construct. - private Block(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Block() { - time_ = 0L; - frames_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Block( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownFieldProto3( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - - time_ = input.readUInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - frames_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - frames_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.Frame.parser(), extensionRegistry)); - break; - } - case 26: { - inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder subBuilder = null; - if (events_ != null) { - subBuilder = events_.toBuilder(); - } - events_ = input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.Events.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(events_); - events_ = subBuilder.buildPartial(); - } - - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - frames_ = java.util.Collections.unmodifiableList(frames_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.class, inr.numass.data.NumassProto.Point.Channel.Block.Builder.class); - } - - public interface FrameOrBuilder extends - // @@protoc_insertion_point(interface_extends:inr.numass.data.Point.Channel.Block.Frame) - com.google.protobuf.MessageOrBuilder { - - /** - *
-           * Time in nanos from the beginning of the block
-           * 
- * - * uint64 time = 1; - */ - long getTime(); - - /** - *
-           * Frame data as an array of int16 mesured in arbitrary channels
-           * 
- * - * bytes data = 2; - */ - com.google.protobuf.ByteString getData(); - } - /** - *
-         * Raw data frame
-         * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block.Frame} - */ - public static final class Frame extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Frame) - FrameOrBuilder { - private static final long serialVersionUID = 0L; - // Use Frame.newBuilder() to construct. - private Frame(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Frame() { - time_ = 0L; - data_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Frame( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownFieldProto3( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - - time_ = input.readUInt64(); - break; - } - case 18: { - - data_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.Frame.class, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder.class); - } - - public static final int TIME_FIELD_NUMBER = 1; - private long time_; - /** - *
-           * Time in nanos from the beginning of the block
-           * 
- * - * uint64 time = 1; - */ - public long getTime() { - return time_; - } - - public static final int DATA_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString data_; - /** - *
-           * Frame data as an array of int16 mesured in arbitrary channels
-           * 
- * - * bytes data = 2; - */ - public com.google.protobuf.ByteString getData() { - return data_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (time_ != 0L) { - output.writeUInt64(1, time_); - } - if (!data_.isEmpty()) { - output.writeBytes(2, data_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (time_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, time_); - } - if (!data_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, data_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof inr.numass.data.NumassProto.Point.Channel.Block.Frame)) { - return super.equals(obj); - } - inr.numass.data.NumassProto.Point.Channel.Block.Frame other = (inr.numass.data.NumassProto.Point.Channel.Block.Frame) obj; - - boolean result = true; - result = result && (getTime() - == other.getTime()); - result = result && getData() - .equals(other.getData()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + TIME_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getTime()); - hash = (37 * hash) + DATA_FIELD_NUMBER; - hash = (53 * hash) + getData().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(inr.numass.data.NumassProto.Point.Channel.Block.Frame prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-           * Raw data frame
-           * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block.Frame} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:inr.numass.data.Point.Channel.Block.Frame) - inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.Frame.class, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder.class); - } - - // Construct using inr.numass.data.NumassProto.Point.Channel.Block.Frame.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - time_ = 0L; - - data_ = com.google.protobuf.ByteString.EMPTY; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Frame getDefaultInstanceForType() { - return inr.numass.data.NumassProto.Point.Channel.Block.Frame.getDefaultInstance(); - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Frame build() { - inr.numass.data.NumassProto.Point.Channel.Block.Frame result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Frame buildPartial() { - inr.numass.data.NumassProto.Point.Channel.Block.Frame result = new inr.numass.data.NumassProto.Point.Channel.Block.Frame(this); - result.time_ = time_; - result.data_ = data_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof inr.numass.data.NumassProto.Point.Channel.Block.Frame) { - return mergeFrom((inr.numass.data.NumassProto.Point.Channel.Block.Frame)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(inr.numass.data.NumassProto.Point.Channel.Block.Frame other) { - if (other == inr.numass.data.NumassProto.Point.Channel.Block.Frame.getDefaultInstance()) return this; - if (other.getTime() != 0L) { - setTime(other.getTime()); - } - if (other.getData() != com.google.protobuf.ByteString.EMPTY) { - setData(other.getData()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - inr.numass.data.NumassProto.Point.Channel.Block.Frame parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block.Frame) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long time_ ; - /** - *
-             * Time in nanos from the beginning of the block
-             * 
- * - * uint64 time = 1; - */ - public long getTime() { - return time_; - } - /** - *
-             * Time in nanos from the beginning of the block
-             * 
- * - * uint64 time = 1; - */ - public Builder setTime(long value) { - - time_ = value; - onChanged(); - return this; - } - /** - *
-             * Time in nanos from the beginning of the block
-             * 
- * - * uint64 time = 1; - */ - public Builder clearTime() { - - time_ = 0L; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; - /** - *
-             * Frame data as an array of int16 mesured in arbitrary channels
-             * 
- * - * bytes data = 2; - */ - public com.google.protobuf.ByteString getData() { - return data_; - } - /** - *
-             * Frame data as an array of int16 mesured in arbitrary channels
-             * 
- * - * bytes data = 2; - */ - public Builder setData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - data_ = value; - onChanged(); - return this; - } - /** - *
-             * Frame data as an array of int16 mesured in arbitrary channels
-             * 
- * - * bytes data = 2; - */ - public Builder clearData() { - - data_ = getDefaultInstance().getData(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFieldsProto3(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:inr.numass.data.Point.Channel.Block.Frame) - } - - // @@protoc_insertion_point(class_scope:inr.numass.data.Point.Channel.Block.Frame) - private static final inr.numass.data.NumassProto.Point.Channel.Block.Frame DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new inr.numass.data.NumassProto.Point.Channel.Block.Frame(); - } - - public static inr.numass.data.NumassProto.Point.Channel.Block.Frame getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Frame parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Frame(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Frame getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface EventsOrBuilder extends - // @@protoc_insertion_point(interface_extends:inr.numass.data.Point.Channel.Block.Events) - com.google.protobuf.MessageOrBuilder { - - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - java.util.List getTimesList(); - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - int getTimesCount(); - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - long getTimes(int index); - - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - java.util.List getAmplitudesList(); - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - int getAmplitudesCount(); - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - long getAmplitudes(int index); - } - /** - *
-         * Обработанные события. Содержат только время и амплитуду сигналов.
-         * Для экономии места при сериализации амплитуды и времена лежат в
-         * разных массивах. Амплитуда и время имеющие одинаковые индексы
-         * соответствуют одному событию
-         * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block.Events} - */ - public static final class Events extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Events) - EventsOrBuilder { - private static final long serialVersionUID = 0L; - // Use Events.newBuilder() to construct. - private Events(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Events() { - times_ = java.util.Collections.emptyList(); - amplitudes_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Events( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownFieldProto3( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - times_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - times_.add(input.readUInt64()); - break; - } - case 10: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) { - times_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - while (input.getBytesUntilLimit() > 0) { - times_.add(input.readUInt64()); - } - input.popLimit(limit); - break; - } - case 16: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - amplitudes_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - amplitudes_.add(input.readUInt64()); - break; - } - case 18: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { - amplitudes_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - while (input.getBytesUntilLimit() > 0) { - amplitudes_.add(input.readUInt64()); - } - input.popLimit(limit); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - times_ = java.util.Collections.unmodifiableList(times_); - } - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - amplitudes_ = java.util.Collections.unmodifiableList(amplitudes_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.Events.class, inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder.class); - } - - public static final int TIMES_FIELD_NUMBER = 1; - private java.util.List times_; - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - public java.util.List - getTimesList() { - return times_; - } - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - public int getTimesCount() { - return times_.size(); - } - /** - *
-           * Array of time in nanos from the beginning of the block
-           * 
- * - * repeated uint64 times = 1; - */ - public long getTimes(int index) { - return times_.get(index); - } - private int timesMemoizedSerializedSize = -1; - - public static final int AMPLITUDES_FIELD_NUMBER = 2; - private java.util.List amplitudes_; - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - public java.util.List - getAmplitudesList() { - return amplitudes_; - } - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - public int getAmplitudesCount() { - return amplitudes_.size(); - } - /** - *
-           * Array of amplitudes of events in channels
-           * 
- * - * repeated uint64 amplitudes = 2; - */ - public long getAmplitudes(int index) { - return amplitudes_.get(index); - } - private int amplitudesMemoizedSerializedSize = -1; - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (getTimesList().size() > 0) { - output.writeUInt32NoTag(10); - output.writeUInt32NoTag(timesMemoizedSerializedSize); - } - for (int i = 0; i < times_.size(); i++) { - output.writeUInt64NoTag(times_.get(i)); - } - if (getAmplitudesList().size() > 0) { - output.writeUInt32NoTag(18); - output.writeUInt32NoTag(amplitudesMemoizedSerializedSize); - } - for (int i = 0; i < amplitudes_.size(); i++) { - output.writeUInt64NoTag(amplitudes_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < times_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeUInt64SizeNoTag(times_.get(i)); - } - size += dataSize; - if (!getTimesList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - timesMemoizedSerializedSize = dataSize; - } - { - int dataSize = 0; - for (int i = 0; i < amplitudes_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeUInt64SizeNoTag(amplitudes_.get(i)); - } - size += dataSize; - if (!getAmplitudesList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - amplitudesMemoizedSerializedSize = dataSize; - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof inr.numass.data.NumassProto.Point.Channel.Block.Events)) { - return super.equals(obj); - } - inr.numass.data.NumassProto.Point.Channel.Block.Events other = (inr.numass.data.NumassProto.Point.Channel.Block.Events) obj; - - boolean result = true; - result = result && getTimesList() - .equals(other.getTimesList()); - result = result && getAmplitudesList() - .equals(other.getAmplitudesList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getTimesCount() > 0) { - hash = (37 * hash) + TIMES_FIELD_NUMBER; - hash = (53 * hash) + getTimesList().hashCode(); - } - if (getAmplitudesCount() > 0) { - hash = (37 * hash) + AMPLITUDES_FIELD_NUMBER; - hash = (53 * hash) + getAmplitudesList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(inr.numass.data.NumassProto.Point.Channel.Block.Events prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-           * Обработанные события. Содержат только время и амплитуду сигналов.
-           * Для экономии места при сериализации амплитуды и времена лежат в
-           * разных массивах. Амплитуда и время имеющие одинаковые индексы
-           * соответствуют одному событию
-           * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block.Events} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:inr.numass.data.Point.Channel.Block.Events) - inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.Events.class, inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder.class); - } - - // Construct using inr.numass.data.NumassProto.Point.Channel.Block.Events.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - times_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - amplitudes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Events getDefaultInstanceForType() { - return inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance(); - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Events build() { - inr.numass.data.NumassProto.Point.Channel.Block.Events result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Events buildPartial() { - inr.numass.data.NumassProto.Point.Channel.Block.Events result = new inr.numass.data.NumassProto.Point.Channel.Block.Events(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - times_ = java.util.Collections.unmodifiableList(times_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.times_ = times_; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - amplitudes_ = java.util.Collections.unmodifiableList(amplitudes_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.amplitudes_ = amplitudes_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof inr.numass.data.NumassProto.Point.Channel.Block.Events) { - return mergeFrom((inr.numass.data.NumassProto.Point.Channel.Block.Events)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(inr.numass.data.NumassProto.Point.Channel.Block.Events other) { - if (other == inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance()) return this; - if (!other.times_.isEmpty()) { - if (times_.isEmpty()) { - times_ = other.times_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTimesIsMutable(); - times_.addAll(other.times_); - } - onChanged(); - } - if (!other.amplitudes_.isEmpty()) { - if (amplitudes_.isEmpty()) { - amplitudes_ = other.amplitudes_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureAmplitudesIsMutable(); - amplitudes_.addAll(other.amplitudes_); - } - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - inr.numass.data.NumassProto.Point.Channel.Block.Events parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block.Events) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List times_ = java.util.Collections.emptyList(); - private void ensureTimesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - times_ = new java.util.ArrayList(times_); - bitField0_ |= 0x00000001; - } - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public java.util.List - getTimesList() { - return java.util.Collections.unmodifiableList(times_); - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public int getTimesCount() { - return times_.size(); - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public long getTimes(int index) { - return times_.get(index); - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public Builder setTimes( - int index, long value) { - ensureTimesIsMutable(); - times_.set(index, value); - onChanged(); - return this; - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public Builder addTimes(long value) { - ensureTimesIsMutable(); - times_.add(value); - onChanged(); - return this; - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public Builder addAllTimes( - java.lang.Iterable values) { - ensureTimesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, times_); - onChanged(); - return this; - } - /** - *
-             * Array of time in nanos from the beginning of the block
-             * 
- * - * repeated uint64 times = 1; - */ - public Builder clearTimes() { - times_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - - private java.util.List amplitudes_ = java.util.Collections.emptyList(); - private void ensureAmplitudesIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - amplitudes_ = new java.util.ArrayList(amplitudes_); - bitField0_ |= 0x00000002; - } - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public java.util.List - getAmplitudesList() { - return java.util.Collections.unmodifiableList(amplitudes_); - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public int getAmplitudesCount() { - return amplitudes_.size(); - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public long getAmplitudes(int index) { - return amplitudes_.get(index); - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public Builder setAmplitudes( - int index, long value) { - ensureAmplitudesIsMutable(); - amplitudes_.set(index, value); - onChanged(); - return this; - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public Builder addAmplitudes(long value) { - ensureAmplitudesIsMutable(); - amplitudes_.add(value); - onChanged(); - return this; - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public Builder addAllAmplitudes( - java.lang.Iterable values) { - ensureAmplitudesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, amplitudes_); - onChanged(); - return this; - } - /** - *
-             * Array of amplitudes of events in channels
-             * 
- * - * repeated uint64 amplitudes = 2; - */ - public Builder clearAmplitudes() { - amplitudes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFieldsProto3(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:inr.numass.data.Point.Channel.Block.Events) - } - - // @@protoc_insertion_point(class_scope:inr.numass.data.Point.Channel.Block.Events) - private static final inr.numass.data.NumassProto.Point.Channel.Block.Events DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new inr.numass.data.NumassProto.Point.Channel.Block.Events(); - } - - public static inr.numass.data.NumassProto.Point.Channel.Block.Events getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Events parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Events(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public inr.numass.data.NumassProto.Point.Channel.Block.Events getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private int bitField0_; - public static final int TIME_FIELD_NUMBER = 1; - private long time_; - /** - *
-         * Block start in epoch nanos
-         * 
- * - * uint64 time = 1; - */ - public long getTime() { - return time_; - } - - public static final int FRAMES_FIELD_NUMBER = 2; - private java.util.List frames_; - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public java.util.List getFramesList() { - return frames_; - } - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public java.util.List - getFramesOrBuilderList() { - return frames_; - } - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public int getFramesCount() { - return frames_.size(); - } - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Frame getFrames(int index) { - return frames_.get(index); - } - /** - *
-         * Frames array
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder getFramesOrBuilder( - int index) { - return frames_.get(index); - } - - public static final int EVENTS_FIELD_NUMBER = 3; - private inr.numass.data.NumassProto.Point.Channel.Block.Events events_; - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public boolean hasEvents() { - return events_ != null; - } - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Events getEvents() { - return events_ == null ? inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance() : events_; - } - /** - *
-         * Events array
-         * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder getEventsOrBuilder() { - return getEvents(); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (time_ != 0L) { - output.writeUInt64(1, time_); - } - for (int i = 0; i < frames_.size(); i++) { - output.writeMessage(2, frames_.get(i)); - } - if (events_ != null) { - output.writeMessage(3, getEvents()); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (time_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, time_); - } - for (int i = 0; i < frames_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, frames_.get(i)); - } - if (events_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, getEvents()); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof inr.numass.data.NumassProto.Point.Channel.Block)) { - return super.equals(obj); - } - inr.numass.data.NumassProto.Point.Channel.Block other = (inr.numass.data.NumassProto.Point.Channel.Block) obj; - - boolean result = true; - result = result && (getTime() - == other.getTime()); - result = result && getFramesList() - .equals(other.getFramesList()); - result = result && (hasEvents() == other.hasEvents()); - if (hasEvents()) { - result = result && getEvents() - .equals(other.getEvents()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + TIME_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getTime()); - if (getFramesCount() > 0) { - hash = (37 * hash) + FRAMES_FIELD_NUMBER; - hash = (53 * hash) + getFramesList().hashCode(); - } - if (hasEvents()) { - hash = (37 * hash) + EVENTS_FIELD_NUMBER; - hash = (53 * hash) + getEvents().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel.Block parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(inr.numass.data.NumassProto.Point.Channel.Block prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-         *A continuous measurement block
-         * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel.Block} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:inr.numass.data.Point.Channel.Block) - inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.Block.class, inr.numass.data.NumassProto.Point.Channel.Block.Builder.class); - } - - // Construct using inr.numass.data.NumassProto.Point.Channel.Block.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getFramesFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - time_ = 0L; - - if (framesBuilder_ == null) { - frames_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - framesBuilder_.clear(); - } - if (eventsBuilder_ == null) { - events_ = null; - } else { - events_ = null; - eventsBuilder_ = null; - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_descriptor; - } - - public inr.numass.data.NumassProto.Point.Channel.Block getDefaultInstanceForType() { - return inr.numass.data.NumassProto.Point.Channel.Block.getDefaultInstance(); - } - - public inr.numass.data.NumassProto.Point.Channel.Block build() { - inr.numass.data.NumassProto.Point.Channel.Block result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public inr.numass.data.NumassProto.Point.Channel.Block buildPartial() { - inr.numass.data.NumassProto.Point.Channel.Block result = new inr.numass.data.NumassProto.Point.Channel.Block(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - result.time_ = time_; - if (framesBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - frames_ = java.util.Collections.unmodifiableList(frames_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.frames_ = frames_; - } else { - result.frames_ = framesBuilder_.build(); - } - if (eventsBuilder_ == null) { - result.events_ = events_; - } else { - result.events_ = eventsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof inr.numass.data.NumassProto.Point.Channel.Block) { - return mergeFrom((inr.numass.data.NumassProto.Point.Channel.Block)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(inr.numass.data.NumassProto.Point.Channel.Block other) { - if (other == inr.numass.data.NumassProto.Point.Channel.Block.getDefaultInstance()) return this; - if (other.getTime() != 0L) { - setTime(other.getTime()); - } - if (framesBuilder_ == null) { - if (!other.frames_.isEmpty()) { - if (frames_.isEmpty()) { - frames_ = other.frames_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureFramesIsMutable(); - frames_.addAll(other.frames_); - } - onChanged(); - } - } else { - if (!other.frames_.isEmpty()) { - if (framesBuilder_.isEmpty()) { - framesBuilder_.dispose(); - framesBuilder_ = null; - frames_ = other.frames_; - bitField0_ = (bitField0_ & ~0x00000002); - framesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getFramesFieldBuilder() : null; - } else { - framesBuilder_.addAllMessages(other.frames_); - } - } - } - if (other.hasEvents()) { - mergeEvents(other.getEvents()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - inr.numass.data.NumassProto.Point.Channel.Block parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long time_ ; - /** - *
-           * Block start in epoch nanos
-           * 
- * - * uint64 time = 1; - */ - public long getTime() { - return time_; - } - /** - *
-           * Block start in epoch nanos
-           * 
- * - * uint64 time = 1; - */ - public Builder setTime(long value) { - - time_ = value; - onChanged(); - return this; - } - /** - *
-           * Block start in epoch nanos
-           * 
- * - * uint64 time = 1; - */ - public Builder clearTime() { - - time_ = 0L; - onChanged(); - return this; - } - - private java.util.List frames_ = - java.util.Collections.emptyList(); - private void ensureFramesIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - frames_ = new java.util.ArrayList(frames_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Frame, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder, inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder> framesBuilder_; - - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public java.util.List getFramesList() { - if (framesBuilder_ == null) { - return java.util.Collections.unmodifiableList(frames_); - } else { - return framesBuilder_.getMessageList(); - } - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public int getFramesCount() { - if (framesBuilder_ == null) { - return frames_.size(); - } else { - return framesBuilder_.getCount(); - } - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Frame getFrames(int index) { - if (framesBuilder_ == null) { - return frames_.get(index); - } else { - return framesBuilder_.getMessage(index); - } - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder setFrames( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Frame value) { - if (framesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFramesIsMutable(); - frames_.set(index, value); - onChanged(); - } else { - framesBuilder_.setMessage(index, value); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder setFrames( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder builderForValue) { - if (framesBuilder_ == null) { - ensureFramesIsMutable(); - frames_.set(index, builderForValue.build()); - onChanged(); - } else { - framesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder addFrames(inr.numass.data.NumassProto.Point.Channel.Block.Frame value) { - if (framesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFramesIsMutable(); - frames_.add(value); - onChanged(); - } else { - framesBuilder_.addMessage(value); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder addFrames( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Frame value) { - if (framesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFramesIsMutable(); - frames_.add(index, value); - onChanged(); - } else { - framesBuilder_.addMessage(index, value); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder addFrames( - inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder builderForValue) { - if (framesBuilder_ == null) { - ensureFramesIsMutable(); - frames_.add(builderForValue.build()); - onChanged(); - } else { - framesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder addFrames( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder builderForValue) { - if (framesBuilder_ == null) { - ensureFramesIsMutable(); - frames_.add(index, builderForValue.build()); - onChanged(); - } else { - framesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder addAllFrames( - java.lang.Iterable values) { - if (framesBuilder_ == null) { - ensureFramesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, frames_); - onChanged(); - } else { - framesBuilder_.addAllMessages(values); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder clearFrames() { - if (framesBuilder_ == null) { - frames_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - framesBuilder_.clear(); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public Builder removeFrames(int index) { - if (framesBuilder_ == null) { - ensureFramesIsMutable(); - frames_.remove(index); - onChanged(); - } else { - framesBuilder_.remove(index); - } - return this; - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder getFramesBuilder( - int index) { - return getFramesFieldBuilder().getBuilder(index); - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder getFramesOrBuilder( - int index) { - if (framesBuilder_ == null) { - return frames_.get(index); } else { - return framesBuilder_.getMessageOrBuilder(index); - } - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public java.util.List - getFramesOrBuilderList() { - if (framesBuilder_ != null) { - return framesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(frames_); - } - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder addFramesBuilder() { - return getFramesFieldBuilder().addBuilder( - inr.numass.data.NumassProto.Point.Channel.Block.Frame.getDefaultInstance()); - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder addFramesBuilder( - int index) { - return getFramesFieldBuilder().addBuilder( - index, inr.numass.data.NumassProto.Point.Channel.Block.Frame.getDefaultInstance()); - } - /** - *
-           * Frames array
-           * 
- * - * repeated .inr.numass.data.Point.Channel.Block.Frame frames = 2; - */ - public java.util.List - getFramesBuilderList() { - return getFramesFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Frame, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder, inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder> - getFramesFieldBuilder() { - if (framesBuilder_ == null) { - framesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Frame, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder, inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder>( - frames_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - frames_ = null; - } - return framesBuilder_; - } - - private inr.numass.data.NumassProto.Point.Channel.Block.Events events_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Events, inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder, inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder> eventsBuilder_; - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public boolean hasEvents() { - return eventsBuilder_ != null || events_ != null; - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Events getEvents() { - if (eventsBuilder_ == null) { - return events_ == null ? inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance() : events_; - } else { - return eventsBuilder_.getMessage(); - } - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public Builder setEvents(inr.numass.data.NumassProto.Point.Channel.Block.Events value) { - if (eventsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - events_ = value; - onChanged(); - } else { - eventsBuilder_.setMessage(value); - } - - return this; - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public Builder setEvents( - inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder builderForValue) { - if (eventsBuilder_ == null) { - events_ = builderForValue.build(); - onChanged(); - } else { - eventsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public Builder mergeEvents(inr.numass.data.NumassProto.Point.Channel.Block.Events value) { - if (eventsBuilder_ == null) { - if (events_ != null) { - events_ = - inr.numass.data.NumassProto.Point.Channel.Block.Events.newBuilder(events_).mergeFrom(value).buildPartial(); - } else { - events_ = value; - } - onChanged(); - } else { - eventsBuilder_.mergeFrom(value); - } - - return this; - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public Builder clearEvents() { - if (eventsBuilder_ == null) { - events_ = null; - onChanged(); - } else { - events_ = null; - eventsBuilder_ = null; - } - - return this; - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder getEventsBuilder() { - - onChanged(); - return getEventsFieldBuilder().getBuilder(); - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder getEventsOrBuilder() { - if (eventsBuilder_ != null) { - return eventsBuilder_.getMessageOrBuilder(); - } else { - return events_ == null ? - inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance() : events_; - } - } - /** - *
-           * Events array
-           * 
- * - * .inr.numass.data.Point.Channel.Block.Events events = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Events, inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder, inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder> - getEventsFieldBuilder() { - if (eventsBuilder_ == null) { - eventsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block.Events, inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder, inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder>( - getEvents(), - getParentForChildren(), - isClean()); - events_ = null; - } - return eventsBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFieldsProto3(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:inr.numass.data.Point.Channel.Block) - } - - // @@protoc_insertion_point(class_scope:inr.numass.data.Point.Channel.Block) - private static final inr.numass.data.NumassProto.Point.Channel.Block DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new inr.numass.data.NumassProto.Point.Channel.Block(); - } - - public static inr.numass.data.NumassProto.Point.Channel.Block getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Block parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Block(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public inr.numass.data.NumassProto.Point.Channel.Block getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private int bitField0_; - public static final int NUM_FIELD_NUMBER = 1; - private long num_; - /** - *
-       * The number of measuring channel
-       * 
- * - * uint64 num = 1; - */ - public long getNum() { - return num_; - } - - public static final int BLOCKS_FIELD_NUMBER = 2; - private java.util.List blocks_; - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public java.util.List getBlocksList() { - return blocks_; - } - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public java.util.List - getBlocksOrBuilderList() { - return blocks_; - } - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public int getBlocksCount() { - return blocks_.size(); - } - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block getBlocks(int index) { - return blocks_.get(index); - } - /** - *
-       * Blocks
-       * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder getBlocksOrBuilder( - int index) { - return blocks_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (num_ != 0L) { - output.writeUInt64(1, num_); - } - for (int i = 0; i < blocks_.size(); i++) { - output.writeMessage(2, blocks_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (num_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, num_); - } - for (int i = 0; i < blocks_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, blocks_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof inr.numass.data.NumassProto.Point.Channel)) { - return super.equals(obj); - } - inr.numass.data.NumassProto.Point.Channel other = (inr.numass.data.NumassProto.Point.Channel) obj; - - boolean result = true; - result = result && (getNum() - == other.getNum()); - result = result && getBlocksList() - .equals(other.getBlocksList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NUM_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getNum()); - if (getBlocksCount() > 0) { - hash = (37 * hash) + BLOCKS_FIELD_NUMBER; - hash = (53 * hash) + getBlocksList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point.Channel parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(inr.numass.data.NumassProto.Point.Channel prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-       * A single channel for multichannel detector readout
-       * 
- * - * Protobuf type {@code inr.numass.data.Point.Channel} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:inr.numass.data.Point.Channel) - inr.numass.data.NumassProto.Point.ChannelOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.Channel.class, inr.numass.data.NumassProto.Point.Channel.Builder.class); - } - - // Construct using inr.numass.data.NumassProto.Point.Channel.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getBlocksFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - num_ = 0L; - - if (blocksBuilder_ == null) { - blocks_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - blocksBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_descriptor; - } - - public inr.numass.data.NumassProto.Point.Channel getDefaultInstanceForType() { - return inr.numass.data.NumassProto.Point.Channel.getDefaultInstance(); - } - - public inr.numass.data.NumassProto.Point.Channel build() { - inr.numass.data.NumassProto.Point.Channel result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public inr.numass.data.NumassProto.Point.Channel buildPartial() { - inr.numass.data.NumassProto.Point.Channel result = new inr.numass.data.NumassProto.Point.Channel(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - result.num_ = num_; - if (blocksBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - blocks_ = java.util.Collections.unmodifiableList(blocks_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.blocks_ = blocks_; - } else { - result.blocks_ = blocksBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof inr.numass.data.NumassProto.Point.Channel) { - return mergeFrom((inr.numass.data.NumassProto.Point.Channel)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(inr.numass.data.NumassProto.Point.Channel other) { - if (other == inr.numass.data.NumassProto.Point.Channel.getDefaultInstance()) return this; - if (other.getNum() != 0L) { - setNum(other.getNum()); - } - if (blocksBuilder_ == null) { - if (!other.blocks_.isEmpty()) { - if (blocks_.isEmpty()) { - blocks_ = other.blocks_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureBlocksIsMutable(); - blocks_.addAll(other.blocks_); - } - onChanged(); - } - } else { - if (!other.blocks_.isEmpty()) { - if (blocksBuilder_.isEmpty()) { - blocksBuilder_.dispose(); - blocksBuilder_ = null; - blocks_ = other.blocks_; - bitField0_ = (bitField0_ & ~0x00000002); - blocksBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getBlocksFieldBuilder() : null; - } else { - blocksBuilder_.addAllMessages(other.blocks_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - inr.numass.data.NumassProto.Point.Channel parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (inr.numass.data.NumassProto.Point.Channel) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long num_ ; - /** - *
-         * The number of measuring channel
-         * 
- * - * uint64 num = 1; - */ - public long getNum() { - return num_; - } - /** - *
-         * The number of measuring channel
-         * 
- * - * uint64 num = 1; - */ - public Builder setNum(long value) { - - num_ = value; - onChanged(); - return this; - } - /** - *
-         * The number of measuring channel
-         * 
- * - * uint64 num = 1; - */ - public Builder clearNum() { - - num_ = 0L; - onChanged(); - return this; - } - - private java.util.List blocks_ = - java.util.Collections.emptyList(); - private void ensureBlocksIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - blocks_ = new java.util.ArrayList(blocks_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block, inr.numass.data.NumassProto.Point.Channel.Block.Builder, inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder> blocksBuilder_; - - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public java.util.List getBlocksList() { - if (blocksBuilder_ == null) { - return java.util.Collections.unmodifiableList(blocks_); - } else { - return blocksBuilder_.getMessageList(); - } - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public int getBlocksCount() { - if (blocksBuilder_ == null) { - return blocks_.size(); - } else { - return blocksBuilder_.getCount(); - } - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block getBlocks(int index) { - if (blocksBuilder_ == null) { - return blocks_.get(index); - } else { - return blocksBuilder_.getMessage(index); - } - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder setBlocks( - int index, inr.numass.data.NumassProto.Point.Channel.Block value) { - if (blocksBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBlocksIsMutable(); - blocks_.set(index, value); - onChanged(); - } else { - blocksBuilder_.setMessage(index, value); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder setBlocks( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Builder builderForValue) { - if (blocksBuilder_ == null) { - ensureBlocksIsMutable(); - blocks_.set(index, builderForValue.build()); - onChanged(); - } else { - blocksBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder addBlocks(inr.numass.data.NumassProto.Point.Channel.Block value) { - if (blocksBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBlocksIsMutable(); - blocks_.add(value); - onChanged(); - } else { - blocksBuilder_.addMessage(value); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder addBlocks( - int index, inr.numass.data.NumassProto.Point.Channel.Block value) { - if (blocksBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBlocksIsMutable(); - blocks_.add(index, value); - onChanged(); - } else { - blocksBuilder_.addMessage(index, value); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder addBlocks( - inr.numass.data.NumassProto.Point.Channel.Block.Builder builderForValue) { - if (blocksBuilder_ == null) { - ensureBlocksIsMutable(); - blocks_.add(builderForValue.build()); - onChanged(); - } else { - blocksBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder addBlocks( - int index, inr.numass.data.NumassProto.Point.Channel.Block.Builder builderForValue) { - if (blocksBuilder_ == null) { - ensureBlocksIsMutable(); - blocks_.add(index, builderForValue.build()); - onChanged(); - } else { - blocksBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder addAllBlocks( - java.lang.Iterable values) { - if (blocksBuilder_ == null) { - ensureBlocksIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, blocks_); - onChanged(); - } else { - blocksBuilder_.addAllMessages(values); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder clearBlocks() { - if (blocksBuilder_ == null) { - blocks_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - blocksBuilder_.clear(); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public Builder removeBlocks(int index) { - if (blocksBuilder_ == null) { - ensureBlocksIsMutable(); - blocks_.remove(index); - onChanged(); - } else { - blocksBuilder_.remove(index); - } - return this; - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Builder getBlocksBuilder( - int index) { - return getBlocksFieldBuilder().getBuilder(index); - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder getBlocksOrBuilder( - int index) { - if (blocksBuilder_ == null) { - return blocks_.get(index); } else { - return blocksBuilder_.getMessageOrBuilder(index); - } - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public java.util.List - getBlocksOrBuilderList() { - if (blocksBuilder_ != null) { - return blocksBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(blocks_); - } - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Builder addBlocksBuilder() { - return getBlocksFieldBuilder().addBuilder( - inr.numass.data.NumassProto.Point.Channel.Block.getDefaultInstance()); - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public inr.numass.data.NumassProto.Point.Channel.Block.Builder addBlocksBuilder( - int index) { - return getBlocksFieldBuilder().addBuilder( - index, inr.numass.data.NumassProto.Point.Channel.Block.getDefaultInstance()); - } - /** - *
-         * Blocks
-         * 
- * - * repeated .inr.numass.data.Point.Channel.Block blocks = 2; - */ - public java.util.List - getBlocksBuilderList() { - return getBlocksFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block, inr.numass.data.NumassProto.Point.Channel.Block.Builder, inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder> - getBlocksFieldBuilder() { - if (blocksBuilder_ == null) { - blocksBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel.Block, inr.numass.data.NumassProto.Point.Channel.Block.Builder, inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder>( - blocks_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - blocks_ = null; - } - return blocksBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFieldsProto3(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:inr.numass.data.Point.Channel) - } - - // @@protoc_insertion_point(class_scope:inr.numass.data.Point.Channel) - private static final inr.numass.data.NumassProto.Point.Channel DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new inr.numass.data.NumassProto.Point.Channel(); - } - - public static inr.numass.data.NumassProto.Point.Channel getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Channel parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Channel(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public inr.numass.data.NumassProto.Point.Channel getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public static final int CHANNELS_FIELD_NUMBER = 1; - private java.util.List channels_; - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public java.util.List getChannelsList() { - return channels_; - } - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public java.util.List - getChannelsOrBuilderList() { - return channels_; - } - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public int getChannelsCount() { - return channels_.size(); - } - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.Channel getChannels(int index) { - return channels_.get(index); - } - /** - *
-     * Array of measuring channels
-     * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.ChannelOrBuilder getChannelsOrBuilder( - int index) { - return channels_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < channels_.size(); i++) { - output.writeMessage(1, channels_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < channels_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, channels_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof inr.numass.data.NumassProto.Point)) { - return super.equals(obj); - } - inr.numass.data.NumassProto.Point other = (inr.numass.data.NumassProto.Point) obj; - - boolean result = true; - result = result && getChannelsList() - .equals(other.getChannelsList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getChannelsCount() > 0) { - hash = (37 * hash) + CHANNELS_FIELD_NUMBER; - hash = (53 * hash) + getChannelsList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static inr.numass.data.NumassProto.Point parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static inr.numass.data.NumassProto.Point parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static inr.numass.data.NumassProto.Point parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static inr.numass.data.NumassProto.Point parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(inr.numass.data.NumassProto.Point prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code inr.numass.data.Point} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:inr.numass.data.Point) - inr.numass.data.NumassProto.PointOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_fieldAccessorTable - .ensureFieldAccessorsInitialized( - inr.numass.data.NumassProto.Point.class, inr.numass.data.NumassProto.Point.Builder.class); - } - - // Construct using inr.numass.data.NumassProto.Point.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getChannelsFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - if (channelsBuilder_ == null) { - channels_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - channelsBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_descriptor; - } - - public inr.numass.data.NumassProto.Point getDefaultInstanceForType() { - return inr.numass.data.NumassProto.Point.getDefaultInstance(); - } - - public inr.numass.data.NumassProto.Point build() { - inr.numass.data.NumassProto.Point result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public inr.numass.data.NumassProto.Point buildPartial() { - inr.numass.data.NumassProto.Point result = new inr.numass.data.NumassProto.Point(this); - int from_bitField0_ = bitField0_; - if (channelsBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - channels_ = java.util.Collections.unmodifiableList(channels_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.channels_ = channels_; - } else { - result.channels_ = channelsBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof inr.numass.data.NumassProto.Point) { - return mergeFrom((inr.numass.data.NumassProto.Point)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(inr.numass.data.NumassProto.Point other) { - if (other == inr.numass.data.NumassProto.Point.getDefaultInstance()) return this; - if (channelsBuilder_ == null) { - if (!other.channels_.isEmpty()) { - if (channels_.isEmpty()) { - channels_ = other.channels_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureChannelsIsMutable(); - channels_.addAll(other.channels_); - } - onChanged(); - } - } else { - if (!other.channels_.isEmpty()) { - if (channelsBuilder_.isEmpty()) { - channelsBuilder_.dispose(); - channelsBuilder_ = null; - channels_ = other.channels_; - bitField0_ = (bitField0_ & ~0x00000001); - channelsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getChannelsFieldBuilder() : null; - } else { - channelsBuilder_.addAllMessages(other.channels_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - inr.numass.data.NumassProto.Point parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (inr.numass.data.NumassProto.Point) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List channels_ = - java.util.Collections.emptyList(); - private void ensureChannelsIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - channels_ = new java.util.ArrayList(channels_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel, inr.numass.data.NumassProto.Point.Channel.Builder, inr.numass.data.NumassProto.Point.ChannelOrBuilder> channelsBuilder_; - - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public java.util.List getChannelsList() { - if (channelsBuilder_ == null) { - return java.util.Collections.unmodifiableList(channels_); - } else { - return channelsBuilder_.getMessageList(); - } - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public int getChannelsCount() { - if (channelsBuilder_ == null) { - return channels_.size(); - } else { - return channelsBuilder_.getCount(); - } - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.Channel getChannels(int index) { - if (channelsBuilder_ == null) { - return channels_.get(index); - } else { - return channelsBuilder_.getMessage(index); - } - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder setChannels( - int index, inr.numass.data.NumassProto.Point.Channel value) { - if (channelsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureChannelsIsMutable(); - channels_.set(index, value); - onChanged(); - } else { - channelsBuilder_.setMessage(index, value); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder setChannels( - int index, inr.numass.data.NumassProto.Point.Channel.Builder builderForValue) { - if (channelsBuilder_ == null) { - ensureChannelsIsMutable(); - channels_.set(index, builderForValue.build()); - onChanged(); - } else { - channelsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder addChannels(inr.numass.data.NumassProto.Point.Channel value) { - if (channelsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureChannelsIsMutable(); - channels_.add(value); - onChanged(); - } else { - channelsBuilder_.addMessage(value); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder addChannels( - int index, inr.numass.data.NumassProto.Point.Channel value) { - if (channelsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureChannelsIsMutable(); - channels_.add(index, value); - onChanged(); - } else { - channelsBuilder_.addMessage(index, value); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder addChannels( - inr.numass.data.NumassProto.Point.Channel.Builder builderForValue) { - if (channelsBuilder_ == null) { - ensureChannelsIsMutable(); - channels_.add(builderForValue.build()); - onChanged(); - } else { - channelsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder addChannels( - int index, inr.numass.data.NumassProto.Point.Channel.Builder builderForValue) { - if (channelsBuilder_ == null) { - ensureChannelsIsMutable(); - channels_.add(index, builderForValue.build()); - onChanged(); - } else { - channelsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder addAllChannels( - java.lang.Iterable values) { - if (channelsBuilder_ == null) { - ensureChannelsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, channels_); - onChanged(); - } else { - channelsBuilder_.addAllMessages(values); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder clearChannels() { - if (channelsBuilder_ == null) { - channels_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - channelsBuilder_.clear(); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public Builder removeChannels(int index) { - if (channelsBuilder_ == null) { - ensureChannelsIsMutable(); - channels_.remove(index); - onChanged(); - } else { - channelsBuilder_.remove(index); - } - return this; - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.Channel.Builder getChannelsBuilder( - int index) { - return getChannelsFieldBuilder().getBuilder(index); - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.ChannelOrBuilder getChannelsOrBuilder( - int index) { - if (channelsBuilder_ == null) { - return channels_.get(index); } else { - return channelsBuilder_.getMessageOrBuilder(index); - } - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public java.util.List - getChannelsOrBuilderList() { - if (channelsBuilder_ != null) { - return channelsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(channels_); - } - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.Channel.Builder addChannelsBuilder() { - return getChannelsFieldBuilder().addBuilder( - inr.numass.data.NumassProto.Point.Channel.getDefaultInstance()); - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public inr.numass.data.NumassProto.Point.Channel.Builder addChannelsBuilder( - int index) { - return getChannelsFieldBuilder().addBuilder( - index, inr.numass.data.NumassProto.Point.Channel.getDefaultInstance()); - } - /** - *
-       * Array of measuring channels
-       * 
- * - * repeated .inr.numass.data.Point.Channel channels = 1; - */ - public java.util.List - getChannelsBuilderList() { - return getChannelsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel, inr.numass.data.NumassProto.Point.Channel.Builder, inr.numass.data.NumassProto.Point.ChannelOrBuilder> - getChannelsFieldBuilder() { - if (channelsBuilder_ == null) { - channelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - inr.numass.data.NumassProto.Point.Channel, inr.numass.data.NumassProto.Point.Channel.Builder, inr.numass.data.NumassProto.Point.ChannelOrBuilder>( - channels_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - channels_ = null; - } - return channelsBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFieldsProto3(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:inr.numass.data.Point) - } - - // @@protoc_insertion_point(class_scope:inr.numass.data.Point) - private static final inr.numass.data.NumassProto.Point DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new inr.numass.data.NumassProto.Point(); - } - - public static inr.numass.data.NumassProto.Point getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Point parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Point(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public inr.numass.data.NumassProto.Point getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_inr_numass_data_Point_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_inr_numass_data_Point_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_inr_numass_data_Point_Channel_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_inr_numass_data_Point_Channel_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_inr_numass_data_Point_Channel_Block_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_inr_numass_data_Point_Channel_Block_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_inr_numass_data_Point_Channel_Block_Frame_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_inr_numass_data_Point_Channel_Block_Events_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\034inr/numas/numass-proto.proto\022\017inr.numa" + - "ss.data\"\353\002\n\005Point\0220\n\010channels\030\001 \003(\0132\036.in" + - "r.numass.data.Point.Channel\032\257\002\n\007Channel\022" + - "\013\n\003num\030\001 \001(\004\0224\n\006blocks\030\002 \003(\0132$.inr.numas" + - "s.data.Point.Channel.Block\032\340\001\n\005Block\022\014\n\004" + - "time\030\001 \001(\004\022:\n\006frames\030\002 \003(\0132*.inr.numass." + - "data.Point.Channel.Block.Frame\022;\n\006events" + - "\030\003 \001(\0132+.inr.numass.data.Point.Channel.B" + - "lock.Events\032#\n\005Frame\022\014\n\004time\030\001 \001(\004\022\014\n\004da" + - "ta\030\002 \001(\014\032+\n\006Events\022\r\n\005times\030\001 \003(\004\022\022\n\namp" + - "litudes\030\002 \003(\004b\006proto3" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - internal_static_inr_numass_data_Point_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_inr_numass_data_Point_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_inr_numass_data_Point_descriptor, - new java.lang.String[] { "Channels", }); - internal_static_inr_numass_data_Point_Channel_descriptor = - internal_static_inr_numass_data_Point_descriptor.getNestedTypes().get(0); - internal_static_inr_numass_data_Point_Channel_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_inr_numass_data_Point_Channel_descriptor, - new java.lang.String[] { "Num", "Blocks", }); - internal_static_inr_numass_data_Point_Channel_Block_descriptor = - internal_static_inr_numass_data_Point_Channel_descriptor.getNestedTypes().get(0); - internal_static_inr_numass_data_Point_Channel_Block_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_inr_numass_data_Point_Channel_Block_descriptor, - new java.lang.String[] { "Time", "Frames", "Events", }); - internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor = - internal_static_inr_numass_data_Point_Channel_Block_descriptor.getNestedTypes().get(0); - internal_static_inr_numass_data_Point_Channel_Block_Frame_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor, - new java.lang.String[] { "Time", "Data", }); - internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor = - internal_static_inr_numass_data_Point_Channel_Block_descriptor.getNestedTypes().get(1); - internal_static_inr_numass_data_Point_Channel_Block_Events_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor, - new java.lang.String[] { "Times", "Amplitudes", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} 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 38cc3320..1201e42f 100644 --- a/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt +++ b/numass-core/src/main/kotlin/inr/numass/data/NumassDataUtils.kt @@ -6,12 +6,15 @@ import hep.dataforge.meta.Meta import hep.dataforge.meta.MetaBuilder import inr.numass.data.api.* import inr.numass.data.storage.ProtoBlock +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream import java.io.InputStream import java.util.stream.Collectors import java.util.stream.Stream -import java.util.zip.ZipInputStream +import java.util.zip.Inflater import kotlin.streams.asSequence + /** * Created by darksnake on 30-Jan-17. */ @@ -46,7 +49,18 @@ object NumassDataUtils { */ val Envelope.dataStream: InputStream get() = if (this.meta.getString("compression", "none") == "zlib") { - ZipInputStream(this.data.stream) + //TODO move to new type of data + val inflatter = Inflater() + inflatter.setInput(data.buffer.array()) + val bos = ByteArrayOutputStream() + val buffer = ByteArray(8192) + while (!inflatter.finished()) { + val size = inflatter.inflate(buffer) + bos.write(buffer, 0, size) + } + val unzippeddata = bos.toByteArray() + inflatter.end() + ByteArrayInputStream(unzippeddata) } else { this.data.stream } @@ -59,11 +73,13 @@ val NumassBlock.channel: Int? } -fun NumassBlock.transformChain(transform: (NumassEvent, NumassEvent) -> Pair): NumassBlock { +fun NumassBlock.transformChain(transform: (NumassEvent, NumassEvent) -> Pair?): NumassBlock { return SimpleBlock(this.startTime, this.length, this.meta) { owner -> this.events.asSequence() .sortedBy { it.timeOffset } - .zipWithNext(transform).map { NumassEvent(it.first, it.second, owner) }.asIterable() + .zipWithNext(transform) + .filterNotNull() + .map { NumassEvent(it.first, it.second, owner) }.asIterable() } } @@ -77,8 +93,7 @@ fun NumassBlock.filterChain(condition: (NumassEvent, NumassEvent) -> Boolean): N fun NumassBlock.filter(condition: (NumassEvent) -> Boolean): NumassBlock { return SimpleBlock(this.startTime, this.length, this.meta) { owner -> - this.events.asSequence() - .filter(condition).asIterable() + this.events.asSequence().filter(condition).asIterable() } } 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 38772afd..46368714 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 @@ -119,11 +119,6 @@ interface NumassAnalyzer { val AMPLITUDE_ADAPTER: ValuesAdapter = Adapters.buildXYAdapter(CHANNEL_KEY, COUNT_RATE_KEY) // val MAX_CHANNEL = 10000 - - fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = null): Table { - return spectrumWithBinning(this,binSize, loChannel, upChannel) - } - } } @@ -135,8 +130,8 @@ interface NumassAnalyzer { * @param upChannel * @return */ -fun countInWindow(spectrum: Table, loChannel: Short, upChannel: Short): Long { - return spectrum.rows.filter { row -> +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() } @@ -195,7 +190,7 @@ fun getAmplitudeSpectrum(events: Sequence, length: Double, config: * @return */ @JvmOverloads -fun spectrumWithBinning(spectrum: Table, binSize: Int, loChannel: Int? = null, upChannel: Int? = null): Table { +fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = null): Table { val format = TableFormatBuilder() .addNumber(NumassAnalyzer.CHANNEL_KEY, X_VALUE_KEY) .addNumber(NumassAnalyzer.COUNT_KEY, Y_VALUE_KEY) @@ -204,9 +199,9 @@ fun spectrumWithBinning(spectrum: Table, binSize: Int, loChannel: Int? = null, u .addNumber("binSize") val builder = ListTable.Builder(format) - var chan = loChannel ?: spectrum.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.min().orElse(0) + var chan = loChannel ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.min().orElse(0) - val top = upChannel ?: spectrum.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.max().orElse(1) + val top = upChannel ?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.intValue() }.max().orElse(1) while (chan < top - binSize) { val count = AtomicLong(0) @@ -216,7 +211,7 @@ fun spectrumWithBinning(spectrum: Table, binSize: Int, loChannel: Int? = null, u val binLo = chan val binUp = chan + binSize - spectrum.rows.filter { row -> + this.rows.filter { row -> row.getInt(NumassAnalyzer.CHANNEL_KEY) in binLo..(binUp - 1) }.forEach { row -> count.addAndGet(row.getValue(NumassAnalyzer.COUNT_KEY, 0).longValue()) 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 fef9d952..4da0a6b9 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 @@ -28,21 +28,23 @@ class ProtoNumassPoint(private val envelope: Envelope) : NumassPoint { private val point: NumassProto.Point get() = try { - envelope.dataStream.use { stream -> return NumassProto.Point.parseFrom(stream) } + envelope.dataStream.use { + NumassProto.Point.parseFrom(it) + } } catch (ex: IOException) { - throw RuntimeException("Failed to read point via protobuf") + throw RuntimeException("Failed to read point via protobuf", ex) } override val blocks: Stream get() = point.channelsList.stream() .flatMap { channel -> channel.blocksList.stream() - .map { block -> ProtoBlock(channel.num.toInt(), block) } + .map { block -> ProtoBlock(channel.id.toInt(), block) } .sorted(Comparator.comparing { it.startTime }) } - override val meta: Meta =envelope.meta + override val meta: Meta = envelope.meta companion object { fun readFile(path: Path): ProtoNumassPoint { @@ -63,7 +65,7 @@ class ProtoNumassPoint(private val envelope: Envelope) : NumassPoint { class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel.Block) : NumassBlock { override val meta: Meta by lazy { - buildMeta{ + buildMeta { "channel" to channel } } @@ -72,7 +74,13 @@ class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel. get() = ProtoNumassPoint.ofEpochNanos(block.time) override val length: Duration - get() = Duration.ofNanos((meta.getDouble("params.b_size") / meta.getDouble("params.sample_freq") * 1e9).toLong()) + get() = if (meta.hasMeta("params")) { + Duration.ofNanos((meta.getDouble("params.b_size") / meta.getDouble("params.sample_freq") * 1e9).toLong()) + } else if (meta.hasValue("length")) { + Duration.ofNanos(meta.getValue("length").longValue()) + } else { + Duration.ZERO + } override val events: Stream @@ -86,7 +94,13 @@ class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel. override val frames: Stream get() { - val tickSize = Duration.ofNanos((1e9 / meta.getInt("params.sample_freq")).toLong()) + val tickSize = if (meta.hasMeta("params")) { + Duration.ofNanos((1e9 / meta.getInt("params.sample_freq")).toLong()) + } else if (meta.hasValue("tick_length")) { + Duration.ofNanos(meta.getInt("tick_length").toLong()) + } else { + Duration.ofNanos(1) + } return block.framesList.stream().map { frame -> val time = startTime.plusNanos(frame.time) val data = frame.data.asReadOnlyByteBuffer() diff --git a/numass-core/src/main/proto/inr/numas/numass-proto.proto b/numass-core/src/main/proto/inr/numas/numass-proto.proto index ff3ca04f..bafb68c6 100644 --- a/numass-core/src/main/proto/inr/numas/numass-proto.proto +++ b/numass-core/src/main/proto/inr/numas/numass-proto.proto @@ -20,11 +20,14 @@ message Point { repeated uint64 times = 1; // Array of time in nanos from the beginning of the block repeated uint64 amplitudes = 2; // Array of amplitudes of events in channels } + uint64 time = 1; // Block start in epoch nanos repeated Frame frames = 2; // Frames array Events events = 3; // Events array + uint64 length = 4; // block size in nanos + uint64 bin_size = 5; // tick size in nanos } - uint64 num = 1; // The number of measuring channel + uint64 id = 1; // The number of measuring channel repeated Block blocks = 2; // Blocks } repeated Channel channels = 1; // Array of measuring channels diff --git a/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy b/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy index cdb8eccf..8a474c9a 100644 --- a/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy +++ b/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy @@ -77,7 +77,7 @@ shell.eval { DataPlot.plot( it.key as String, adapter, - NumassAnalyzerKt.spectrumWithBinning(it.value as Table, binning) + NumassAnalyzerKt.withBinning(it.value as Table, binning) ) ) } 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 dabcd384..c963cb52 100644 --- a/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java +++ b/numass-main/src/main/java/inr/numass/utils/UnderflowCorrection.java @@ -12,6 +12,7 @@ import hep.dataforge.tables.TableTransform; import hep.dataforge.tables.ValueMap; import hep.dataforge.values.Values; import inr.numass.data.analyzers.NumassAnalyzer; +import inr.numass.data.analyzers.NumassAnalyzerKt; import inr.numass.data.api.NumassPoint; import org.apache.commons.math3.analysis.ParametricUnivariateFunction; import org.apache.commons.math3.exception.DimensionMismatchException; @@ -23,7 +24,6 @@ import java.util.stream.Collectors; import static inr.numass.data.analyzers.NumassAnalyzer.CHANNEL_KEY; import static inr.numass.data.analyzers.NumassAnalyzer.COUNT_RATE_KEY; -import static inr.numass.data.analyzers.NumassAnalyzerKt.spectrumWithBinning; /** * A class to calculate underflow correction @@ -110,7 +110,7 @@ public class UnderflowCorrection { throw new IllegalArgumentException("Wrong borders for underflow calculation"); } Table binned = TableTransform.filter( - spectrumWithBinning(spectrum, binning), + NumassAnalyzerKt.withBinning(spectrum, binning), CHANNEL_KEY, xLow, xHigh diff --git a/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt b/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt index 9a38911e..3eb5a7f8 100644 --- a/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt +++ b/numass-main/src/main/kotlin/inr/numass/data/Visualization.kt @@ -22,24 +22,29 @@ import hep.dataforge.fx.plots.FXPlotManager import hep.dataforge.kodex.KMetaBuilder import hep.dataforge.kodex.buildMeta import hep.dataforge.kodex.configure +import hep.dataforge.kodex.nullable import hep.dataforge.plots.data.DataPlot import hep.dataforge.tables.Adapters import inr.numass.data.analyzers.NumassAnalyzer import inr.numass.data.analyzers.SmartAnalyzer +import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassBlock -fun NumassBlock.plotAmplitudeSpectrum(plotName: String = "spectrum", frameName: String = "", context: Context = Global, metaAction: KMetaBuilder.() -> Unit) { +fun NumassBlock.plotAmplitudeSpectrum(plotName: String = "spectrum", frameName: String = "", context: Context = Global, metaAction: KMetaBuilder.() -> Unit = {}) { val meta = buildMeta("meta", metaAction) val plotManager = context.load(FXPlotManager::class) - val data = SmartAnalyzer().getAmplitudeSpectrum(this, meta.getMetaOrEmpty("spectrum")) + val binning = meta.getInt("binning", 20) + val lo = meta.optNumber("window.lo").nullable?.toInt() + val up = meta.optNumber("window.up").nullable?.toInt() + val data = SmartAnalyzer().getAmplitudeSpectrum(this, meta.getMetaOrEmpty("spectrum")).withBinning(binning, lo, up) plotManager.display(name = frameName) { - val valueAxis = if (meta.getBoolean("normalize",true)) { + val valueAxis = if (meta.getBoolean("normalize", false)) { NumassAnalyzer.COUNT_RATE_KEY } else { NumassAnalyzer.COUNT_KEY } - val plot = DataPlot.plot( + val plot = DataPlot.plot( plotName, Adapters.buildXYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis), data @@ -51,6 +56,7 @@ fun NumassBlock.plotAmplitudeSpectrum(plotName: String = "spectrum", frameName: "showErrors" to false "JFreeChart.cache" to true } + plot.configure(meta) add(plot) } } \ No newline at end of file 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 5c977e3c..eebe3258 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/DifferentialSpectrum.kt @@ -27,6 +27,7 @@ import inr.numass.data.NumassDataUtils import inr.numass.data.analyzers.NumassAnalyzer import inr.numass.data.analyzers.SmartAnalyzer import inr.numass.data.analyzers.subtractAmplitudeSpectrum +import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassSet import inr.numass.data.storage.NumassStorageFactory diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt index 08337019..3767e055 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChain.kt @@ -24,8 +24,8 @@ import hep.dataforge.plots.data.DataPlot import inr.numass.NumassPlugin import inr.numass.data.NumassDataUtils import inr.numass.data.analyzers.NumassAnalyzer.Companion.AMPLITUDE_ADAPTER -import inr.numass.data.analyzers.NumassAnalyzer.Companion.withBinning import inr.numass.data.analyzers.SmartAnalyzer +import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassSet import inr.numass.data.storage.NumassStorageFactory diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt index 8420dd26..dbaa3f19 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/InversedChainProto.kt @@ -23,8 +23,9 @@ import hep.dataforge.kodex.buildMeta import hep.dataforge.plots.data.DataPlot import inr.numass.NumassPlugin import inr.numass.data.analyzers.NumassAnalyzer.Companion.AMPLITUDE_ADAPTER -import inr.numass.data.analyzers.NumassAnalyzer.Companion.withBinning + import inr.numass.data.analyzers.SmartAnalyzer +import inr.numass.data.analyzers.withBinning import inr.numass.data.storage.ProtoNumassPoint import java.nio.file.Paths diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt b/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt index 1bef7611..6d35c302 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/tristan/AnalyzeTristan.kt @@ -1,11 +1,62 @@ package inr.numass.scripts.tristan +import inr.numass.data.channel +import inr.numass.data.plotAmplitudeSpectrum import inr.numass.data.storage.ProtoNumassPoint +import inr.numass.data.transformChain +import java.io.File fun main(args: Array) { + val file = File("D:\\Work\\Numass\\data\\TRISTAN_11_2017\\df\\gun_16_19.df").toPath() + val point = ProtoNumassPoint.readFile(file) + point.plotAmplitudeSpectrum() - val file = ProtoNumassPoint.readFile("D:\\Work\\Numass\\data\\TRISTAN_11_2017\\df\\gun_16_19.df ") - val filtered = file.filter { it.channel == 4 } + point.blocks.filter { it.channel == 0 }.findFirst().ifPresent { + it.plotAmplitudeSpectrum(plotName = "0") { + "title" to "pixel 0" + "binning" to 50 + } + } + point.blocks.filter { it.channel == 4 }.findFirst().ifPresent { + it.plotAmplitudeSpectrum(plotName = "4") { + "title" to "pixel 4" + "binning" to 50 + } + println("Number of events for pixel 4 is ${it.events.count()}") + } + listOf(0, 20, 50, 100, 200).forEach { window -> + + point.transformChain { first, second -> + val dt = second.timeOffset - first.timeOffset + if (second.channel == 4 && first.channel == 0 && dt > window && dt < 1000) { + Pair((first.amp + second.amp).toShort(), second.timeOffset) + } else { + null + } + }.also { + println("Number of events for $window is ${it.events.count()}") + }.plotAmplitudeSpectrum(plotName = "filtered.before.$window") { + "binning" to 50 + } + + } + + listOf(0, 20, 50, 100, 200).forEach { window -> + + point.transformChain { first, second -> + val dt = second.timeOffset - first.timeOffset + if (second.channel == 0 && first.channel == 4 && dt > window && dt < 1000) { + Pair((first.amp + second.amp).toShort(), second.timeOffset) + } else { + null + } + }.also { + println("Number of events for $window is ${it.events.count()}") + }.plotAmplitudeSpectrum(plotName = "filtered.after.$window") { + "binning" to 50 + } + + } } \ No newline at end of file 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 6fa11c18..12a1f4ba 100644 --- a/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt +++ b/numass-main/src/main/kotlin/inr/numass/subthreshold/Threshold.kt @@ -10,13 +10,12 @@ import hep.dataforge.meta.Meta import hep.dataforge.storage.commons.StorageUtils import hep.dataforge.tables.ListTable import hep.dataforge.tables.Table -import hep.dataforge.tables.TableTransform import hep.dataforge.tables.ValueMap import hep.dataforge.values.Values import inr.numass.data.analyzers.NumassAnalyzer.Companion.CHANNEL_KEY import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY import inr.numass.data.analyzers.TimeAnalyzer -import inr.numass.data.analyzers.spectrumWithBinning +import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet import inr.numass.data.api.SimpleNumassPoint @@ -78,12 +77,13 @@ object Threshold { if (xHigh <= xLow) { throw IllegalArgumentException("Wrong borders for underflow calculation"); } - val binned = TableTransform.filter( - spectrumWithBinning(spectrum, binning), - CHANNEL_KEY, - xLow, - xHigh - ) + val binned = spectrum.withBinning(binning, xLow, xHigh) +// val binned = TableTransform.filter( +// spectrum.withBinning(binning), +// CHANNEL_KEY, +// xLow, +// xHigh +// ) return binned.rows .map { diff --git a/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt b/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt index 0fce05e5..457def19 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/AmplitudeView.kt @@ -14,7 +14,7 @@ import hep.dataforge.tables.Adapters import hep.dataforge.tables.Table import inr.numass.data.analyzers.NumassAnalyzer import inr.numass.data.analyzers.SimpleAnalyzer -import inr.numass.data.analyzers.spectrumWithBinning +import inr.numass.data.analyzers.withBinning import inr.numass.data.api.NumassPoint import javafx.beans.Observable import javafx.beans.binding.DoubleBinding @@ -133,7 +133,7 @@ class AmplitudeView( DataPlot.plot( key, Adapters.buildXYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis), - spectrumWithBinning(getSpectrum(point), binning) + getSpectrum(point).withBinning(binning) ).configure { "connectionType" to "step" "thickness" to 2 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 842bd890..2db77b76 100644 --- a/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt +++ b/numass-viewer/src/main/kotlin/inr/numass/viewer/SpectrumView.kt @@ -173,7 +173,7 @@ class SpectrumView( runGoal("spectrumData[$name]") { set.points.map { point -> - val count = countInWindow(getSpectrum(point), loChannel.toShort(), upChannel.toShort()); + val count = getSpectrum(point).countInWindow(loChannel.toShort(), upChannel.toShort()); val seconds = point.length.toMillis() / 1000.0; runLater { container.progress = progress.incrementAndGet().toDouble() / totalProgress