Redoing devices using meta state

This commit is contained in:
Alexander Nozik 2017-12-10 20:11:23 +03:00
parent fb158ffffd
commit 70a55b9c0b
9 changed files with 128 additions and 173 deletions

View File

@ -19,14 +19,25 @@ allprojects{
maven { url "https://dl.bintray.com/kotlin/kotlinx" } maven { url "https://dl.bintray.com/kotlin/kotlinx" }
} }
// tasks.withType(JavaCompile) { apply plugin: "kotlin"
// options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
// }
dependencies { compileKotlin {
testCompile 'org.codehaus.groovy:groovy-all:2.4.+' kotlinOptions {
testCompile group: 'junit', name: 'junit', version: '4.+' jvmTarget = "1.8"
testCompile "org.spockframework:spock-core:1.0-groovy-2.+" javaParameters = true
}
} }
compileTestKotlin{
kotlinOptions {
jvmTarget = "1.8"
javaParameters = true
}
}
kotlin {
experimental {
coroutines "enable"
}
}
} }

View File

@ -28,9 +28,9 @@ import hep.dataforge.meta.Meta
import hep.dataforge.utils.DateTimeUtils import hep.dataforge.utils.DateTimeUtils
import hep.dataforge.values.Value import hep.dataforge.values.Value
import hep.dataforge.values.ValueType.* import hep.dataforge.values.ValueType.*
import inr.numass.control.booleanState import hep.dataforge.control.devices.booleanState
import inr.numass.control.doubleState import hep.dataforge.control.devices.doubleState
import inr.numass.control.timeState import hep.dataforge.control.devices.timeState
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.text.DecimalFormat import java.text.DecimalFormat
import java.time.Duration import java.time.Duration

View File

@ -41,7 +41,7 @@ object ConsoleVac {
val delay = Duration.parse(cli.getOptionValue("d", "PT1M")) val delay = Duration.parse(cli.getOptionValue("d", "PT1M"))
val sensor = Class.forName(className) val sensor = Class.forName(className)
.getConstructor(String::class.java).newInstance(port) as Sensor<*> .getConstructor(String::class.java).newInstance(port) as Sensor
try { try {
sensor.init() sensor.init()
while (true) { while (true) {

View File

@ -47,7 +47,7 @@ import java.util.stream.Stream
@RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection::class, info = "Storage for acquired points") @RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection::class, info = "Storage for acquired points")
@StateDef(value = ValueDef(name = "storing", info = "Define if this device is currently writes to storage"), writable = true) @StateDef(value = ValueDef(name = "storing", info = "Define if this device is currently writes to storage"), writable = true)
@DeviceView(VacCollectorDisplay::class) @DeviceView(VacCollectorDisplay::class)
class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<Sensor<Double>>) : Sensor<Values>(context, meta), DeviceHub { class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<Sensor>) : Sensor(context, meta), DeviceHub {
private val helper = StorageHelper(this, this::buildLoader) private val helper = StorageHelper(this, this::buildLoader)

View File

@ -16,7 +16,7 @@ class VacDeviceFactory : DeviceFactory {
return "numass.vac" return "numass.vac"
} }
private fun buildSensor(context: Context, sensorConfig: Meta): Sensor<Double> { private fun buildSensor(context: Context, sensorConfig: Meta): Sensor {
return when (sensorConfig.getString("sensorType", "")) { return when (sensorConfig.getString("sensorType", "")) {
"mks" -> MKSVacDevice(context, sensorConfig) "mks" -> MKSVacDevice(context, sensorConfig)
"CM32" -> CM32Device(context, sensorConfig) "CM32" -> CM32Device(context, sensorConfig)
@ -30,7 +30,7 @@ class VacDeviceFactory : DeviceFactory {
override fun build(context: Context, config: Meta): VacCollectorDevice { override fun build(context: Context, config: Meta): VacCollectorDevice {
val sensors = config.getMetaList("sensor").stream() val sensors = config.getMetaList("sensor").stream()
.map { sensorConfig -> buildSensor(context, sensorConfig) } .map { sensorConfig -> buildSensor(context, sensorConfig) }
.collect(Collectors.toList<Sensor<Double>>()) .collect(Collectors.toList<Sensor>())
return VacCollectorDevice(context, config, sensors) return VacCollectorDevice(context, config, sensors)
} }

View File

@ -31,7 +31,7 @@ import java.time.format.DateTimeFormatter
/** /**
* @author [Alexander Nozik](mailto:altavir@gmail.com) * @author [Alexander Nozik](mailto:altavir@gmail.com)
*/ */
open class VacDisplay : DeviceDisplay<Sensor<Double>>(), MeasurementListener { open class VacDisplay : DeviceDisplay<Sensor>(), MeasurementListener {
val statusProperty = SimpleStringProperty("") val statusProperty = SimpleStringProperty("")
var status: String by statusProperty var status: String by statusProperty
@ -43,7 +43,7 @@ open class VacDisplay : DeviceDisplay<Sensor<Double>>(), MeasurementListener {
var time: Instant by timeProperty var time: Instant by timeProperty
override fun buildView(device: Sensor<Double>): View { override fun buildView(device: Sensor): View {
return VacView(); return VacView();
} }

View File

@ -69,6 +69,7 @@ public final class NumassProto {
com.google.protobuf.GeneratedMessageV3 implements com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:inr.numass.data.Point) // @@protoc_insertion_point(message_implements:inr.numass.data.Point)
PointOrBuilder { PointOrBuilder {
private static final long serialVersionUID = 0L;
// Use Point.newBuilder() to construct. // Use Point.newBuilder() to construct.
private Point(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { private Point(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder); super(builder);
@ -80,14 +81,19 @@ public final class NumassProto {
@java.lang.Override @java.lang.Override
public final com.google.protobuf.UnknownFieldSet public final com.google.protobuf.UnknownFieldSet
getUnknownFields() { getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); return this.unknownFields;
} }
private Point( private Point(
com.google.protobuf.CodedInputStream input, com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException { throws com.google.protobuf.InvalidProtocolBufferException {
this(); this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0; int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try { try {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -97,7 +103,8 @@ public final class NumassProto {
done = true; done = true;
break; break;
default: { default: {
if (!input.skipField(tag)) { if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true; done = true;
} }
break; break;
@ -122,6 +129,7 @@ public final class NumassProto {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
channels_ = java.util.Collections.unmodifiableList(channels_); channels_ = java.util.Collections.unmodifiableList(channels_);
} }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
} }
} }
@ -205,6 +213,7 @@ public final class NumassProto {
com.google.protobuf.GeneratedMessageV3 implements com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel) // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel)
ChannelOrBuilder { ChannelOrBuilder {
private static final long serialVersionUID = 0L;
// Use Channel.newBuilder() to construct. // Use Channel.newBuilder() to construct.
private Channel(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { private Channel(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder); super(builder);
@ -217,14 +226,19 @@ public final class NumassProto {
@java.lang.Override @java.lang.Override
public final com.google.protobuf.UnknownFieldSet public final com.google.protobuf.UnknownFieldSet
getUnknownFields() { getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); return this.unknownFields;
} }
private Channel( private Channel(
com.google.protobuf.CodedInputStream input, com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException { throws com.google.protobuf.InvalidProtocolBufferException {
this(); this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0; int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try { try {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -234,7 +248,8 @@ public final class NumassProto {
done = true; done = true;
break; break;
default: { default: {
if (!input.skipField(tag)) { if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true; done = true;
} }
break; break;
@ -264,6 +279,7 @@ public final class NumassProto {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
blocks_ = java.util.Collections.unmodifiableList(blocks_); blocks_ = java.util.Collections.unmodifiableList(blocks_);
} }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
} }
} }
@ -372,6 +388,7 @@ public final class NumassProto {
com.google.protobuf.GeneratedMessageV3 implements com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block) // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block)
BlockOrBuilder { BlockOrBuilder {
private static final long serialVersionUID = 0L;
// Use Block.newBuilder() to construct. // Use Block.newBuilder() to construct.
private Block(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { private Block(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder); super(builder);
@ -384,14 +401,19 @@ public final class NumassProto {
@java.lang.Override @java.lang.Override
public final com.google.protobuf.UnknownFieldSet public final com.google.protobuf.UnknownFieldSet
getUnknownFields() { getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); return this.unknownFields;
} }
private Block( private Block(
com.google.protobuf.CodedInputStream input, com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException { throws com.google.protobuf.InvalidProtocolBufferException {
this(); this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0; int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try { try {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -401,7 +423,8 @@ public final class NumassProto {
done = true; done = true;
break; break;
default: { default: {
if (!input.skipField(tag)) { if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true; done = true;
} }
break; break;
@ -444,6 +467,7 @@ public final class NumassProto {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
frames_ = java.util.Collections.unmodifiableList(frames_); frames_ = java.util.Collections.unmodifiableList(frames_);
} }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
} }
} }
@ -492,6 +516,7 @@ public final class NumassProto {
com.google.protobuf.GeneratedMessageV3 implements com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Frame) // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Frame)
FrameOrBuilder { FrameOrBuilder {
private static final long serialVersionUID = 0L;
// Use Frame.newBuilder() to construct. // Use Frame.newBuilder() to construct.
private Frame(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { private Frame(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder); super(builder);
@ -504,14 +529,19 @@ public final class NumassProto {
@java.lang.Override @java.lang.Override
public final com.google.protobuf.UnknownFieldSet public final com.google.protobuf.UnknownFieldSet
getUnknownFields() { getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); return this.unknownFields;
} }
private Frame( private Frame(
com.google.protobuf.CodedInputStream input, com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException { throws com.google.protobuf.InvalidProtocolBufferException {
this(); this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0; int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try { try {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -521,7 +551,8 @@ public final class NumassProto {
done = true; done = true;
break; break;
default: { default: {
if (!input.skipField(tag)) { if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true; done = true;
} }
break; break;
@ -544,6 +575,7 @@ public final class NumassProto {
throw new com.google.protobuf.InvalidProtocolBufferException( throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this); e).setUnfinishedMessage(this);
} finally { } finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
} }
} }
@ -603,6 +635,7 @@ public final class NumassProto {
if (!data_.isEmpty()) { if (!data_.isEmpty()) {
output.writeBytes(2, data_); output.writeBytes(2, data_);
} }
unknownFields.writeTo(output);
} }
public int getSerializedSize() { public int getSerializedSize() {
@ -618,11 +651,11 @@ public final class NumassProto {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, data_); .computeBytesSize(2, data_);
} }
size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
} }
private static final long serialVersionUID = 0L;
@java.lang.Override @java.lang.Override
public boolean equals(final java.lang.Object obj) { public boolean equals(final java.lang.Object obj) {
if (obj == this) { if (obj == this) {
@ -638,6 +671,7 @@ public final class NumassProto {
== other.getTime()); == other.getTime());
result = result && getData() result = result && getData()
.equals(other.getData()); .equals(other.getData());
result = result && unknownFields.equals(other.unknownFields);
return result; return result;
} }
@ -823,7 +857,7 @@ public final class NumassProto {
} }
public Builder setField( public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.setField(field, value); return (Builder) super.setField(field, value);
} }
public Builder clearField( public Builder clearField(
@ -836,12 +870,12 @@ public final class NumassProto {
} }
public Builder setRepeatedField( public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) { int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value); return (Builder) super.setRepeatedField(field, index, value);
} }
public Builder addRepeatedField( public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value); return (Builder) super.addRepeatedField(field, value);
} }
public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.protobuf.Message other) {
@ -861,6 +895,7 @@ public final class NumassProto {
if (other.getData() != com.google.protobuf.ByteString.EMPTY) { if (other.getData() != com.google.protobuf.ByteString.EMPTY) {
setData(other.getData()); setData(other.getData());
} }
this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
} }
@ -967,12 +1002,12 @@ public final class NumassProto {
} }
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.setUnknownFieldsProto3(unknownFields);
} }
public final Builder mergeUnknownFields( public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.mergeUnknownFields(unknownFields);
} }
@ -1082,6 +1117,7 @@ public final class NumassProto {
com.google.protobuf.GeneratedMessageV3 implements com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Events) // @@protoc_insertion_point(message_implements:inr.numass.data.Point.Channel.Block.Events)
EventsOrBuilder { EventsOrBuilder {
private static final long serialVersionUID = 0L;
// Use Events.newBuilder() to construct. // Use Events.newBuilder() to construct.
private Events(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { private Events(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder); super(builder);
@ -1094,14 +1130,19 @@ public final class NumassProto {
@java.lang.Override @java.lang.Override
public final com.google.protobuf.UnknownFieldSet public final com.google.protobuf.UnknownFieldSet
getUnknownFields() { getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); return this.unknownFields;
} }
private Events( private Events(
com.google.protobuf.CodedInputStream input, com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException { throws com.google.protobuf.InvalidProtocolBufferException {
this(); this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0; int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try { try {
boolean done = false; boolean done = false;
while (!done) { while (!done) {
@ -1111,7 +1152,8 @@ public final class NumassProto {
done = true; done = true;
break; break;
default: { default: {
if (!input.skipField(tag)) { if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true; done = true;
} }
break; break;
@ -1172,6 +1214,7 @@ public final class NumassProto {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
amplitudes_ = java.util.Collections.unmodifiableList(amplitudes_); amplitudes_ = java.util.Collections.unmodifiableList(amplitudes_);
} }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
} }
} }
@ -1284,6 +1327,7 @@ public final class NumassProto {
for (int i = 0; i < amplitudes_.size(); i++) { for (int i = 0; i < amplitudes_.size(); i++) {
output.writeUInt64NoTag(amplitudes_.get(i)); output.writeUInt64NoTag(amplitudes_.get(i));
} }
unknownFields.writeTo(output);
} }
public int getSerializedSize() { public int getSerializedSize() {
@ -1319,11 +1363,11 @@ public final class NumassProto {
} }
amplitudesMemoizedSerializedSize = dataSize; amplitudesMemoizedSerializedSize = dataSize;
} }
size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
} }
private static final long serialVersionUID = 0L;
@java.lang.Override @java.lang.Override
public boolean equals(final java.lang.Object obj) { public boolean equals(final java.lang.Object obj) {
if (obj == this) { if (obj == this) {
@ -1339,6 +1383,7 @@ public final class NumassProto {
.equals(other.getTimesList()); .equals(other.getTimesList());
result = result && getAmplitudesList() result = result && getAmplitudesList()
.equals(other.getAmplitudesList()); .equals(other.getAmplitudesList());
result = result && unknownFields.equals(other.unknownFields);
return result; return result;
} }
@ -1539,7 +1584,7 @@ public final class NumassProto {
} }
public Builder setField( public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.setField(field, value); return (Builder) super.setField(field, value);
} }
public Builder clearField( public Builder clearField(
@ -1552,12 +1597,12 @@ public final class NumassProto {
} }
public Builder setRepeatedField( public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) { int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value); return (Builder) super.setRepeatedField(field, index, value);
} }
public Builder addRepeatedField( public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value); return (Builder) super.addRepeatedField(field, value);
} }
public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.protobuf.Message other) {
@ -1591,6 +1636,7 @@ public final class NumassProto {
} }
onChanged(); onChanged();
} }
this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
} }
@ -1807,12 +1853,12 @@ public final class NumassProto {
} }
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.setUnknownFieldsProto3(unknownFields);
} }
public final Builder mergeUnknownFields( public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.mergeUnknownFields(unknownFields);
} }
@ -1977,6 +2023,7 @@ public final class NumassProto {
if (events_ != null) { if (events_ != null) {
output.writeMessage(3, getEvents()); output.writeMessage(3, getEvents());
} }
unknownFields.writeTo(output);
} }
public int getSerializedSize() { public int getSerializedSize() {
@ -1996,11 +2043,11 @@ public final class NumassProto {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getEvents()); .computeMessageSize(3, getEvents());
} }
size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
} }
private static final long serialVersionUID = 0L;
@java.lang.Override @java.lang.Override
public boolean equals(final java.lang.Object obj) { public boolean equals(final java.lang.Object obj) {
if (obj == this) { if (obj == this) {
@ -2021,6 +2068,7 @@ public final class NumassProto {
result = result && getEvents() result = result && getEvents()
.equals(other.getEvents()); .equals(other.getEvents());
} }
result = result && unknownFields.equals(other.unknownFields);
return result; return result;
} }
@ -2239,7 +2287,7 @@ public final class NumassProto {
} }
public Builder setField( public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.setField(field, value); return (Builder) super.setField(field, value);
} }
public Builder clearField( public Builder clearField(
@ -2252,12 +2300,12 @@ public final class NumassProto {
} }
public Builder setRepeatedField( public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) { int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value); return (Builder) super.setRepeatedField(field, index, value);
} }
public Builder addRepeatedField( public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value); return (Builder) super.addRepeatedField(field, value);
} }
public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.protobuf.Message other) {
@ -2303,6 +2351,7 @@ public final class NumassProto {
if (other.hasEvents()) { if (other.hasEvents()) {
mergeEvents(other.getEvents()); mergeEvents(other.getEvents());
} }
this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
} }
@ -2834,12 +2883,12 @@ public final class NumassProto {
} }
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.setUnknownFieldsProto3(unknownFields);
} }
public final Builder mergeUnknownFields( public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.mergeUnknownFields(unknownFields);
} }
@ -2968,6 +3017,7 @@ public final class NumassProto {
for (int i = 0; i < blocks_.size(); i++) { for (int i = 0; i < blocks_.size(); i++) {
output.writeMessage(2, blocks_.get(i)); output.writeMessage(2, blocks_.get(i));
} }
unknownFields.writeTo(output);
} }
public int getSerializedSize() { public int getSerializedSize() {
@ -2983,11 +3033,11 @@ public final class NumassProto {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, blocks_.get(i)); .computeMessageSize(2, blocks_.get(i));
} }
size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
} }
private static final long serialVersionUID = 0L;
@java.lang.Override @java.lang.Override
public boolean equals(final java.lang.Object obj) { public boolean equals(final java.lang.Object obj) {
if (obj == this) { if (obj == this) {
@ -3003,6 +3053,7 @@ public final class NumassProto {
== other.getNum()); == other.getNum());
result = result && getBlocksList() result = result && getBlocksList()
.equals(other.getBlocksList()); .equals(other.getBlocksList());
result = result && unknownFields.equals(other.unknownFields);
return result; return result;
} }
@ -3206,7 +3257,7 @@ public final class NumassProto {
} }
public Builder setField( public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.setField(field, value); return (Builder) super.setField(field, value);
} }
public Builder clearField( public Builder clearField(
@ -3219,12 +3270,12 @@ public final class NumassProto {
} }
public Builder setRepeatedField( public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) { int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value); return (Builder) super.setRepeatedField(field, index, value);
} }
public Builder addRepeatedField( public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value); return (Builder) super.addRepeatedField(field, value);
} }
public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.protobuf.Message other) {
@ -3267,6 +3318,7 @@ public final class NumassProto {
} }
} }
} }
this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
} }
@ -3645,12 +3697,12 @@ public final class NumassProto {
} }
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.setUnknownFieldsProto3(unknownFields);
} }
public final Builder mergeUnknownFields( public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.mergeUnknownFields(unknownFields);
} }
@ -3762,6 +3814,7 @@ public final class NumassProto {
for (int i = 0; i < channels_.size(); i++) { for (int i = 0; i < channels_.size(); i++) {
output.writeMessage(1, channels_.get(i)); output.writeMessage(1, channels_.get(i));
} }
unknownFields.writeTo(output);
} }
public int getSerializedSize() { public int getSerializedSize() {
@ -3773,11 +3826,11 @@ public final class NumassProto {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, channels_.get(i)); .computeMessageSize(1, channels_.get(i));
} }
size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
} }
private static final long serialVersionUID = 0L;
@java.lang.Override @java.lang.Override
public boolean equals(final java.lang.Object obj) { public boolean equals(final java.lang.Object obj) {
if (obj == this) { if (obj == this) {
@ -3791,6 +3844,7 @@ public final class NumassProto {
boolean result = true; boolean result = true;
result = result && getChannelsList() result = result && getChannelsList()
.equals(other.getChannelsList()); .equals(other.getChannelsList());
result = result && unknownFields.equals(other.unknownFields);
return result; return result;
} }
@ -3982,7 +4036,7 @@ public final class NumassProto {
} }
public Builder setField( public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.setField(field, value); return (Builder) super.setField(field, value);
} }
public Builder clearField( public Builder clearField(
@ -3995,12 +4049,12 @@ public final class NumassProto {
} }
public Builder setRepeatedField( public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) { int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value); return (Builder) super.setRepeatedField(field, index, value);
} }
public Builder addRepeatedField( public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) { java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value); return (Builder) super.addRepeatedField(field, value);
} }
public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.protobuf.Message other) {
@ -4040,6 +4094,7 @@ public final class NumassProto {
} }
} }
} }
this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
} }
@ -4380,12 +4435,12 @@ public final class NumassProto {
} }
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.setUnknownFieldsProto3(unknownFields);
} }
public final Builder mergeUnknownFields( public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {
return this; return super.mergeUnknownFields(unknownFields);
} }
@ -4470,7 +4525,7 @@ public final class NumassProto {
"data.Point.Channel.Block.Frame\022;\n\006events" + "data.Point.Channel.Block.Frame\022;\n\006events" +
"\030\003 \001(\0132+.inr.numass.data.Point.Channel.B" + "\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" + "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", "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" "litudes\030\002 \003(\004b\006proto3"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =

View File

@ -1,33 +0,0 @@
/*
* Copyright 2017 Alexander Nozik.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts.temp
import hep.dataforge.kodex.GLOBAL
import hep.dataforge.kodex.await
import hep.dataforge.workspace.FileBasedWorkspace
import kotlinx.coroutines.experimental.runBlocking
import java.io.File
fun main(args: Array<String>) {
val numass = FileBasedWorkspace.build(GLOBAL, File("D:\\Work\\Numass\\sterile2017_05\\workspace.groovy").toPath())
runBlocking {
val res = numass
.runTask("analyze", "test")
.getData("Fill_2.set_2").goal.await()
println(res)
}
}

View File

@ -1,78 +0,0 @@
/*
* Copyright 2017 Alexander Nozik.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.scripts.temp
import hep.dataforge.kodex.*
import hep.dataforge.meta.Meta
import hep.dataforge.workspace.BasicWorkspace
import kotlinx.coroutines.experimental.runBlocking
fun main(args: Array<String>) {
runBlocking {
val action = KPipe(
name = "test",
inType = String::class.java,
outType = String::class.java,
action = {
result {
Thread.sleep(300)
"the result is $it"
}
}
)
val testTask = task("test") {
model { meta ->
data("static");
}
action(action)
}
GLOBAL.setValue("cache.enabled", false)
val workspace = BasicWorkspace.Builder()
.setContext(GLOBAL)
.staticData("static", "22")
.task(testTask)
.target(buildMeta("test"))
.build()
val resData = workspace
.runTask("test", "test")
.getData("static")
val taskRes = resData.goal.await()
println(taskRes)
val actionRes = action.run(GLOBAL, workspace.data.checked(String::class.java), Meta.empty())
println(actionRes.getData("static").goal.await())
GLOBAL.close()
// val res = static.pipe<Int, String>(GLOBAL.coroutineContext) {
// Thread.sleep(300)
// "the result is $it"
// }
// println(res.goal.await())
}
}